Quick question : Which is the fastest method to render a large array of 4x4/8x8 particles in opengl ? Currently i spend 2triangles for each one but i think that its slow so i would really like to know if im doing it right.....
|
|
You can draw points with OpenGL. You want to call glDrawArrays() or glDrawElements() with GL_POINTS (instead of GL_TRIANGLE_STRIP or whatever you are using.) This will draw points to the screen based on the current point size, which you can set via glPointSize(). You can also alias these points, but in my experience not all drivers / hardware supports aliased points.
|
|||||||||||||||
|
|
In core OpenGL 3.2 and above, geometry shaders are available for use. To give a brief overview, you would only tell OpenGL to draw the points that represent the positions of your particles, and these points would pass through the vertex shader normally, but then when they get to the geometry shader, it constructs the rectangle (out of two tris) by emitting vertices to the next stage of the pipeline. Along with the vertices you can programmatically generate normals and texture coordinates. Since this is all done in hardware, I'm pretty sure it's the fastest way right now to render point-sprite particles. |
|||||||||||||||
|