Different texture targets for different texture dimensions?

Started by
2 comments, last by ma_hty 16 years, 2 months ago
... or do texture targets have nothing to do with dimensionality? When you call glBindTexture(...), the named texture is bound to the currently active texture unit set by glActiveTexture (correct me if I'm wrong about this). What I'm wondering is if you call glBindTexture(GL_TEXTURE_1D, ...) and then later call glBindTexture(GL_TEXTURE_2D, ...) without having changed the active unit via glActiveTexture, does the 2D named texture take the place of the 1D named texture, or are there different targets for different dimensionalities?
Advertisement
"different targets for different dimensionalities"... I have never seen anyone refer texture target as "different dimensionalities". It takes me quite a while before I can guess that is saying texture target.

You are free to bind a texture to the current texture unit using any texture target. And, calling glActiveTexture() is not necessary unless you are using multiple texture in a single rendering pass.
Hmm... perhaps I should have worded it differently. Maybe something like "different targets for textures with different numbers of dimensions". So, you'd have your targets for 1D textures, targets for 2D textures, targets for 3D textures, and so on.

Basically, like I said, when you bind a texture using glBindTexture, does the dimensionality of that texture (as specified by the first parameter to glBindTexture: GL_TEXTURE_1D or GL_TEXTURE_2D) have anything to do with where/how it gets bound, or does it always get bound in same manner regardless of the number of dimensions in the texture?

If the answer is that it always gets bound in the same manner regardless of whether it's 1D/2D/3D, then why is the dimension a parameter of the method that performs the binding? It seems counterintuitive to me. Perhaps I don't understand the significance of the first parameter to glBindTexture.

EDIT: I suppose an interesting question, although not exactly what I'm asking about, would be what if you called glBindTexture with a dimension different from the named texture, such as GL_TEXTURE_1D with a 2 dimensional texture, or GL_TEXTURE_2D with a 1 dimensional texture.
When you initialize a texture, you need to specify its dimension. And, it is done by binding it to an appropiate texture target. Once the dimension of a texture is specified, it cannot be changed.

When you bind a initialized texture to a texture target using glBindTexture, the texture target parameter must be the same as the one specified in the texture. In this situation, the first parameter is making the function call more complicated unnecessarily.

Quote:Original post by jorgander
EDIT: I suppose an interesting question, although not exactly what I'm asking about, would be what if you called glBindTexture with a dimension different from the named texture, such as GL_TEXTURE_1D with a 2 dimensional texture, or GL_TEXTURE_2D with a 1 dimensional texture.


You will get an error.

By the way, no one will refer different texture targets using dimensionality nowadays. There is a obvious reason. We have more texture target now.

This topic is closed to new replies.

Advertisement