Obtaining VBO and IBO from mesh buffer for OpenGL usage

You are an experienced programmer and have a problem with the engine, shaders, or advanced effects? Here you'll get answers.
No questions about C++ programming or topics which are answered in the tutorials!
Post Reply
tomkeus
Posts: 25
Joined: Thu Nov 12, 2009 9:50 pm

Obtaining VBO and IBO from mesh buffer for OpenGL usage

Post by tomkeus »

OK, I'm trying to figure out how to do hardware instancing. It was almost impossible to find any usable code for OpenGL on the net, but I've eventually managed to find something.

In order to do that, whatever I draw, I need to draw with glDrawElementsInstanced with appropriate VBOs and IBOs set. Now when I load mesh I know I can obtain pointers to vertex and index data by getVertices and getIndices methods of IMeshBuffer, but I'm not certain how to use that data with OpenGL.

Can I use obtained pointers directly or I need to loop through data and make a copy usable for OpenGL, and how are vertex and index data contained within IMeshBuffer drawn, as triangles or some other primitives?
Post Reply