OpenGL Renderer: Fix bug where certain polygons would occasionally render their textures blank.
(Regression from commit 1368b2d
).
This commit is contained in:
parent
1d8bdd5b54
commit
d2f054b5fb
|
@ -3066,8 +3066,6 @@ Render3DError OpenGLRenderer_1_2::SetupTexture(const POLY &thePoly, size_t polyR
|
||||||
const NDSTextureFormat packFormat = theTexture->GetPackFormat();
|
const NDSTextureFormat packFormat = theTexture->GetPackFormat();
|
||||||
const OGLRenderRef &OGLRef = *this->ref;
|
const OGLRenderRef &OGLRef = *this->ref;
|
||||||
|
|
||||||
glBindTexture(GL_TEXTURE_2D, theTexture->GetID());
|
|
||||||
|
|
||||||
// Check if we need to use textures
|
// Check if we need to use textures
|
||||||
if (!theTexture->IsSamplingEnabled())
|
if (!theTexture->IsSamplingEnabled())
|
||||||
{
|
{
|
||||||
|
@ -3102,6 +3100,7 @@ Render3DError OpenGLRenderer_1_2::SetupTexture(const POLY &thePoly, size_t polyR
|
||||||
glScalef(theTexture->GetInvWidth(), theTexture->GetInvHeight(), 1.0f);
|
glScalef(theTexture->GetInvWidth(), theTexture->GetInvHeight(), 1.0f);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
glBindTexture(GL_TEXTURE_2D, theTexture->GetID());
|
||||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, (texParams.enableRepeatS ? (texParams.enableMirroredRepeatS ? OGLRef.stateTexMirroredRepeat : GL_REPEAT) : GL_CLAMP_TO_EDGE));
|
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, (texParams.enableRepeatS ? (texParams.enableMirroredRepeatS ? OGLRef.stateTexMirroredRepeat : GL_REPEAT) : GL_CLAMP_TO_EDGE));
|
||||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, (texParams.enableRepeatT ? (texParams.enableMirroredRepeatT ? OGLRef.stateTexMirroredRepeat : GL_REPEAT) : GL_CLAMP_TO_EDGE));
|
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, (texParams.enableRepeatT ? (texParams.enableMirroredRepeatT ? OGLRef.stateTexMirroredRepeat : GL_REPEAT) : GL_CLAMP_TO_EDGE));
|
||||||
|
|
||||||
|
@ -4660,7 +4659,6 @@ Render3DError OpenGLRenderer_2_0::SetupTexture(const POLY &thePoly, size_t polyR
|
||||||
const NDSTextureFormat packFormat = theTexture->GetPackFormat();
|
const NDSTextureFormat packFormat = theTexture->GetPackFormat();
|
||||||
const OGLRenderRef &OGLRef = *this->ref;
|
const OGLRenderRef &OGLRef = *this->ref;
|
||||||
|
|
||||||
glBindTexture(GL_TEXTURE_2D, theTexture->GetID());
|
|
||||||
glUniform2f(OGLRef.uniformPolyTexScale, theTexture->GetInvWidth(), theTexture->GetInvHeight());
|
glUniform2f(OGLRef.uniformPolyTexScale, theTexture->GetInvWidth(), theTexture->GetInvHeight());
|
||||||
|
|
||||||
// Check if we need to use textures
|
// Check if we need to use textures
|
||||||
|
@ -4676,6 +4674,7 @@ Render3DError OpenGLRenderer_2_0::SetupTexture(const POLY &thePoly, size_t polyR
|
||||||
glUniform1i(OGLRef.uniformPolyEnableTexture, GL_TRUE);
|
glUniform1i(OGLRef.uniformPolyEnableTexture, GL_TRUE);
|
||||||
glUniform1i(OGLRef.uniformTexSingleBitAlpha, (packFormat != TEXMODE_A3I5 && packFormat != TEXMODE_A5I3) ? GL_TRUE : GL_FALSE);
|
glUniform1i(OGLRef.uniformTexSingleBitAlpha, (packFormat != TEXMODE_A3I5 && packFormat != TEXMODE_A5I3) ? GL_TRUE : GL_FALSE);
|
||||||
|
|
||||||
|
glBindTexture(GL_TEXTURE_2D, theTexture->GetID());
|
||||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, (texParams.enableRepeatS ? (texParams.enableMirroredRepeatS ? GL_MIRRORED_REPEAT : GL_REPEAT) : GL_CLAMP_TO_EDGE));
|
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, (texParams.enableRepeatS ? (texParams.enableMirroredRepeatS ? GL_MIRRORED_REPEAT : GL_REPEAT) : GL_CLAMP_TO_EDGE));
|
||||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, (texParams.enableRepeatT ? (texParams.enableMirroredRepeatT ? GL_MIRRORED_REPEAT : GL_REPEAT) : GL_CLAMP_TO_EDGE));
|
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, (texParams.enableRepeatT ? (texParams.enableMirroredRepeatT ? GL_MIRRORED_REPEAT : GL_REPEAT) : GL_CLAMP_TO_EDGE));
|
||||||
|
|
||||||
|
|
|
@ -1689,8 +1689,6 @@ Render3DError OpenGLRenderer_3_2::SetupTexture(const POLY &thePoly, size_t polyR
|
||||||
{
|
{
|
||||||
OpenGLTexture *theTexture = (OpenGLTexture *)this->_textureList[polyRenderIndex];
|
OpenGLTexture *theTexture = (OpenGLTexture *)this->_textureList[polyRenderIndex];
|
||||||
|
|
||||||
glBindTexture(GL_TEXTURE_2D, theTexture->GetID());
|
|
||||||
|
|
||||||
// Check if we need to use textures
|
// Check if we need to use textures
|
||||||
if (!theTexture->IsSamplingEnabled())
|
if (!theTexture->IsSamplingEnabled())
|
||||||
{
|
{
|
||||||
|
@ -1699,6 +1697,7 @@ Render3DError OpenGLRenderer_3_2::SetupTexture(const POLY &thePoly, size_t polyR
|
||||||
|
|
||||||
PolygonTexParams texParams = thePoly.getTexParams();
|
PolygonTexParams texParams = thePoly.getTexParams();
|
||||||
|
|
||||||
|
glBindTexture(GL_TEXTURE_2D, theTexture->GetID());
|
||||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, (texParams.enableRepeatS ? (texParams.enableMirroredRepeatS ? GL_MIRRORED_REPEAT : GL_REPEAT) : GL_CLAMP_TO_EDGE));
|
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, (texParams.enableRepeatS ? (texParams.enableMirroredRepeatS ? GL_MIRRORED_REPEAT : GL_REPEAT) : GL_CLAMP_TO_EDGE));
|
||||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, (texParams.enableRepeatT ? (texParams.enableMirroredRepeatT ? GL_MIRRORED_REPEAT : GL_REPEAT) : GL_CLAMP_TO_EDGE));
|
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, (texParams.enableRepeatT ? (texParams.enableMirroredRepeatT ? GL_MIRRORED_REPEAT : GL_REPEAT) : GL_CLAMP_TO_EDGE));
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue