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!
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!