I wrote a header file to import obj model files.
it works good.[ATTACH=CONFIG]453[/ATTACH]
I’d like to share the header files with you. http://codepad.org/ySNEa8KU
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.
[QUOTE=tonyo_au;1252500]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.[/QUOTE]
Thank you very much.Your suggestion helps me a lot.