Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

texture unit worry

0 views
Skip to first unread message

keith

unread,
Dec 26, 2009, 10:22:27 PM12/26/09
to
Complex objects I render tend to need more than one texture unit.
Because the rendering code of each object does not know in what state
the texture units are when it gets called it needs to setup them anew
each time, wasting some precious time. I'd like to ask for some ideas on
how to remedy this. Is there a way?

jbwest

unread,
Dec 27, 2009, 10:19:59 AM12/27/09
to

"keith" <johndo...@yahoo.com> wrote in message
news:hh6jtn$bu4$1...@news.eternal-september.org...


carry your own "shadow" state around if you are worried, Wrap the relevent
OpenGL calls with your own methods, and in those methods maintain state; add
lightweight queries (to your shadow state) as needed

jbw


keith

unread,
Dec 27, 2009, 11:34:10 AM12/27/09
to
jbwest pravi:

> carry your own "shadow" state around if you are worried, Wrap the relevent
> OpenGL calls with your own methods, and in those methods maintain state; add
> lightweight queries (to your shadow state) as needed

I guess reseting state every time is a nonissue for you.

fungus

unread,
Dec 27, 2009, 12:08:04 PM12/27/09
to
On Dec 27, 4:22 am, keith <johndoe64...@yahoo.com> wrote:
> Complex objects I render tend to need more than one texture unit.
> Because the rendering code of each object does not know in what state
> the texture units are when it gets called

...so all you need to do is remember the state!

> it needs to setup them anew
> each time, wasting some precious time. I'd like to ask for some ideas on
> how to remedy this. Is there a way?

Don't know what you're expecting but the state
needs to be set. In my experience you'll never
get it 100% perfect.


--
<\___/>
/ O O \
\_____/ FTB.

http://www.topaz3d.com/ - New 3D editor for real time simulation

jbwest

unread,
Dec 27, 2009, 4:17:55 PM12/27/09
to

"keith" <johndo...@yahoo.com> wrote in message
news:hh82a3$n57$1...@news.eternal-september.org...

Huh? Your "wrapped" functions can test to see if the current state is
already set, and do nothing if that's the case, "saving" state setting.

jbw


keith

unread,
Dec 27, 2009, 5:04:52 PM12/27/09
to
fungus pravi:

> Don't know what you're expecting but the state
> needs to be set. In my experience you'll never
> get it 100% perfect.

You are correct. I'll just set all texture units to "meaningful" state
defaults at startup. All objects who don't conform will just have to set
their non-default state and reset it to default after rendering.

Dave Eberly

unread,
Dec 27, 2009, 11:26:25 PM12/27/09
to
"keith" <johndo...@yahoo.com> wrote in message
news:hh8lm3$jqg$1...@news.eternal-september.org...

> You are correct. I'll just set all texture units to "meaningful" state
> defaults at startup. All objects who don't conform will just have to set
> their non-default state and reset it to default after rendering.

If each object is responsible for setting the state it needs to be drawn,
it does not have to reset the state to defaults. Your proposal is "safe",
but you have a lot of state changes you might not really need to do.
Consider sorting your objects to minimize state changes. For a given
set of states, set the states and then draw all objects with those states.

--
Dave Eberly
http://www.geometrictools.com


0 new messages