Added State::getActiveUnit and usage of it in the glTexCopyImage*() implementations

This commit is contained in:
Robert Osfield
2005-03-25 11:07:48 +00:00
parent 9de5dc38f1
commit 60cecb8959
4 changed files with 16 additions and 10 deletions

View File

@@ -617,16 +617,22 @@ class SG_EXPORT State : public Referenced
}
}
/** Set the current texture unit, return true if selected,
* false if selection failed such as when multitexturing is not supported.
* note, only updates values that change.*/
bool setActiveTextureUnit( unsigned int unit );
/** Get the current texture unit.*/
unsigned int getActiveTextureUnit() const { return _currentActiveTextureUnit; }
/** Set the current tex coord array texture unit, return true if selected,
* false if selection failed such as when multitexturing is not supported.
* note, only updates values that change.*/
bool setClientActiveTextureUnit( unsigned int unit );
/** set the current texture unit, return true if selected,
* false if selection failed such as when multitexturing is not supported.
* note, only updates values that change.*/
bool setActiveTextureUnit( unsigned int unit );
/** Get the current tex coord array texture unit.*/
unsigned int getClientActiveTextureUnit() const { return _currentClientActiveTextureUnit; }
/** wrapper around glEnableVertexAttribArrayARB(index);glVertexAttribPointerARB(..);
* note, only updates values that change.*/

View File

@@ -324,7 +324,7 @@ void Texture1D::copyTexImage1D(State& state, int x, int y, int width)
textureObject->setAllocated(_numMipmapLevels,_internalFormat,_textureWidth,1,1,0);
// inform state that this texture is the current one bound.
state.haveAppliedAttribute(this);
state.haveAppliedTextureAttribute(state.getActiveTextureUnit(), this);
}
void Texture1D::copyTexSubImage1D(State& state, int xoffset, int x, int y, int width)
@@ -344,7 +344,7 @@ void Texture1D::copyTexSubImage1D(State& state, int xoffset, int x, int y, int w
glCopyTexSubImage1D( GL_TEXTURE_1D, 0, xoffset, x, y, width);
// inform state that this texture is the current one bound.
state.haveAppliedAttribute(this);
state.haveAppliedTextureAttribute(state.getActiveTextureUnit(), this);
}
else

View File

@@ -293,7 +293,7 @@ void Texture2D::copyTexImage2D(State& state, int x, int y, int width, int height
// inform state that this texture is the current one bound.
state.haveAppliedAttribute(this);
state.haveAppliedTextureAttribute(state.getActiveTextureUnit(), this);
}
void Texture2D::copyTexSubImage2D(State& state, int xoffset, int yoffset, int x, int y, int width, int height )
@@ -336,7 +336,7 @@ void Texture2D::copyTexSubImage2D(State& state, int xoffset, int yoffset, int x,
if (hardwareMipMapOn) glTexParameteri(GL_TEXTURE_2D, GL_GENERATE_MIPMAP_SGIS,GL_FALSE);
// inform state that this texture is the current one bound.
state.haveAppliedAttribute(this);
state.haveAppliedTextureAttribute(state.getActiveTextureUnit(), this);
}
else

View File

@@ -369,7 +369,7 @@ void Texture3D::copyTexSubImage3D(State& state, int xoffset, int yoffset, int zo
//glBindTexture( GL_TEXTURE_3D, handle );
// inform state that this texture is the current one bound.
state.haveAppliedAttribute(this);
state.haveAppliedTextureAttribute(state.getActiveTextureUnit(), this);
}
else