making composite textures - Printable Version
+- iDevGames Forums (http://www.idevgames.com/forums)
+-- Forum: Development Zone (/forum-3.html)
+--- Forum: Graphics & Audio Programming (/forum-9.html)
+--- Thread: making composite textures (/thread-3253.html)
making composite textures - Leroy - Jun 8, 2007 11:53 PM
I'm making a 2d isometric rpg in opengl and I use textured quads for all the sprites. I need to be able to copy equipment (textures) to the character texture to create a composite character texture who appears wearing all his equiptment. How should I go about this?
making composite textures - OneSadCookie - Jun 9, 2007 02:03 AM
I wouldn't copy them to the character texture, I'd just draw additional quads with the equipment textures.
making composite textures - Leroy - Jun 9, 2007 12:18 PM
Why wouldn't you copy them into the character texture(and is it ever possible to do so)?
making composite textures - AnotherJake - Jun 9, 2007 01:13 PM
The real question is, why should you? You can draw zillions of textured quads at any given time, why worry about it? Yes you can update your textures with glTexSubImage2D if you really insist on copying the graphics over in software, but my guess is that there isn't much point to go through the extra hassle unless you find that you're really struggling with performance issues.
making composite textures - OneSadCookie - Jun 9, 2007 02:03 PM
You're much more likely to hit performance issues using CopyTexSubImage2D than you are just drawing a few extra quads. The GPU *likes* drawing quads. It's good at it. Let it do what it was intended to.
making composite textures - AnotherJake - Jun 9, 2007 02:14 PM
OneSadCookie Wrote:You're much more likely to hit performance issues using CopyTexSubImage2D than you are just drawing a few extra quads...Oh yeah, definitely if you're doing it frequently, like every frame or something. But if you want to permanently (or semi-permanently as the case may be) change what the texture looks like, glTexSubImage2D will affect that change, and you *will* get better performance drawing one quad rather than two. Still not recommended unless you really find your back up against the wall though. Like you said, let it do the job it was designed for -- drawing more quads is a *good* thing!
making composite textures - Leroy - Jun 9, 2007 02:44 PM
Thanks for the helpful responses. I have one other unrelated question I'd like to ask concerning opengl. Now keep in mind my knowledge in opengl is extremely limited... currently how I handle drawing sprites(including overlapping tiles) in the proper order of their depth(or y screen coord as it would be for my engine) by keeping a 2d array of quads which I load (and draw) with all my sprite and tile quads every frame. This method seems to work fine, but my question is could this be done in a easier and more efficient manner through opengl(and the z-buffer im assuming)?
making composite textures - AnotherJake - Jun 9, 2007 03:45 PM
I don't think there is really any advantage to using depth buffer sorting over your own method, unless you really muck it up somehow, like reordering the entire scene each frame or something. I guess it depends on how you do it. I don't think I'd really worry about it too much -- I certainly don't with sprites
making composite textures - maximile - Jun 9, 2007 04:55 PM
Just relying on the z-buffer brings its own nightmares when you're working with transparent textures. If you've already got your own z-sorting system, I wouldn't change it.