Corrects OpenGL projection matrix

Corrects OpenGL glPolygonOffset values
Corrects Direct3D11 DepthBias values
This commit is contained in:
rextimmy 2017-08-25 13:13:47 +10:00
parent ad612e218b
commit 54970b0ad6
3 changed files with 43 additions and 39 deletions

View file

@ -139,16 +139,19 @@ void GFXGLStateBlock::activate(const GFXGLStateBlock* oldState)
if(STATE_CHANGE(zFunc))
glDepthFunc(GFXGLCmpFunc[mDesc.zFunc]);
if(STATE_CHANGE(zBias))
if (STATE_CHANGE(zBias))
{
if (mDesc.zBias == 0)
{
glDisable(GL_POLYGON_OFFSET_FILL);
} else {
F32 bias = mDesc.zBias * 10000.0f;
}
else
{
//this assumes 24bit depth
const F32 depthMul = F32((1 << 24) - 1);
glEnable(GL_POLYGON_OFFSET_FILL);
glPolygonOffset(bias, bias);
}
glPolygonOffset(mDesc.zSlopeBias, mDesc.zBias * depthMul);
}
}
if(STATE_CHANGE(zWriteEnable))