Reputation: 692
In a program I am intending to be writing to lots of pixels individually. I'm guessing that using a vbo, shaders and GL_POINTS
isn't very efficent. A thought I had was to draw two triangles across the whole screen and then write to every pixel in the fragment shader, although i'm not sure how efficient that would be?
I am using openGL 3 so none of the deprecated functions are being used.
Upvotes: 1
Views: 799
Reputation: 11031
In the new OpenGL you can bind a FBO with no attachment and use image output in a fragment shader to achieve a similar functionality. However, poor performance can be expected because of (possibly) highly irregular memory access patterns, which can be fatal on GPU. But perhaps you can achieve slightly better performance than when rasterizing points.
Upvotes: 1
Reputation: 3172
Have you considered instanced rendering ? Drawing even 2 pixel-sized triangles may be faster than drawing points.
Have a look at glDrawArraysInstanced
and glVertexAttribDivisor
(for applying different colors etc.).
If you particles have an acceleration or any deterministic position change algorithm, you can even apply this change in the vertex shader to limit the space occupied by the associated VBO (no need to keep positions) and the CPU time (only a few GL call is required to draw AND animate the whole particle system).
Upvotes: 1