[Scummvm-git-logs] scummvm master -> 91146900caa849a5ea77fbe37cd406505a5eb1fb
aquadran
aquadran at gmail.com
Sun Nov 7 15:30:31 UTC 2021
This automated email contains information about 1 new commit which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .
Summary:
91146900ca STARK: Explicit enable/disable texture mode when needed
Commit: 91146900caa849a5ea77fbe37cd406505a5eb1fb
https://github.com/scummvm/scummvm/commit/91146900caa849a5ea77fbe37cd406505a5eb1fb
Author: PaweÅ KoÅodziejski (aquadran at gmail.com)
Date: 2021-11-07T16:30:24+01:00
Commit Message:
STARK: Explicit enable/disable texture mode when needed
Changed paths:
engines/stark/gfx/openglactor.cpp
engines/stark/gfx/openglprop.cpp
engines/stark/gfx/tinyglactor.cpp
engines/stark/gfx/tinyglprop.cpp
diff --git a/engines/stark/gfx/openglactor.cpp b/engines/stark/gfx/openglactor.cpp
index 8116ad4d2e..3c50891c66 100644
--- a/engines/stark/gfx/openglactor.cpp
+++ b/engines/stark/gfx/openglactor.cpp
@@ -101,8 +101,6 @@ void OpenGLActorRenderer::render(const Math::Vector3d &position, float direction
lightDirection = getShadowLightDirection(lights, position, modelInverse.getRotation());
}
- glEnable(GL_TEXTURE_2D);
-
Common::Array<Face *> faces = _model->getFaces();
Common::Array<Material *> mats = _model->getMaterials();
const Common::Array<BoneNode *> &bones = _model->getBones();
@@ -121,12 +119,14 @@ void OpenGLActorRenderer::render(const Math::Vector3d &position, float direction
for (uint32 i = 0; i < numVertexIndices; i++) {
if (tex) {
tex->bind();
+ glEnable(GL_TEXTURE_2D);
if (_gfx->computeLightsEnabled())
color = Math::Vector3d(1.0f, 1.0f, 1.0f);
else
glColor3f(1.0f, 1.0f, 1.0f);
} else {
glBindTexture(GL_TEXTURE_2D, 0);
+ glDisable(GL_TEXTURE_2D);
if (_gfx->computeLightsEnabled())
color = Math::Vector3d(material->r, material->g, material->b);
else
@@ -310,7 +310,6 @@ void OpenGLActorRenderer::render(const Math::Vector3d &position, float direction
if (!_gfx->computeLightsEnabled())
glEnable(GL_LIGHTING);
- glEnable(GL_TEXTURE_2D);
glDisable(GL_BLEND);
glDisable(GL_STENCIL_TEST);
}
diff --git a/engines/stark/gfx/openglprop.cpp b/engines/stark/gfx/openglprop.cpp
index ba9539f2f7..11173a953e 100644
--- a/engines/stark/gfx/openglprop.cpp
+++ b/engines/stark/gfx/openglprop.cpp
@@ -99,6 +99,7 @@ void OpenGLPropRenderer::render(const Math::Vector3d &position, float direction,
auto vertex = _faceVBO[index];
if (tex) {
tex->bind();
+ glEnable(GL_TEXTURE_2D);
if (_gfx->computeLightsEnabled())
color = Math::Vector3d(1.0f, 1.0f, 1.0f);
else
@@ -112,6 +113,7 @@ void OpenGLPropRenderer::render(const Math::Vector3d &position, float direction,
}
} else {
glBindTexture(GL_TEXTURE_2D, 0);
+ glDisable(GL_TEXTURE_2D);
if (_gfx->computeLightsEnabled())
color = Math::Vector3d(material.r, material.g, material.b);
else
diff --git a/engines/stark/gfx/tinyglactor.cpp b/engines/stark/gfx/tinyglactor.cpp
index 008ded91d9..529c504bcc 100644
--- a/engines/stark/gfx/tinyglactor.cpp
+++ b/engines/stark/gfx/tinyglactor.cpp
@@ -96,8 +96,6 @@ void TinyGLActorRenderer::render(const Math::Vector3d &position, float direction
lightDirection = getShadowLightDirection(lights, position, modelInverse.getRotation());
}
- tglEnable(TGL_TEXTURE_2D);
-
Common::Array<Face *> faces = _model->getFaces();
Common::Array<Material *> mats = _model->getMaterials();
const Common::Array<BoneNode *> &bones = _model->getBones();
@@ -111,9 +109,11 @@ void TinyGLActorRenderer::render(const Math::Vector3d &position, float direction
for (uint32 i = 0; i < numVertexIndices; i++) {
if (tex) {
tex->bind();
+ tglEnable(TGL_TEXTURE_2D);
color = Math::Vector3d(1.0f, 1.0f, 1.0f);
} else {
tglBindTexture(TGL_TEXTURE_2D, 0);
+ tglDisable(TGL_TEXTURE_2D);
color = Math::Vector3d(material->r, material->g, material->b);
}
uint32 index = vertexIndices[i];
diff --git a/engines/stark/gfx/tinyglprop.cpp b/engines/stark/gfx/tinyglprop.cpp
index 757547da7d..06d4521b22 100644
--- a/engines/stark/gfx/tinyglprop.cpp
+++ b/engines/stark/gfx/tinyglprop.cpp
@@ -85,6 +85,7 @@ void TinyGLPropRenderer::render(const Math::Vector3d &position, float direction,
auto vertex = _faceVBO[index];
if (tex) {
tex->bind();
+ tglEnable(TGL_TEXTURE_2D);
color = Math::Vector3d(1.0f, 1.0f, 1.0f);
if (material.doubleSided) {
vertex.texS = vertex.stexS;
@@ -95,6 +96,7 @@ void TinyGLPropRenderer::render(const Math::Vector3d &position, float direction,
}
} else {
tglBindTexture(TGL_TEXTURE_2D, 0);
+ tglDisable(TGL_TEXTURE_2D);
color = Math::Vector3d(material.r, material.g, material.b);
}
More information about the Scummvm-git-logs
mailing list