Commit 9a14224c authored by hybrid's avatar hybrid

Trying to put the texture activation back into setMaterial. This had been...

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
parent f30d47b6
...@@ -2025,6 +2025,7 @@ void COpenGLDriver::setMaterial(const SMaterial& material) ...@@ -2025,6 +2025,7 @@ void COpenGLDriver::setMaterial(const SMaterial& material)
for (s32 i = MaxTextureUnits-1; i>= 0; --i) for (s32 i = MaxTextureUnits-1; i>= 0; --i)
{ {
setActiveTexture(i, material.getTexture(i));
setTransform ((E_TRANSFORMATION_STATE) (ETS_TEXTURE_0 + i), setTransform ((E_TRANSFORMATION_STATE) (ETS_TEXTURE_0 + i),
Material.getTextureMatrix(i)); Material.getTextureMatrix(i));
} }
......
...@@ -87,7 +87,6 @@ public: ...@@ -87,7 +87,6 @@ public:
bool resetAllRenderstates, IMaterialRendererServices* services) bool resetAllRenderstates, IMaterialRendererServices* services)
{ {
Driver->disableTextures(1); Driver->disableTextures(1);
Driver->setActiveTexture(0, material.getTexture(0));
Driver->setBasicRenderStates(material, lastMaterial, resetAllRenderstates); Driver->setBasicRenderStates(material, lastMaterial, resetAllRenderstates);
if (resetAllRenderstates || (material.MaterialType != lastMaterial.MaterialType)) if (resetAllRenderstates || (material.MaterialType != lastMaterial.MaterialType))
...@@ -112,7 +111,6 @@ public: ...@@ -112,7 +111,6 @@ public:
bool resetAllRenderstates, IMaterialRendererServices* services) bool resetAllRenderstates, IMaterialRendererServices* services)
{ {
Driver->disableTextures(1); Driver->disableTextures(1);
Driver->setActiveTexture(0, material.getTexture(0));
Driver->setBasicRenderStates(material, lastMaterial, resetAllRenderstates); Driver->setBasicRenderStates(material, lastMaterial, resetAllRenderstates);
// if (material.MaterialType != lastMaterial.MaterialType || // if (material.MaterialType != lastMaterial.MaterialType ||
...@@ -215,8 +213,6 @@ public: ...@@ -215,8 +213,6 @@ public:
bool resetAllRenderstates, IMaterialRendererServices* services) bool resetAllRenderstates, IMaterialRendererServices* services)
{ {
Driver->disableTextures(2); Driver->disableTextures(2);
Driver->setActiveTexture(1, material.getTexture(1));
Driver->setActiveTexture(0, material.getTexture(0));
Driver->setBasicRenderStates(material, lastMaterial, resetAllRenderstates); Driver->setBasicRenderStates(material, lastMaterial, resetAllRenderstates);
if (material.MaterialType != lastMaterial.MaterialType || resetAllRenderstates) if (material.MaterialType != lastMaterial.MaterialType || resetAllRenderstates)
...@@ -261,7 +257,6 @@ public: ...@@ -261,7 +257,6 @@ public:
bool resetAllRenderstates, IMaterialRendererServices* services) bool resetAllRenderstates, IMaterialRendererServices* services)
{ {
Driver->disableTextures(1); Driver->disableTextures(1);
Driver->setActiveTexture(0, material.getTexture(0));
Driver->setBasicRenderStates(material, lastMaterial, resetAllRenderstates); Driver->setBasicRenderStates(material, lastMaterial, resetAllRenderstates);
if ((material.MaterialType != lastMaterial.MaterialType) || resetAllRenderstates) if ((material.MaterialType != lastMaterial.MaterialType) || resetAllRenderstates)
...@@ -297,7 +292,6 @@ public: ...@@ -297,7 +292,6 @@ public:
bool resetAllRenderstates, IMaterialRendererServices* services) bool resetAllRenderstates, IMaterialRendererServices* services)
{ {
Driver->disableTextures(1); Driver->disableTextures(1);
Driver->setActiveTexture(0, material.getTexture(0));
Driver->setBasicRenderStates(material, lastMaterial, resetAllRenderstates); Driver->setBasicRenderStates(material, lastMaterial, resetAllRenderstates);
if (material.MaterialType != lastMaterial.MaterialType || resetAllRenderstates) if (material.MaterialType != lastMaterial.MaterialType || resetAllRenderstates)
...@@ -345,7 +339,6 @@ public: ...@@ -345,7 +339,6 @@ public:
bool resetAllRenderstates, IMaterialRendererServices* services) bool resetAllRenderstates, IMaterialRendererServices* services)
{ {
Driver->disableTextures(1); Driver->disableTextures(1);
Driver->setActiveTexture(0, material.getTexture(0));
Driver->setBasicRenderStates(material, lastMaterial, resetAllRenderstates); Driver->setBasicRenderStates(material, lastMaterial, resetAllRenderstates);
if (material.MaterialType != lastMaterial.MaterialType || resetAllRenderstates if (material.MaterialType != lastMaterial.MaterialType || resetAllRenderstates
...@@ -395,7 +388,6 @@ public: ...@@ -395,7 +388,6 @@ public:
bool resetAllRenderstates, IMaterialRendererServices* services) bool resetAllRenderstates, IMaterialRendererServices* services)
{ {
Driver->disableTextures(1); Driver->disableTextures(1);
Driver->setActiveTexture(0, material.getTexture(0));
Driver->setBasicRenderStates(material, lastMaterial, resetAllRenderstates); Driver->setBasicRenderStates(material, lastMaterial, resetAllRenderstates);
if (material.MaterialType != lastMaterial.MaterialType || resetAllRenderstates) if (material.MaterialType != lastMaterial.MaterialType || resetAllRenderstates)
...@@ -431,8 +423,6 @@ public: ...@@ -431,8 +423,6 @@ public:
bool resetAllRenderstates, IMaterialRendererServices* services) bool resetAllRenderstates, IMaterialRendererServices* services)
{ {
Driver->disableTextures(2); Driver->disableTextures(2);
Driver->setActiveTexture(1, material.getTexture(1));
Driver->setActiveTexture(0, material.getTexture(0));
Driver->setBasicRenderStates(material, lastMaterial, resetAllRenderstates); Driver->setBasicRenderStates(material, lastMaterial, resetAllRenderstates);
if (material.MaterialType != lastMaterial.MaterialType || resetAllRenderstates) if (material.MaterialType != lastMaterial.MaterialType || resetAllRenderstates)
...@@ -519,8 +509,6 @@ public: ...@@ -519,8 +509,6 @@ public:
bool resetAllRenderstates, IMaterialRendererServices* services) bool resetAllRenderstates, IMaterialRendererServices* services)
{ {
Driver->disableTextures(2); Driver->disableTextures(2);
Driver->setActiveTexture(1, material.getTexture(1));
Driver->setActiveTexture(0, material.getTexture(0));
Driver->setBasicRenderStates(material, lastMaterial, resetAllRenderstates); Driver->setBasicRenderStates(material, lastMaterial, resetAllRenderstates);
if (material.MaterialType != lastMaterial.MaterialType || resetAllRenderstates) if (material.MaterialType != lastMaterial.MaterialType || resetAllRenderstates)
...@@ -563,7 +551,6 @@ public: ...@@ -563,7 +551,6 @@ public:
bool resetAllRenderstates, IMaterialRendererServices* services) bool resetAllRenderstates, IMaterialRendererServices* services)
{ {
Driver->disableTextures(1); Driver->disableTextures(1);
Driver->setActiveTexture(0, material.getTexture(0));
// texture needs to be flipped for OpenGL // texture needs to be flipped for OpenGL
core::matrix4 tmp = Driver->getTransform(ETS_TEXTURE_0); core::matrix4 tmp = Driver->getTransform(ETS_TEXTURE_0);
tmp[5]*=-1; tmp[5]*=-1;
...@@ -600,8 +587,6 @@ public: ...@@ -600,8 +587,6 @@ public:
bool resetAllRenderstates, IMaterialRendererServices* services) bool resetAllRenderstates, IMaterialRendererServices* services)
{ {
Driver->disableTextures(2); Driver->disableTextures(2);
Driver->setActiveTexture(1, material.getTexture(1));
Driver->setActiveTexture(0, material.getTexture(0));
Driver->setBasicRenderStates(material, lastMaterial, resetAllRenderstates); Driver->setBasicRenderStates(material, lastMaterial, resetAllRenderstates);
if (material.MaterialType != lastMaterial.MaterialType || resetAllRenderstates) if (material.MaterialType != lastMaterial.MaterialType || resetAllRenderstates)
...@@ -650,8 +635,6 @@ public: ...@@ -650,8 +635,6 @@ public:
bool resetAllRenderstates, IMaterialRendererServices* services) bool resetAllRenderstates, IMaterialRendererServices* services)
{ {
Driver->disableTextures(2); Driver->disableTextures(2);
Driver->setActiveTexture(1, material.getTexture(1));
Driver->setActiveTexture(0, material.getTexture(0));
Driver->setBasicRenderStates(material, lastMaterial, resetAllRenderstates); Driver->setBasicRenderStates(material, lastMaterial, resetAllRenderstates);
if (material.MaterialType != lastMaterial.MaterialType || resetAllRenderstates) if (material.MaterialType != lastMaterial.MaterialType || resetAllRenderstates)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment