- Fixed issue with crash at COpenGLDriver::removeTexture call.
git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/branches/ogl-es@4908 dfc29bdd-3216-0410-991c-e03cc46cb475master
parent
53371c5611
commit
532627be51
|
@ -4967,6 +4967,23 @@ void COpenGLCallBridge::setMatrixMode(GLenum mode)
|
|||
}
|
||||
}
|
||||
|
||||
void COpenGLCallBridge::resetTexture(const ITexture* texture)
|
||||
{
|
||||
for (u32 i = 0; i < MATERIAL_MAX_TEXTURES; ++i)
|
||||
{
|
||||
if (Texture[i] == texture)
|
||||
{
|
||||
if (Driver->MultiTextureExtension)
|
||||
Driver->extGlActiveTexture(GL_TEXTURE0 + i);
|
||||
|
||||
glBindTexture(GL_TEXTURE_2D, 0);
|
||||
|
||||
Texture[i] = 0;
|
||||
TextureType[i] = GL_TEXTURE_2D;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void COpenGLCallBridge::setActiveTexture(GLenum texture)
|
||||
{
|
||||
if (Driver->MultiTextureExtension && ActiveTexture != texture)
|
||||
|
|
|
@ -683,6 +683,8 @@ namespace video
|
|||
|
||||
// Texture calls.
|
||||
|
||||
void resetTexture(const ITexture* texture);
|
||||
|
||||
void setActiveTexture(GLenum texture);
|
||||
|
||||
void setClientActiveTexture(GLenum texture);
|
||||
|
|
|
@ -152,28 +152,12 @@ COpenGLTexture::COpenGLTexture(const io::path& name, COpenGLDriver* driver)
|
|||
//! destructor
|
||||
COpenGLTexture::~COpenGLTexture()
|
||||
{
|
||||
for (u32 i = 0; i < Driver->MaxSupportedTextures; ++i)
|
||||
if (Driver->CurrentTexture[i] == this)
|
||||
{
|
||||
Driver->setActiveTexture(i, 0);
|
||||
Driver->getBridgeCalls()->setTexture(i, TextureType, true);
|
||||
}
|
||||
|
||||
// Remove this texture from active materials as well
|
||||
|
||||
for (u32 i = 0; i < MATERIAL_MAX_TEXTURES; ++i)
|
||||
{
|
||||
if (Driver->Material.TextureLayer[i].Texture == this)
|
||||
Driver->Material.TextureLayer[i].Texture = 0;
|
||||
|
||||
if (Driver->LastMaterial.TextureLayer[i].Texture == this)
|
||||
Driver->LastMaterial.TextureLayer[i].Texture = 0;
|
||||
}
|
||||
|
||||
if (TextureName)
|
||||
glDeleteTextures(1, &TextureName);
|
||||
for (u32 i = 0; i < Image.size(); ++i)
|
||||
Image[i]->drop();
|
||||
|
||||
Driver->getBridgeCalls()->resetTexture(this);
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue