0
$\begingroup$

I am using NVIDIA Nsight to debug my OpenGL state. In the screenshots below:

  • I generate a single texture with the ID 10.
  • I activate GL_TEXTURE0 and bind texture 10 to that texture unit.
  • I generate a single texture with the ID 11.
  • I activate GL_TEXTURE1 and bind texture 11 to that texture unit.

When I view the API inspector, I see that texture 11 is bound to both unit 0 and unit 1, which I presume is GL_TEXTURE0 and GL_TEXTURE1.

Am I misunderstanding something about how texture units work in OpenGL? This is not the behavior I would expect.

Events tab

API Inspector, Textures

$\endgroup$

1 Answer 1

1
$\begingroup$

Fixed. I feel pretty silly. When I set glActiveTexture it primes the OpenGL context to set the active texture for all subsequence texture binds. Thus the bind at line 66 overwrites it. I solved this by setting GL_TEXTURE0 as my 'reset' texture and setting glActivateTexture(GL_TEXTURE0) when I am done binding a texture unit.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.