OpenGL render targets are now the same way up as in the other drivers. When setting the projection matrix of a render target, the Y axis is flipped and polygon winding is switched to counter-clockwise.
git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/trunk@787 dfc29bdd-3216-0410-991c-e03cc46cb475master
parent
838ea26474
commit
b43e46727a
|
@ -1,5 +1,9 @@
|
|||
Changes in version 1.4 (... 2007)
|
||||
|
||||
- OpenGL render targets now the same way up as the other drivers. If you have
|
||||
written opengl shaders that use render targets then you'll need to change your
|
||||
texture coordinates accordingly.
|
||||
|
||||
- Fixed some OpenGL renderstate stuff. setBasicRenderstate returns with
|
||||
active texture layer 0. The material renderer must return from OnUnset
|
||||
with the same active texture layer. The alpha test is disabled and the
|
||||
|
|
|
@ -34,7 +34,7 @@ COpenGLDriver::COpenGLDriver(const core::dimension2d<s32>& screenSize, HWND wind
|
|||
: CNullDriver(io, screenSize), COpenGLExtensionHandler(),
|
||||
CurrentRenderMode(ERM_NONE), ResetRenderStates(true), Transformation3DChanged(true),
|
||||
AntiAlias(antiAlias), RenderTargetTexture(0), LastSetLight(-1),
|
||||
CurrentRendertargetSize(0,0),
|
||||
CurrentRendertargetSize(0,0), ClockwiseWinding(true),
|
||||
HDc(0), Window(window), HRc(0)
|
||||
{
|
||||
#ifdef _DEBUG
|
||||
|
@ -157,7 +157,7 @@ COpenGLDriver::COpenGLDriver(const core::dimension2d<s32>& screenSize, bool full
|
|||
: CNullDriver(io, screenSize), COpenGLExtensionHandler(),
|
||||
CurrentRenderMode(ERM_NONE), ResetRenderStates(true), Transformation3DChanged(true),
|
||||
AntiAlias(antiAlias),
|
||||
RenderTargetTexture(0), LastSetLight(-1),
|
||||
LastSetLight(-1), RenderTargetTexture(0), ClockwiseWinding(true),
|
||||
CurrentRendertargetSize(0,0), _device(device)
|
||||
{
|
||||
#ifdef _DEBUG
|
||||
|
@ -177,7 +177,7 @@ COpenGLDriver::COpenGLDriver(const core::dimension2d<s32>& screenSize, bool full
|
|||
: CNullDriver(io, screenSize), COpenGLExtensionHandler(),
|
||||
CurrentRenderMode(ERM_NONE), ResetRenderStates(true), Transformation3DChanged(true),
|
||||
AntiAlias(antiAlias),
|
||||
RenderTargetTexture(0), LastSetLight(-1),
|
||||
LastSetLight(-1), RenderTargetTexture(0), ClockwiseWinding(true),
|
||||
CurrentRendertargetSize(0,0)
|
||||
{
|
||||
#ifdef _DEBUG
|
||||
|
@ -213,7 +213,7 @@ COpenGLDriver::COpenGLDriver(const core::dimension2d<s32>& screenSize, bool full
|
|||
: CNullDriver(io, screenSize), COpenGLExtensionHandler(),
|
||||
CurrentRenderMode(ERM_NONE), ResetRenderStates(true), Transformation3DChanged(true),
|
||||
AntiAlias(antiAlias),
|
||||
RenderTargetTexture(0), LastSetLight(-1),
|
||||
LastSetLight(-1), RenderTargetTexture(0), ClockwiseWinding(true),
|
||||
CurrentRendertargetSize(0,0)
|
||||
{
|
||||
#ifdef _DEBUG
|
||||
|
@ -448,6 +448,25 @@ void COpenGLDriver::setTransform(E_TRANSFORMATION_STATE state, const core::matri
|
|||
createGLMatrix(glmat, mat);
|
||||
// flip z to compensate OpenGLs right-hand coordinate system
|
||||
glmat[12] *= -1.0f;
|
||||
// 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);
|
||||
glLoadMatrixf(glmat);
|
||||
break;
|
||||
|
|
|
@ -329,6 +329,9 @@ namespace video
|
|||
s32 LastSetLight;
|
||||
|
||||
core::dimension2d<s32> CurrentRendertargetSize;
|
||||
//! bool to see if we are using clockwise or counter-clockwise winding,
|
||||
//! render targets use opposite winding as their projection matrix is flipped.
|
||||
bool ClockwiseWinding;
|
||||
|
||||
#ifdef _IRR_WINDOWS_API_
|
||||
HDC HDc; // Private GDI Device Context
|
||||
|
|
Loading…
Reference in New Issue