From 9a14224c6f16e765d24203d4cd31fddfa1d7e12a Mon Sep 17 00:00:00 2001 From: hybrid Date: Fri, 20 Nov 2009 14:20:07 +0000 Subject: [PATCH] Trying to put the texture activation back into setMaterial. This had been changed in early versions of Irrlicht for render state problems. I hope we got them all fixed and can this way make external materials possible again. (problems are all OpenGL only) git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/trunk@2900 dfc29bdd-3216-0410-991c-e03cc46cb475 --- source/Irrlicht/COpenGLDriver.cpp | 1 + source/Irrlicht/COpenGLMaterialRenderer.h | 17 ----------------- 2 files changed, 1 insertion(+), 17 deletions(-) diff --git a/source/Irrlicht/COpenGLDriver.cpp b/source/Irrlicht/COpenGLDriver.cpp index 89c87ae2..dd0908e1 100644 --- a/source/Irrlicht/COpenGLDriver.cpp +++ b/source/Irrlicht/COpenGLDriver.cpp @@ -2025,6 +2025,7 @@ void COpenGLDriver::setMaterial(const SMaterial& material) for (s32 i = MaxTextureUnits-1; i>= 0; --i) { + setActiveTexture(i, material.getTexture(i)); setTransform ((E_TRANSFORMATION_STATE) (ETS_TEXTURE_0 + i), Material.getTextureMatrix(i)); } diff --git a/source/Irrlicht/COpenGLMaterialRenderer.h b/source/Irrlicht/COpenGLMaterialRenderer.h index 59db13aa..5d54d9e6 100644 --- a/source/Irrlicht/COpenGLMaterialRenderer.h +++ b/source/Irrlicht/COpenGLMaterialRenderer.h @@ -87,7 +87,6 @@ public: bool resetAllRenderstates, IMaterialRendererServices* services) { Driver->disableTextures(1); - Driver->setActiveTexture(0, material.getTexture(0)); Driver->setBasicRenderStates(material, lastMaterial, resetAllRenderstates); if (resetAllRenderstates || (material.MaterialType != lastMaterial.MaterialType)) @@ -112,7 +111,6 @@ public: bool resetAllRenderstates, IMaterialRendererServices* services) { Driver->disableTextures(1); - Driver->setActiveTexture(0, material.getTexture(0)); Driver->setBasicRenderStates(material, lastMaterial, resetAllRenderstates); // if (material.MaterialType != lastMaterial.MaterialType || @@ -215,8 +213,6 @@ public: bool resetAllRenderstates, IMaterialRendererServices* services) { Driver->disableTextures(2); - Driver->setActiveTexture(1, material.getTexture(1)); - Driver->setActiveTexture(0, material.getTexture(0)); Driver->setBasicRenderStates(material, lastMaterial, resetAllRenderstates); if (material.MaterialType != lastMaterial.MaterialType || resetAllRenderstates) @@ -261,7 +257,6 @@ public: bool resetAllRenderstates, IMaterialRendererServices* services) { Driver->disableTextures(1); - Driver->setActiveTexture(0, material.getTexture(0)); Driver->setBasicRenderStates(material, lastMaterial, resetAllRenderstates); if ((material.MaterialType != lastMaterial.MaterialType) || resetAllRenderstates) @@ -297,7 +292,6 @@ public: bool resetAllRenderstates, IMaterialRendererServices* services) { Driver->disableTextures(1); - Driver->setActiveTexture(0, material.getTexture(0)); Driver->setBasicRenderStates(material, lastMaterial, resetAllRenderstates); if (material.MaterialType != lastMaterial.MaterialType || resetAllRenderstates) @@ -345,7 +339,6 @@ public: bool resetAllRenderstates, IMaterialRendererServices* services) { Driver->disableTextures(1); - Driver->setActiveTexture(0, material.getTexture(0)); Driver->setBasicRenderStates(material, lastMaterial, resetAllRenderstates); if (material.MaterialType != lastMaterial.MaterialType || resetAllRenderstates @@ -395,7 +388,6 @@ public: bool resetAllRenderstates, IMaterialRendererServices* services) { Driver->disableTextures(1); - Driver->setActiveTexture(0, material.getTexture(0)); Driver->setBasicRenderStates(material, lastMaterial, resetAllRenderstates); if (material.MaterialType != lastMaterial.MaterialType || resetAllRenderstates) @@ -431,8 +423,6 @@ public: bool resetAllRenderstates, IMaterialRendererServices* services) { Driver->disableTextures(2); - Driver->setActiveTexture(1, material.getTexture(1)); - Driver->setActiveTexture(0, material.getTexture(0)); Driver->setBasicRenderStates(material, lastMaterial, resetAllRenderstates); if (material.MaterialType != lastMaterial.MaterialType || resetAllRenderstates) @@ -519,8 +509,6 @@ public: bool resetAllRenderstates, IMaterialRendererServices* services) { Driver->disableTextures(2); - Driver->setActiveTexture(1, material.getTexture(1)); - Driver->setActiveTexture(0, material.getTexture(0)); Driver->setBasicRenderStates(material, lastMaterial, resetAllRenderstates); if (material.MaterialType != lastMaterial.MaterialType || resetAllRenderstates) @@ -563,7 +551,6 @@ public: bool resetAllRenderstates, IMaterialRendererServices* services) { Driver->disableTextures(1); - Driver->setActiveTexture(0, material.getTexture(0)); // texture needs to be flipped for OpenGL core::matrix4 tmp = Driver->getTransform(ETS_TEXTURE_0); tmp[5]*=-1; @@ -600,8 +587,6 @@ public: bool resetAllRenderstates, IMaterialRendererServices* services) { Driver->disableTextures(2); - Driver->setActiveTexture(1, material.getTexture(1)); - Driver->setActiveTexture(0, material.getTexture(0)); Driver->setBasicRenderStates(material, lastMaterial, resetAllRenderstates); if (material.MaterialType != lastMaterial.MaterialType || resetAllRenderstates) @@ -650,8 +635,6 @@ public: bool resetAllRenderstates, IMaterialRendererServices* services) { Driver->disableTextures(2); - Driver->setActiveTexture(1, material.getTexture(1)); - Driver->setActiveTexture(0, material.getTexture(0)); Driver->setBasicRenderStates(material, lastMaterial, resetAllRenderstates); if (material.MaterialType != lastMaterial.MaterialType || resetAllRenderstates)