void fglEnable( int cap )
{
if ( !glIsEnabled(cap) )
{
glEnable(cap);
}
}
"Very funny, Scotty. Now beam down my clothes."
[edited by - aleks_1661 on August 10, 2003 10:35:05 AM]
OpenGL State Changes
redundant state changes can cost performance, would using a function such as the following improve performance by detecting redundant calls or does opengl do this anyway?
it would only slow it down. and if you are calling it alot, it would be very noticable.
Most implementations will check to see if the state change is redundant before flushing the pipe.
Some implementations don't (or rather, you can't count on that being a guarantee). Another possibility is to store your own states as you modify them in OpenGL. Then you could just check your own value for redundancy in your routine that sets the state.
Again, I don't know how big of a deal that is.
The best way to avoid many state changes is to group your objects such that the state changes are kept to a minimum.
[edited by - Waverider on August 10, 2003 11:19:29 AM]
Again, I don't know how big of a deal that is.
The best way to avoid many state changes is to group your objects such that the state changes are kept to a minimum.
[edited by - Waverider on August 10, 2003 11:19:29 AM]
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement