OpenGL commands in MD2

Nibbie
Posts: 1
Joined: 2009.02
Post: #1
Hi,

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.

Thanks!
Quote this message in a reply
Moderator
Posts: 3,577
Joined: 2003.06
Post: #2
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.
Quote this message in a reply
Member
Posts: 45
Joined: 2008.04
Post: #3
For my use I just turned the fans and strips into triangle soup for one single glDrawElements call.
Quote this message in a reply
Member
Posts: 269
Joined: 2005.04
Post: #4
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.
Quote this message in a reply
Post Reply