diff --git a/Sources/Engine/Graphics/Texture.cpp b/Sources/Engine/Graphics/Texture.cpp index 9f3f03d..55596bc 100644 --- a/Sources/Engine/Graphics/Texture.cpp +++ b/Sources/Engine/Graphics/Texture.cpp @@ -1312,7 +1312,7 @@ void CTextureData::SetAsCurrent( INDEX iFrameNo/*=0*/, BOOL bForceUpload/*=FALSE // if not already generated, generate bind number(s) and force upload const PIX pixTextureSize = pixWidth*pixHeight; - if( td_ulObject==NONE) + if((td_ctFrames>1 && td_pulObjects==NULL) || td_ulObject==NONE) { // check whether frames are present ASSERT( td_pulFrames!=NULL && td_pulFrames[0]!=0xDEADBEEF); @@ -1367,8 +1367,7 @@ void CTextureData::SetAsCurrent( INDEX iFrameNo/*=0*/, BOOL bForceUpload/*=FALSE for( INDEX iFr=0; iFr1 && td_pulObjects!=NULL) || td_ulObject!=NONE); return; } @@ -1402,14 +1401,11 @@ void CTextureData::SetAsCurrent( INDEX iFrameNo/*=0*/, BOOL bForceUpload/*=FALSE // must reset local texture parameters for each frame of animated texture for( INDEX iFr=0; iFr1) ulTexObject = ((ULONG*)td_ulObject)[iFrameNo]; // animation + ULONG ulTexObject = (td_ctFrames>1) ? td_pulObjects[iFrameNo] : td_ulObject; // single-frame or animation if( bUseProbe) { // set probe if burst value doesn't allow real texture if( _pGfx->gl_slAllowedUploadBurst<0) { @@ -1440,17 +1436,22 @@ void CTextureData::Unbind(void) // reset mark td_tvLastDrawn = (__int64) 0; - // only if bound - if( td_ulObject==NONE) { - ASSERT( td_ulProbeObject==NONE); - return; - } // free frame number(s) if( td_ctFrames>1) { // animation + // only if bound + if( td_pulObjects == NULL || td_pulObjects[0]==NONE) { + ASSERT( td_pulObjects == NULL || td_pulObjects[0]==NONE); + return; + } for( INDEX iFrame=0; iFrame1) ulTexObject = td_pulObjects[0]; + ULONG ulTexObject = (td_ctFrames>1) ? td_pulObjects[0] : td_ulObject; // add structure size and anim block size SLONG slUsed = sizeof(*this) + CAnimData::GetUsedMemory()-sizeof(CAnimData);