diff --git a/src/gl/data/gl_matrix.cpp b/src/gl/data/gl_matrix.cpp index aa98a3c66a..35683dbb8e 100644 --- a/src/gl/data/gl_matrix.cpp +++ b/src/gl/data/gl_matrix.cpp @@ -40,7 +40,7 @@ VSMatrix::setIdentityMatrix( FLOATTYPE *mat, int size) { -// glLoadIdentity implementation +// gl LoadIdentity implementation void VSMatrix::loadIdentity() { @@ -54,7 +54,7 @@ VSMatrix::loadIdentity() } -// glMultMatrix implementation +// gl MultMatrix implementation void VSMatrix::multMatrix(const FLOATTYPE *aMatrix) { @@ -76,7 +76,7 @@ VSMatrix::multMatrix(const FLOATTYPE *aMatrix) } #ifdef USE_DOUBLE -// glMultMatrix implementation +// gl MultMatrix implementation void VSMatrix::multMatrix(const float *aMatrix) { @@ -100,7 +100,7 @@ VSMatrix::multMatrix(const float *aMatrix) -// glLoadMatrix implementation +// gl LoadMatrix implementation void VSMatrix::loadMatrix(const FLOATTYPE *aMatrix) { @@ -108,7 +108,7 @@ VSMatrix::loadMatrix(const FLOATTYPE *aMatrix) } #ifdef USE_DOUBLE -// glLoadMatrix implementation +// gl LoadMatrix implementation void VSMatrix::loadMatrix(const float *aMatrix) { @@ -265,7 +265,7 @@ VSMatrix::perspective(FLOATTYPE fov, FLOATTYPE ratio, FLOATTYPE nearp, FLOATTYPE } -// glOrtho implementation +// gl Ortho implementation void VSMatrix::ortho(FLOATTYPE left, FLOATTYPE right, FLOATTYPE bottom, FLOATTYPE top, @@ -282,7 +282,7 @@ VSMatrix::ortho(FLOATTYPE left, FLOATTYPE right, } -// glFrustum implementation +// gl Frustum implementation void VSMatrix::frustum(FLOATTYPE left, FLOATTYPE right, FLOATTYPE bottom, FLOATTYPE top, diff --git a/src/gl/renderer/gl_renderstate.cpp b/src/gl/renderer/gl_renderstate.cpp index 807912bcae..bee49cd969 100644 --- a/src/gl/renderer/gl_renderstate.cpp +++ b/src/gl/renderer/gl_renderstate.cpp @@ -74,11 +74,9 @@ void FRenderState::Reset() mDesaturation = 0; mSrcBlend = GL_SRC_ALPHA; mDstBlend = GL_ONE_MINUS_SRC_ALPHA; - glSrcBlend = glDstBlend = -1; mAlphaThreshold = 0.5f; mBlendEquation = GL_FUNC_ADD; mObjectColor = 0xffffffff; - glBlendEquation = -1; m2D = true; mVertexBuffer = mCurrentVertexBuffer = NULL; mColormapState = CM_DEFAULT; @@ -86,6 +84,10 @@ void FRenderState::Reset() mSpecialEffect = EFF_NONE; mClipHeightTop = 65536.f; mClipHeightBottom = -65536.f; + + stSrcBlend = stDstBlend = -1; + stBlendEquation = -1; + stAlphaThreshold = -1.f; } //========================================================================== @@ -140,9 +142,9 @@ bool FRenderState::ApplyShader() #ifndef CORE_PROFILE if (!(gl.flags & RFL_COREPROFILE)) { - if (mAlphaThreshold != glAlphaThreshold) + if (mAlphaThreshold != stAlphaThreshold) { - glAlphaThreshold = mAlphaThreshold; + stAlphaThreshold = mAlphaThreshold; if (mAlphaThreshold < 0.f) { glDisable(GL_ALPHA_TEST); @@ -150,7 +152,7 @@ bool FRenderState::ApplyShader() else { glEnable(GL_ALPHA_TEST); - glAlphaFunc(GL_GREATER, mAlphaThreshold); + glAlphaFunc(GL_GREATER, mAlphaThreshold * mColor.vec[3]); } } } @@ -271,16 +273,16 @@ void FRenderState::Apply() { if (!gl_direct_state_change) { - if (mSrcBlend != glSrcBlend || mDstBlend != glDstBlend) + if (mSrcBlend != stSrcBlend || mDstBlend != stDstBlend) { - glSrcBlend = mSrcBlend; - glDstBlend = mDstBlend; + stSrcBlend = mSrcBlend; + stDstBlend = mDstBlend; glBlendFunc(mSrcBlend, mDstBlend); } - if (mBlendEquation != glBlendEquation) + if (mBlendEquation != stBlendEquation) { - glBlendEquation = mBlendEquation; - ::glBlendEquation(mBlendEquation); + stBlendEquation = mBlendEquation; + glBlendEquation(mBlendEquation); } } diff --git a/src/gl/renderer/gl_renderstate.h b/src/gl/renderer/gl_renderstate.h index 63fdab4ea5..562cfb0efc 100644 --- a/src/gl/renderer/gl_renderstate.h +++ b/src/gl/renderer/gl_renderstate.h @@ -75,12 +75,10 @@ class FRenderState int mEffectState; int mColormapState; - float glAlphaThreshold; - bool glClipOn; - - int glSrcBlend, glDstBlend; - bool glAlphaTest; - int glBlendEquation; + float stAlphaThreshold; + int stSrcBlend, stDstBlend; + bool stAlphaTest; + int stBlendEquation; bool ApplyShader(); @@ -299,7 +297,7 @@ public: } else { - ::glBlendEquation(eq); + glBlendEquation(eq); } }