iDevGames Forums
OpenGL commands in MD2 - Printable Version

+- iDevGames Forums (
+-- Forum: Development Zone (/forum-3.html)
+--- Forum: Graphics & Audio Programming (/forum-9.html)
+--- Thread: OpenGL commands in MD2 (/thread-1729.html)

OpenGL commands in MD2 - masonator - Feb 22, 2009 10:51 AM


I've been messing around with making an MD2 model loader for an iPhone app and have come across the GLCommands part of the MD2 format. This is basically instructions for making the model out of triangle fans and triangle strips and so should help make OpenGL rendering quicker. It's a bit of a pain to squish the MD2 data into the correct format to render these via vertex arrays, and I'm just wondering if its even worth it.

I can (I think, correct me if I'm wrong) only render one fan or strip per call to glDrawElements, whereas I could do the whole thing with one call to glDrawElements if I didn't use the GLCommands data. I understand that it's more efficient to copy a few large chunks of data to the graphics hardware than lots of little bits (which makes sense), so in making more glDrawElements calls, do I lose the advantage I gained by using GLCommands in the first place?

Any general advice in this area would be great. Also, Is MD2 even a good choice? I figured a format with more advanced features is probably overkill for the iPhone's hardware.


OpenGL commands in MD2 - AnotherJake - Feb 22, 2009 10:50 PM

I've forgotten all about MD2. Seems reasonable to use though. My hunch tells me that you should focus on using the GLCommands thing and just work with one fan or strip per glDrawElements for now. Once you have it going then maybe change things around some. Maybe make a pre-converter tool to optimize things for iPhone later on, by getting rid of the GLCommands as needed. I dunno though, just throwing a thought out there.

OpenGL commands in MD2 - aBabyRabbit - Feb 22, 2009 11:01 PM

For my use I just turned the fans and strips into triangle soup for one single glDrawElements call.

OpenGL commands in MD2 - Bachus - Feb 23, 2009 01:51 AM

aBabyRabbit Wrote:For my use I just turned the fans and strips into triangle soup for one single glDrawElements call.

That's what I did for my old MD2 code as well. I just ignored the GLCommands part of the MD2 files and drew the whole model in one call. Cards today are a lot more sophisticated than those dinosaurs of the Quake 2 era.