Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: Drawing points  (Read 137 times)

0 Members and 1 Guest are viewing this topic.

Hey

  • Newbie
  • *
  • Posts: 5
    • View Profile
Drawing points
« on: September 06, 2019, 07:39:47 pm »
Hello everyone, I am trying to draw around 10,000 points. So instead of calling window.draw(...) 10,000 times I was thinking of putting into a vertex array, and drawing with single draw call.

But how can I increase the point size? I know the OpenGL function that does this, which is glPointSize(...). But is there another way?

Here is a example image: https://imgur.com/Va6GYXK

Paul

  • Newbie
  • *
  • Posts: 33
    • View Profile
Re: Drawing points
« Reply #1 on: September 09, 2019, 09:56:14 am »
You can use quads instead of points.

Nexus

  • SFML Team
  • Hero Member
  • *****
  • Posts: 6193
  • Thor Developer
    • View Profile
    • Bromeon
Re: Drawing points
« Reply #2 on: September 11, 2019, 06:43:12 pm »
SFML doesn't let you draw bigger points directly.

Multiple options:
  • sf::VertexArray: Draw triangles or quads if the shape is ok
  • sf::VertexArray: Draw multiple points per point
  • sf::VertexArray: Use a texture for a point, and draw it with quads (4 vertices per point)
  • sf::RenderTexture, sf::Texture, sf::Sprite: Draw the points once to a render texture, build a sprite from it and draw that
Zloxx II: action platformer
Thor Library: particle systems, animations, dot products, ...
SFML Game Development: first SFML book