Fix bug #440 where OpenGL driver enabled second texture for single-texture materials when setMaterial was called twice. Thx@ "number Zero" for bugreport and test-case.
This problem was introduced in Irrlicht 1.7. The cause was that material renders can change chache-values which were then not reflected in the internal LastMaterial of the OpenGL driver. git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/trunk@5595 dfc29bdd-3216-0410-991c-e03cc46cb475master
parent
12cab21629
commit
803250affc
|
@ -1,5 +1,6 @@
|
|||
--------------------------
|
||||
Changes in 1.9 (not yet released)
|
||||
- Fix bug #440 where OpenGL driver enabled second texture for single-texture materials when setMaterial was called twice. Thx@ "number Zero" for bugreport and test-case.
|
||||
- Irrlicht icon now loaded with LR_DEFAULTSIZE to better support larger icon requests. Thx@ luthyr for report and bugfix.
|
||||
- Cursor on X11 behaves now like on Win32 and doesn't try to clip positions to the window
|
||||
- IImage::copyToWithAlpha has a new parameter to allow combining alpha value instead of replacing them. This uses new blitters called BLITTER_TEXTURE_COMBINE_ALPHA. Thx @chronologicaldot for providing this patch and @burningreggae for his feedback.
|
||||
|
|
|
@ -567,6 +567,21 @@ public:
|
|||
}
|
||||
}
|
||||
|
||||
//! Compare material to current cache and update it when there are differences
|
||||
// Some material renderers do change the cache beyond the original material settings
|
||||
// This correct the material to represent the current cache state again.
|
||||
void correctCacheMaterial(irr::video::SMaterial& material)
|
||||
{
|
||||
// Fix textures which got removed
|
||||
for ( int i=0; i < MATERIAL_MAX_TEXTURES; ++i )
|
||||
{
|
||||
if ( material.TextureLayer[i].Texture && !TextureCache[i] )
|
||||
{
|
||||
material.TextureLayer[i].Texture = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected:
|
||||
TOpenGLDriver* Driver;
|
||||
|
||||
|
|
|
@ -2112,6 +2112,7 @@ void COpenGLDriver::setRenderStates3DMode()
|
|||
Material, LastMaterial, ResetRenderStates, this);
|
||||
|
||||
LastMaterial = Material;
|
||||
CacheHandler->correctCacheMaterial(LastMaterial);
|
||||
ResetRenderStates = false;
|
||||
}
|
||||
|
||||
|
@ -2905,6 +2906,7 @@ void COpenGLDriver::setRenderStates2DMode(bool alpha, bool texture, bool alphaCh
|
|||
setBasicRenderStates(currentMaterial, LastMaterial, resetAllRenderStates);
|
||||
|
||||
LastMaterial = currentMaterial;
|
||||
CacheHandler->correctCacheMaterial(LastMaterial);
|
||||
|
||||
// no alphaChannel without texture
|
||||
alphaChannel &= texture;
|
||||
|
|
Loading…
Reference in New Issue