How to organize OpenGL textures for fashion game?

Posts: 104
Joined: 2007.01
Post: #1
The discussion in 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?

Recommendations, anyone?
Quote this message in a reply
Posts: 834
Joined: 2002.09
Post: #2
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.
Quote this message in a reply
Posts: 1,199
Joined: 2004.10
Post: #3
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.
Quote this message in a reply
Posts: 104
Joined: 2007.01
Post: #4
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.
Quote this message in a reply
Post Reply 

Possibly Related Threads...
Thread: Author Replies: Views: Last Post
  [SOLVED]OpenGL edges of textures mk12 2 4,369 Sep 2, 2010 08:07 PM
Last Post: mk12
  OpenGL Image Textures mikey 52 24,328 Jun 30, 2009 10:42 AM
Last Post: AnotherJake
  Dealing with inverted textures in OpenGL johncmurphy 7 6,983 Jun 15, 2009 08:11 AM
Last Post: Skorche
  Using textures OpenGL switches to software renderer bruno 2 3,540 Oct 12, 2008 03:06 AM
Last Post: bruno
  Loading and using textures with alpha in OpenGL with Cocoa corporatenewt 4 6,134 Dec 8, 2007 02:06 PM
Last Post: Malarkey