How to organize OpenGL textures for fashion game? - Printable Version
+- iDevGames Forums (http://www.idevgames.com/forums)
+-- Forum: Development Zone (/forum-3.html)
+--- Forum: Graphics & Audio Programming (/forum-9.html)
+--- Thread: How to organize OpenGL textures for fashion game? (/thread-3306.html)
How to organize OpenGL textures for fashion game? - GolfHacker - May 3, 2007 08:02 AM
The discussion in http://www.idevgames.com/forum/showthread.php?t=13922 got me thinking about how I should organize OpenGL textures for Fashion Cents Deluxe. I didn't want to hijack his thread, so I started a new one.
The final Fashion Cents Deluxe game will include hundreds of different styles of hats, tops, bottoms, shoes, dresses, etc, and each style will have anywhere from 15-30 different colors/patterns. That's a lot of textures.
Here's a couple of screenshots for reference (click on the links):
New OpenGL version, containing a few of the revised clothing graphics
Original DirectDraw version, demonstrating the wide variety of clothing styles
Original game's home page, with more screenshots
For the original Windows version (using DirectDraw 7), I had organized the textures by style. Each style of hat, for example, had its own image file containing the 15-30 variants of that style. That kept each image size relatively low, and by blitting portions of each file (i.e., an individual hat), it minimized the number of pixels I had to send to DirectDraw. The performance was pretty good - the game was very playable on 800MHz PCs, even with all of the add-on packs installed (which add more clothing styles to the game).
Will this organization still be effective with OpenGL? Or will the massive amount of texture switching be a problem? I'm concerned that if I lumped all the hats into one huge texture, for example, I may reduce the amount of texture switching but I would be blasting a whole lot of pixels to the video card that I'm probably not even going to use. Not only that, some of the clothing items in the game are pretty big (like floor-length ball gowns), so I can't possibly throw all ball gowns into a single texture anyway.
Does anyone have some practical advice? Has anyone else dealt with such a diversity in graphics, and if so, how did you organize them for maximum performance?
How to organize OpenGL textures for fashion game? - Fenris - May 3, 2007 10:22 AM
I would advise you to look at El Ballo (check my signature). It has crazy amounts of texture data and it runs very well on old Macs.
It's basically just sprites lumped into texture files (I would actually recommend you to put all your ball gowns into a set of 1024x1024 textures - no real-world problem there.)
As for texture switching, I'm taking an educated guess that you at absolute worst be switching texture a couple of hundred times per frame. That's not catastrophic, although perhaps not extremely smooth. What you could do in this case is brute-force-render them once, and then update them as you need them by using glScissor.
All in all, this should not be very much of a problem. El Ballo typically draws 5-600 sprites per frame, using at least 20 or so large textures; it chugs along very well.
How to organize OpenGL textures for fashion game? - TomorrowPlusX - May 3, 2007 12:35 PM
I'd try doing it the easiest way first, then profile, then if it actually is slow start optimizing.
There's all sorts of stuff that you think will be slow, but turn out to be faster than blazes already.
Premature optimization == root of all evil. Or so I've heard.
How to organize OpenGL textures for fashion game? - GolfHacker - May 7, 2007 07:34 AM
Thanks, guys! I'll stick with the current implementation for now (each style in its own file, including all the ball gowns in one huge file), and see how the performance goes when I'm done.