Ensure MIPMAP levels is reset when rebinding an existing texture to a

texture unit.
This commit is contained in:
Jason Edmeades 2003-07-02 00:38:01 +00:00 committed by Alexandre Julliard
parent 39538a5a9c
commit 9a9fcd1ad4
1 changed files with 12 additions and 9 deletions

View File

@ -120,6 +120,7 @@ void WINAPI IDirect3DTexture8Impl_PreLoad(LPDIRECT3DTEXTURE8 iface) {
TRACE("Texture %p (level %d) given name %d\n", This->surfaces[i], i, This->surfaces[i]->textureName);
/* No need to walk through all mip-map levels, since already all assigned */
i = This->levels;
} else {
if (i == 0) {
if (This->surfaces[i]->textureName == 0) {
@ -130,19 +131,21 @@ void WINAPI IDirect3DTexture8Impl_PreLoad(LPDIRECT3DTEXTURE8 iface) {
glBindTexture(GL_TEXTURE_2D, This->surfaces[i]->textureName);
checkGLcall("glBindTexture");
}
IDirect3DSurface8Impl_LoadTexture((LPDIRECT3DSURFACE8) This->surfaces[i], GL_TEXTURE_2D, i);
}
}
/* No longer dirty */
This->Dirty = FALSE;
/* Always need to reset the number of mipmap levels when rebinding as it is
a property of the active texture unit, and another texture may have set it
to a different value */
TRACE("Setting GL_TEXTURE_MAX_LEVEL to %d\n", This->levels - 1);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAX_LEVEL, This->levels - 1);
checkGLcall("glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAX_LEVEL, This->levels)");
}
IDirect3DSurface8Impl_LoadTexture((LPDIRECT3DSURFACE8) This->surfaces[i], GL_TEXTURE_2D, i);
/* Removed glTexParameterf now TextureStageStates are initialized at startup */
This->Dirty = FALSE;
}
}
LEAVE_GL();
return ;