forked from 0ad/0ad
Always select a texture unit before calling glEnable(GL_TEXTURE_2D).
Without this, some code will enable (and set other parameters for) whatever random texture unit the previous stage had selected. This can break any fixed-function rendering, since either it will not have enabled the correct texture unit, or its correct setup will be interfered with by another texture unit that shouldn't be enabled. (This doesn't affect ARB/GLSL shader rendering, since they don't care about the enabled state, but the GUI (and some debug things) are still FFP in the default ARB mode.) Fixes #2833 (in which the fancy water shader selected texture units 5/6, which then got enabled, and remained enabled forever). This was SVN commit r16372.
This commit is contained in:
parent
4860957fa6
commit
21f3be7df5
@ -510,6 +510,7 @@ public:
|
||||
// Setup texture environment
|
||||
if (m_Defines.GetInt("MINIMAP_BASE"))
|
||||
{
|
||||
pglActiveTextureARB(GL_TEXTURE0);
|
||||
glEnable(GL_TEXTURE_2D);
|
||||
glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE);
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
|
||||
@ -517,6 +518,7 @@ public:
|
||||
}
|
||||
else if (m_Defines.GetInt("MINIMAP_LOS"))
|
||||
{
|
||||
pglActiveTextureARB(GL_TEXTURE0);
|
||||
glEnable(GL_TEXTURE_2D);
|
||||
glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_COMBINE);
|
||||
glTexEnvi(GL_TEXTURE_ENV, GL_COMBINE_RGB_ARB, GL_REPLACE);
|
||||
@ -529,6 +531,7 @@ public:
|
||||
}
|
||||
else if (m_Defines.GetInt("MINIMAP_POINT"))
|
||||
{
|
||||
pglActiveTextureARB(GL_TEXTURE0);
|
||||
glDisable(GL_TEXTURE_2D);
|
||||
glEnableClientState(GL_VERTEX_ARRAY);
|
||||
glEnableClientState(GL_COLOR_ARRAY);
|
||||
@ -545,6 +548,7 @@ public:
|
||||
// Reset texture environment
|
||||
if (m_Defines.GetInt("MINIMAP_POINT"))
|
||||
{
|
||||
pglActiveTextureARB(GL_TEXTURE0);
|
||||
glEnable(GL_TEXTURE_2D);
|
||||
glDisableClientState(GL_VERTEX_ARRAY);
|
||||
glDisableClientState(GL_COLOR_ARRAY);
|
||||
|
@ -413,6 +413,7 @@ void OverlayRenderer::RenderTexturedOverlayLines()
|
||||
|
||||
ogl_WarnIfError();
|
||||
|
||||
pglActiveTextureARB(GL_TEXTURE0);
|
||||
glEnable(GL_TEXTURE_2D);
|
||||
glEnable(GL_BLEND);
|
||||
glDepthMask(0);
|
||||
@ -496,6 +497,7 @@ void OverlayRenderer::RenderQuadOverlays()
|
||||
|
||||
ogl_WarnIfError();
|
||||
|
||||
pglActiveTextureARB(GL_TEXTURE0);
|
||||
glEnable(GL_TEXTURE_2D);
|
||||
glEnable(GL_BLEND);
|
||||
glDepthMask(0);
|
||||
@ -582,6 +584,7 @@ void OverlayRenderer::RenderForegroundOverlays(const CCamera& viewCamera)
|
||||
#if CONFIG2_GLES
|
||||
#warning TODO: implement OverlayRenderer::RenderForegroundOverlays for GLES
|
||||
#else
|
||||
pglActiveTextureARB(GL_TEXTURE0);
|
||||
glEnable(GL_TEXTURE_2D);
|
||||
glEnable(GL_BLEND);
|
||||
glDisable(GL_DEPTH_TEST);
|
||||
|
@ -389,6 +389,7 @@ void TerrainRenderer::RenderTerrainOverlayTexture(int cullGroup, CMatrix3D& text
|
||||
glEnableClientState(GL_VERTEX_ARRAY);
|
||||
glEnableClientState(GL_TEXTURE_COORD_ARRAY);
|
||||
|
||||
pglActiveTextureARB(GL_TEXTURE0);
|
||||
glEnable(GL_TEXTURE_2D);
|
||||
glEnable(GL_BLEND);
|
||||
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
||||
|
Loading…
Reference in New Issue
Block a user