if( mId )
{
context.DeleteTextures( 1, &mId );
+
+ if( mNativeImage )
+ {
+ mNativeImage->GlExtensionDestroy();
+ }
}
}
context.TexParameteri( GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_WRAP_DEFAULT );
// platform specific implementation decides on what GL extension to use
- mNativeImage->TargetTexture();
+ if( mNativeImage->TargetTexture() != 0u )
+ {
+ context.DeleteTextures( 1, &mId );
+ mNativeImage->GlExtensionDestroy();
+ mId = 0u;
+ }
}
}
else
ApplySampler( context, sampler );
+ if( mNativeImage )
+ {
+ //Allow implementation specific operations after binding the texture
+ mNativeImage->PrepareTexture();
+ }
+
return true;
}