PDA

View Full Version : Does current state get checked when switching states?



Paulius
29-10-2003, 10:32 AM
I?¢_~m not sure if OpenGl checks current state variables before changing them (do unnecisery state change functions get passed to graphics card or not), for example, should I keep a variable for witch texture is currently bound and check if it?¢_~s the one I want to switch to before doing glBindTexture?

Alimonster
04-11-2003, 09:25 AM
I think this is a decision for individual graphics card drivers, not OpenGL itself. Therefore, some will handle redundant changes and others won't -- the only way to be sure would be to test it out (I'll do a quick test later to see for myself!).

I'd err on the side of caution -- after all, your app shouldn't have too many state switches anyway, since you'd use some form of state management (http://www.delphi3d.net/articles/viewarticle.php?article=stateman.htm) in the first place. What's a few more "if" statements versus the real bottleneck (transferring vertex data to video memory, etc.).