Commit e29ebb3c authored by bitplane's avatar bitplane

missed conditions for flipping projection when drawing 2d images in opengl render targets

git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/trunk@792 dfc29bdd-3216-0410-991c-e03cc46cb475
parent 3ffd6b73
......@@ -449,7 +449,7 @@ void COpenGLDriver::setTransform(E_TRANSFORMATION_STATE state, const core::matri
// flip z to compensate OpenGLs right-hand coordinate system
glmat[12] *= -1.0f;
// in render targets, flip the screen
if ( CurrentRendertargetSize.Width > 0 )
if ( CurrentRendertargetSize.Width != 0 )
{
glmat[5] *= -1.0f;
// because we flipped the screen, triangles are the wrong way around
......@@ -1533,8 +1533,31 @@ void COpenGLDriver::setRenderStates2DMode(bool alpha, bool texture, bool alphaCh
Material.MaterialType < (s32)MaterialRenderers.size())
MaterialRenderers[Material.MaterialType].Renderer->OnUnsetMaterial();
GLfloat glmat[16];
core::matrix4 m;
createGLMatrix(glmat, m);
// in render targets, flip the screen
if ( CurrentRendertargetSize.Width != 0 )
{
glmat[5] *= -1.0f;
// because we flipped the screen, triangles are the wrong way around
if (ClockwiseWinding)
{
glFrontFace(GL_CCW);
ClockwiseWinding = false;
}
}
else
{
if (!ClockwiseWinding)
{
glFrontFace(GL_CW);
ClockwiseWinding = true;
}
}
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
glLoadMatrixf(glmat);
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
......@@ -1554,6 +1577,7 @@ void COpenGLDriver::setRenderStates2DMode(bool alpha, bool texture, bool alphaCh
glDisable(GL_ALPHA_TEST);
glCullFace(GL_BACK);
}
if (texture)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment