Hi all,
First up I tried to find a similar post but could not so i thought I would post it in.
Basically, I have already implemented this but I want to know the inner workings of glDrawArrays fucntion as regards the per-vertex attributes when rendering a set of points.
I have an entirely vertex shader based particle system that uses no per-vertex attributes in the vertex shader ( iuse vertexID so dynamically position the particle). It works on both ATI and NVIDIA hardware without a problem (I have tested it with the latest drivers for both vendors)
The application side I generate and bind a vertex array object.
Code :glGenVertexArrays(1, &vaoID); glBindVertexArray(vaoID);
If I call the glDrawArrays function after this setup only, it works on NVIDIA hardware however on ATI it does not work (no errors but my particles dont show up). So, I added in a buffer object and enabled attribute 0 and vertexattribarray like this
If I call the glDrawArrays after this setup, it works on both ATI and NVIDIA hardware.Code :glGenBuffers(1, &vboVerticesID); glBindBuffer (GL_ARRAY_BUFFER, vboVerticesID); glBufferData (GL_ARRAY_BUFFER, 1, 0, GL_STATIC_DRAW); glEnableVertexAttribArray(0); glVertexAttribPointer(0,1,GL_UNSIGNED_BYTE, GL_FALSE,0,0);
So I want to know
1) why is it so that when I invoke glDrawArrays call without the buffer object, enable vertex attrib/vertex attrib pointer call, I get nothing on screen on ATI but these calls seem redundant on NVIDIA hardware (looks like a driver bug to me)?
2) Even though I pass in 1 byte in my buffer object, what other attributes will glDrawArray pass to my vertex shader when I have not given any myself? When i have explicitly enabled vertex attrib 0, and passed 1 byte to it, will pass 1 value but what about the values for other 99 particles when I make a glDrawArrays call like this glDrawArrays(GL_POINTS,0, 100);?
PS: Really sorry if this seems stupid.
Thanks,
Mobeen