How to draw multiple objects.
I wrote a header file to import obj model files.
it works good.
I'd like to share the header files with you.
the picture was rendered by this code.
But I only know how to render one object. I have no idea with rendering two or more objects.
I tried.http://codepad.org/bsdOJdhm//But It crashed.
Could you give a simple example which uses glBuffer,glVertexAttribPointer&glDrawElement to draw multiple objects?
I would appreciate alot for your help.
The last parameter in glDrawElements is an offset. If you put several objects in a buffer, you can render each separately by calling glDrawElements multiple times with different offsets and lengths.If all the objects are static you can render them all with a single call.
You code is probably not working because you have several buffers but you only have one bound for rendering. You have to bind the buffer to match your glDrawElement.
Last edited by tonyo_au; 07-07-2013 at 09:57 PM.
Thank you very much.Your suggestion helps me a lot.
Originally Posted by tonyo_au