Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6626267
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T21:52:23+00:00 2026-05-25T21:52:23+00:00

How do I turn off a texture unit, or at least prevent its state

  • 0

How do I turn off a texture unit, or at least prevent its state changing when I bind a texture? I’m using shaders so there’s no glDisable for this I don’t think. The problem is that the chain of events might look something like this:

Create texture 1 (implies binding it)
Use texture 1 with texture unit 1
Create texture 2 (implies binding it)
Use texture 2 with texture unit 2

, but given glActiveTexture semantics, it seems this isn’t possible, because the create of texture 2 will become associated with the state of texture unit 1, as that was the last unit I called glActiveTexture on. i.e. you have to write:

Create texture 1
Create texture 2
Use texture 1 with texture unit 1
Use texture 2 with texture unit 2

I’ve simplified the example of course, but the fact that creating and binding a texture can incidentally affect the currently active texture unit even when you are only binding the texture as part of the creation process is something that makes me somewhat uncomfortable. Unless of course I’ve made an error here and there’s something I can do to disable state changes in the current glActiveTexture?

Thanks for any assistance you can give me here.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-25T21:52:24+00:00Added an answer on May 25, 2026 at 9:52 pm

    This is pretty much something you just have to learn to live with in OpenGL. GL functions only affect the current state. So to modify an object, you must bind it to the current state, and modify it.

    In general however, you shouldn’t have a problem. There is no reason to create textures in the same place where you’re binding them for use. The code that actually walks your scene and binds textures for rendering should never be creating textures. The rendering code should establish all necessary state for each rendering (unless it knows that all necessary state was previously established in this rendering call). So it should be binding all of the textures that each object needs. So previously created textures will be evicted.

    And in general, I would suggest unbinding textures after creation (ie: glBindTexture(..., 0)). This prevents them from sticking around.

    And remember: when you bind a texture, you also unbind whatever texture was currently bound. So the texture functions will only affect the new object.

    However, if you want to rely on an EXT extension, there is EXT_direct_state_access. It is supported by NVIDIA and AMD, so it’s fairly widely available. It allows you to modify objects without binding them, so you can create a texture without binding it.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

how do I turn off PC using remote desktop with simple user account? There
I am trying to turn off Nagle's algorithm for a BSD socket using: setsockopt(newSock,
How can I turn off JavaScript shortening in A4J? I remember there was an
Is there a possibility to turn off the automatic enclosing of all written content
Is there a way to turn off all visual updates to a .NET form
Is there a way turn off touch events that use a UIView class? I'm
Is there any way to turn off all console.log statements in my JavaScript code,
Is there a way to programmatically turn off that autosuggest list which pops up
I'm trying to turn off marginpar when starting a new multicols environment with this
I want to turn off JavaScript using JavaScript (and/or jQuery) code, only if the

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.