Added handling of image dirty after a textyre has been bound, the texture

is now updated when the image is dirty.
This commit is contained in:
Robert Osfield
2002-11-19 12:48:58 +00:00
parent 4ae3e5c6bc
commit f46b231305
3 changed files with 17 additions and 3 deletions

View File

@@ -91,6 +91,10 @@ void Texture1D::apply(State& state) const
{
_subloadCallback->subload(*this,state);
}
else if(getModifiedTag(contextID) != _image->getModifiedTag())
{
applyTexImage1D(GL_TEXTURE_1D,_image.get(),state, _textureWidth, _numMimpmapLevels);
}
}
else if (_subloadCallback.valid())

View File

@@ -86,14 +86,19 @@ void Texture2D::apply(State& state) const
if (handle != 0)
{
glBindTexture( GL_TEXTURE_2D, handle );
if (getTextureParameterDirty(state.getContextID())) applyTexParameters(GL_TEXTURE_2D,state);
if (getTextureParameterDirty(state.getContextID()))
applyTexParameters(GL_TEXTURE_2D,state);
if (_subloadCallback.valid())
{
_subloadCallback->subload(*this,state);
}
else if(getModifiedTag(contextID) != _image->getModifiedTag())
{
applyTexImage2D(GL_TEXTURE_2D,_image.get(),state,
_textureWidth, _textureHeight, _numMimpmapLevels);
}
}
else if (_subloadCallback.valid())
@@ -121,7 +126,8 @@ void Texture2D::apply(State& state) const
applyTexParameters(GL_TEXTURE_2D,state);
applyTexImage2D(GL_TEXTURE_2D,_image.get(),state, _textureWidth, _textureHeight, _numMimpmapLevels);
applyTexImage2D(GL_TEXTURE_2D,_image.get(),state,
_textureWidth, _textureHeight, _numMimpmapLevels);
// in theory the following line is redundent, but in practice
// have found that the first frame drawn doesn't apply the textures

View File

@@ -108,6 +108,10 @@ void Texture3D::apply(State& state) const
{
_subloadCallback->subload(*this,state);
}
else if(getModifiedTag(contextID) != _image->getModifiedTag())
{
applyTexImage3D(GL_TEXTURE_3D,_image.get(),state, _textureWidth, _textureHeight, _textureDepth,_numMimpmapLevels);
}
}
else if (_subloadCallback.valid())