PDA

View Full Version : How to attach an element buffer to a VAO with DSA?



Groovounet
06-07-2010, 04:11 AM
For OpenGL 3.3 conformance, I am updating some Direct State Access code to use VAO. Problem: I have no idea how to attach an element buffer to a VAO with DSA.

Example of VAO code with 'bind and edit':


glBindVertexArray(VertexArrayName);
glBindBuffer(GL_ARRAY_BUFFER, ArrayBufferName);
glVertexAttribPointer(semantic::attr::POSITION, 2, GL_FLOAT, GL_FALSE, 0, 0);

glEnableVertexAttribArray(semantic::attr::POSITION );
glBindBuffer(GL_ARRAY_BUFFER, 0);

glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, ElementBufferName);
glBindVertexArray(0);


So far what I have with VAO code with 'direct state access':



glVertexArrayVertexAttribOffsetEXT(VertexArrayName , ArrayBufferName, semantic::attr::POSITION, 2, GL_FLOAT, GL_FALSE, 0, 0);
glEnableVertexArrayAttribEXT(VertexArrayName, semantic::attr::POSITION);

???


Thanks!

randall
06-07-2010, 07:28 AM
I had the same problem. I am not aware of any solution. I had to 'bind'.

Groovounet
06-07-2010, 08:31 AM
*OWNED*
VAO fail again? I am so evil with VAO! XD

Alfonse Reinheart
06-07-2010, 09:36 AM
I have no idea how to attach an element buffer to a VAO with DSA.

That's because you can't. DSA was released alongside GL 3.0, so it originally didn't encapsulate any 3.0 functionality. They modified the extension to do so (unfortunately), but this was apparently done in haste. And they missed this particular case.