Name: Anonymous 2012-01-07 23:54
Ok, I'm at my wits end with OpenGL's VAOs.
What's happening is that I'm initializing 2 of these (A cube and an object made of spheres for now) in separate classes, and then intermittently calling them both. After a lot of work, I've discovered that it's because my GL_ELEMENT_ARRAY_BUFFER does not bind to my VAO.
So on each of my render functions, I have:
glBindVertexArray(VAO);
//glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, indexBuffer);
and then I call glDrawElements.
If I do not uncomment that line, only the object that was initialized last (and therefore had its element array bound last) renders correctly. I am of the understanding, though, that this shouldn't be necessary. What am I doing wrong?
Here's a pastebin with the relevant code. Hopefully that helps.
http://pastebin.com/TtQaLiqY
Please tell me that at least one of you guys knows enough OpenGL to know what I'm talking about.
Even the relevant example from the OpenGL programming guide doesn't display correctly.
I don't understand what I'm doing wrong.
What's happening is that I'm initializing 2 of these (A cube and an object made of spheres for now) in separate classes, and then intermittently calling them both. After a lot of work, I've discovered that it's because my GL_ELEMENT_ARRAY_BUFFER does not bind to my VAO.
So on each of my render functions, I have:
glBindVertexArray(VAO);
//glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, indexBuffer);
and then I call glDrawElements.
If I do not uncomment that line, only the object that was initialized last (and therefore had its element array bound last) renders correctly. I am of the understanding, though, that this shouldn't be necessary. What am I doing wrong?
Here's a pastebin with the relevant code. Hopefully that helps.
http://pastebin.com/TtQaLiqY
Please tell me that at least one of you guys knows enough OpenGL to know what I'm talking about.
Even the relevant example from the OpenGL programming guide doesn't display correctly.
I don't understand what I'm doing wrong.