I'm building a particle sim using OpenGL and am trying to benchmark the various methods of setting up the particles. Before I progress to instancing or transform feedback, I wanted to create independently moving points using only a standard VBO.
So far I have tried moving points by updating the buffer data using glBufferSubData, filling up an empty buffer. However, the frame rate drops as soon as you get close to 10,000 points. I need at least a few million for my purpose eventually.
At this minute I'm now experimenting with transformation matrices and have the following:
In my shader:
in layout(location = 0) vec3 positions;
uniform mat4 transform[10];
void main(){
int count = 0;
count + 1;
gl_Position = transform[count] * vec4(positions, 1.0);
}
and in my program draw loop:
self.matrices[i] = Matrix44.from_translation(Vector3([0.0,-self.t,0.0]))
glUniformMatrix4fv(self.transformMatrixNameloc,10,GL_FALSE,self.matrices[i])
Although this seems to be working, I cannot get the time (self.t) to reset / restart each time for each new particle drawn. I'm using this variable for testing by the way, in place of a gravity force for now.
Any ideas?
Many thanks,