O'Reilly logo

Beginning 3D Game Programming by Tom Miller

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Building an Object Pool for Textures

Next, you should think about a problem that wasn't all that important when you were writing the Blockers game but could present itself as a problem now. What if you had three or four different objects that all used the same texture? In the Blockers game, you simply would have loaded the same texture three or four times, which does indeed work; however, I'm sure you can realize that the extra “wasted” space can't be a good thing. Instead of having a system like that, wouldn't it be so much nicer if you had a “cache” of textures so that whenever you created one, you would never re-create it again? That's what you should do now.

Building this object pool is actually pretty easy because you can use one of the ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required