glActiveTexture and glBindTexture

What is the difference?

Sometimes I have to use glActiveTexture and sometimes glBindTexture.

Has the graphics card “slots” like GL_TEXTUREx or is the memory totaly dynamic allocatable?

best regards,
Fredrik

glActiveTexture only sets the currently active texture unit (or “texture image unit” in OpenGL ES 2.0).

Valid values to pass to glActiveTexture are GL_TEXTURE0 to GL_TEXTUREn-1, where n is the implementation dependent number GL_MAX_TEXTURE_UNITS (or GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS for OpenGL ES 2.0).

glActiveTexture does nothing in itself, it only means that subsequent calls to change texturing state will target this texture unit (until you call glActiveTexture again with another index).

glBindTexture binds a texture object to a certain target (GL_TEXTURE_2D, GL_TEXTURE_CUBE, etc.) on the currently active texture unit. This means two things:

  • calls to set up texture object state (glTexParameter) and data (glTexImage) affect the texture object bound to the current texture unit.
  • when rendering, this texture unit will use the texture object state (e.g. wrap and filter modes) and image data from the bound texture object.

This topic was automatically closed 183 days after the last reply. New replies are no longer allowed.