missed conditions for flipping projection when drawing 2d images in opengl render targets
git-svn-id: http://svn.code.sf.net/p/irrlicht/code/trunk@792 dfc29bdd-3216-0410-991c-e03cc46cb475
This commit is contained in:
parent
e27415f6da
commit
986ef627f7
@ -449,7 +449,7 @@ void COpenGLDriver::setTransform(E_TRANSFORMATION_STATE state, const core::matri
|
|||||||
// flip z to compensate OpenGLs right-hand coordinate system
|
// flip z to compensate OpenGLs right-hand coordinate system
|
||||||
glmat[12] *= -1.0f;
|
glmat[12] *= -1.0f;
|
||||||
// in render targets, flip the screen
|
// in render targets, flip the screen
|
||||||
if ( CurrentRendertargetSize.Width > 0 )
|
if ( CurrentRendertargetSize.Width != 0 )
|
||||||
{
|
{
|
||||||
glmat[5] *= -1.0f;
|
glmat[5] *= -1.0f;
|
||||||
// because we flipped the screen, triangles are the wrong way around
|
// 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())
|
Material.MaterialType < (s32)MaterialRenderers.size())
|
||||||
MaterialRenderers[Material.MaterialType].Renderer->OnUnsetMaterial();
|
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);
|
glMatrixMode(GL_PROJECTION);
|
||||||
glLoadIdentity();
|
glLoadMatrixf(glmat);
|
||||||
|
|
||||||
glMatrixMode(GL_MODELVIEW);
|
glMatrixMode(GL_MODELVIEW);
|
||||||
glLoadIdentity();
|
glLoadIdentity();
|
||||||
@ -1554,6 +1577,7 @@ void COpenGLDriver::setRenderStates2DMode(bool alpha, bool texture, bool alphaCh
|
|||||||
|
|
||||||
glDisable(GL_ALPHA_TEST);
|
glDisable(GL_ALPHA_TEST);
|
||||||
glCullFace(GL_BACK);
|
glCullFace(GL_BACK);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (texture)
|
if (texture)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user