PDA

View Full Version : How can i draw many pointy efficient ??



TinTin82
10-07-2017, 08:39 AM
Hi,

i have a question how to draw many points with opengl in a efficient way.

Today i have just a Vertex buffer with 4 points for a small cross which is my point.

For every point i want to draw i set up a modeling transformation load it down to the shader with glUniformMatrix4fv and draw the buffer.

Best Regards,
TinTin

PixelClear
10-08-2017, 11:37 AM
The best way to draw lots of points in one go is to use Instancing.
Here you send geometry down the pipeline only once and along with it you pack another VBO containing different model view matrices.
Depending on instance id of point in shader you chose matrices.
Here all the matrices and point geometry you are sending only once to GPU and not every render call hence its very efficient.
for example in below I am drawing mesh 2000 instance with more than 200 FPS with skybox and shadows.

https://www.youtube.com/watch?v=oxAG2Q0N_8I

for doing Instance rendering please refer following tutorial.

http://www.opengl-tutorial.org/intermediate-tutorials/billboards-particles/particles-instancing/