Re: [Plib-users] Texture remains enabled after first use
Brought to you by:
sjbaker
From: Steve B. <sjb...@ai...> - 2004-12-31 14:33:04
|
Daniel Sperka wrote: > Sounds like the best thing is to create a dummy SimpleState and use it > for ALL objects in the tree. If I use texture anywhere, create a > distinct SimpleState and use it for those objects that need it, and make > certain that the dummy state explicitly disables GL_TEXTURE_2D. Same > goes for other GL states. Yes - that's certainly a reasonable approach. What I do in my games is to use the ssgLoaderOptions::setCreateStateCallback() to have the loaders call my application whenever a new ssgState is needed. I use the texture filename to look up the full desired GL state in a text file that I load separately on startup. All polygons without texture (and there are VERY few of those in my applications) are given a 1x1 pure white texture instead - so SSG doesn't have to turn texture on and off. I also use that to set things like the Alpha clamp value that AC3D doesn't give you a way to set in the model. That text file also tells my application things about the polygons (such as their 'solidity', their coefficient of friction and their temperature) that SSG doesn't need to know - but which matter in the game. It's really easy to tag my fire texture as being hot and insubstantial, and my ice texture as being cold, hard and slippery. There is also a default entry in the table for polygons with textures that aren't listed in the file. I also (in my son's first serious game effort) swap out some polygons for particle systems based on their texture. So I paint a texture which is red with the words "IMAGINE A FIRE HERE" written on it. You can model a triangle with that texture on it - and when that model loads, the game's loader will replace it with an ssgaFire of similar size. Now you can light fires in your game level just by dropping in these special polygons in AC3D (or whatever). Someday, it would be nice to make that feature be a part of ssgAux, but I don't have the time right now. ---------------------------- Steve Baker ------------------------- HomeEmail: <sjb...@ai...> WorkEmail: <sj...@li...> HomePage : http://www.sjbaker.org Projects : http://plib.sf.net http://tuxaqfh.sf.net http://tuxkart.sf.net http://prettypoly.sf.net -----BEGIN GEEK CODE BLOCK----- GCS d-- s:+ a+ C++++$ UL+++$ P--- L++++$ E--- W+++ N o+ K? w--- !O M- V-- PS++ PE- Y-- PGP-- t+ 5 X R+++ tv b++ DI++ D G+ e++ h--(-) r+++ y++++ -----END GEEK CODE BLOCK----- |