Now that I’ve finally gotten a VBO and IBO to work, I’m trying to get a simple .bmp texture to display properly. I have my vertex data in a float array of the form
float[] vertices = { x1, y1, z1, u1, v1, x2, y2, z2, u2, v2, etc. }
and I store that in a VBO in the init section, store indices in an IBO, then use glDrawElements() in the draw section to draw everything. Also, in the init section, I load a texture. I know I do that correctly, since when I use glBindTexture, draw a simple triangle using glBegin() and glEnd(), and use glTexCoord to assign uv coords to vertices, it comes out as it should.
My problem is that I can’t seem to move from that to using VBO uv data. I don’t know how to get the code to recognize the u and v floats in the vertex array as uv coordinates, and I can’t get it to apply the texture to the shape I draw using glDrawElements. When I just have glBindTexture followed by the glDrawElements bit to draw the square, I get the same untextured red square as when I don’t have a texture at all, only it’s somewhat darker.
Kopelrativ’s first post here leads me to suspect I need to do something with shaders, but I’m not sure what I need to do with them. What’s the equivalent for glTexCoord when using VBOs and IBOs? How come glDrawElements drew an untextured object just fine without my having to write custom shaders? Can I still use glBindTexture, or do I have to use some kind of Texture Buffer Object?