[osg-users] glActiveTexture / glClientActiveTexture state changes

Robert Osfield robert.osfield at gmail.com
Sat Oct 27 08:03:07 PDT 2007

On 10/26/07, DC Fennell <dchristopher at playnet.com> wrote:
> I am curious as to why OSG never resets glActiveTexture or
> glClientActiveTexture back to GL_TEXTURE0 after usage. In my opinion, this
> should always be done. Specifically since glClientActiveTexture is set quite
> often in display lists.

Well display lists don't affect client state once they are built.

And if you always set the active texture before usage there should
never be a need to reset it.

> As a test, I modified osg and osgUtil to reset these states back to
> GL_TEXTURE0 after any usage of glActiveTexture and glClientActiveTexture.
> With this change, all my known issues went away.
> Was there a specific reason why these states are not reset? Or am I just
> doing it wrong?

Lazy state updating is why you don't go change state unless you need to.

The fact its making a difference in your case suggests a problem in
management of osg::State somewhere along the line - with it getting
out of sync. Perhaps you can take a step back and explain what you are
doing at a high level to provoke this problem - even better write a
small example that reproduces the problem so others can investigate
it, learn from it and fix the underlying problem, be it in your own
code/the way you use the OSG or in fix any bug that might be lurking
in the core OSG.


More information about the osg-users mailing list