diff --git a/stepmania/src/RageDisplay.cpp b/stepmania/src/RageDisplay.cpp index c194efb84f..b2b2dc7b44 100644 --- a/stepmania/src/RageDisplay.cpp +++ b/stepmania/src/RageDisplay.cpp @@ -604,6 +604,19 @@ RageDisplay::PixelFormat RageDisplay::FindPixelFormat( return NUM_PIX_FORMATS; } +/* These convert to OpenGL's coordinate system: -1,-1 is the bottom-left, +1,+1 is the + * top-right, and Z goes from -1 (viewer) to +1 (distance). It's a little odd, but + * very well-defined. */ +RageMatrix RageDisplay::GetOrthoMatrix( float l, float r, float b, float t, float zn, float zf ) +{ + RageMatrix m( + 2/(r-l), 0, 0, 0, + 0, 2/(t-b), 0, 0, + 0, 0, -2/(zf-zn), 0, + -(r+l)/(r-l), -(t+b)/(t-b), -(zf+zn)/(zf-zn), 1 ); + return m; +} + RageMatrix RageDisplay::GetFrustumMatrix( float l, float r, float b, float t, float zn, float zf ) { // glFrustrum diff --git a/stepmania/src/RageDisplay.h b/stepmania/src/RageDisplay.h index 695cb8c893..8186c9680c 100644 --- a/stepmania/src/RageDisplay.h +++ b/stepmania/src/RageDisplay.h @@ -314,7 +314,7 @@ protected: RageMatrix GetPerspectiveMatrix(float fovy, float aspect, float zNear, float zFar); // Different for D3D and OpenGL. Not sure why they're not compatible. -Chris - virtual RageMatrix GetOrthoMatrix( float l, float r, float b, float t, float zn, float zf ) = 0; + virtual RageMatrix GetOrthoMatrix( float l, float r, float b, float t, float zn, float zf ); virtual RageMatrix GetFrustumMatrix( float l, float r, float b, float t, float zn, float zf ); // diff --git a/stepmania/src/RageDisplay_OGL.cpp b/stepmania/src/RageDisplay_OGL.cpp index b5912f666d..b2f98f3bff 100644 --- a/stepmania/src/RageDisplay_OGL.cpp +++ b/stepmania/src/RageDisplay_OGL.cpp @@ -1820,16 +1820,6 @@ void RageDisplay_OGL::SetAlphaTest( bool b ) glDisable( GL_ALPHA_TEST ); } -RageMatrix RageDisplay_OGL::GetOrthoMatrix( float l, float r, float b, float t, float zn, float zf ) -{ - RageMatrix m( - 2/(r-l), 0, 0, 0, - 0, 2/(t-b), 0, 0, - 0, 0, -2/(zf-zn), 0, - -(r+l)/(r-l), -(t+b)/(t-b), -(zf+zn)/(zf-zn), 1 ); - return m; -} - /* * Although we pair texture formats (eg. GL_RGB8) and surface formats diff --git a/stepmania/src/RageDisplay_OGL.h b/stepmania/src/RageDisplay_OGL.h index 174fbecf88..ab6bb0acf1 100644 --- a/stepmania/src/RageDisplay_OGL.h +++ b/stepmania/src/RageDisplay_OGL.h @@ -83,7 +83,6 @@ protected: CString TryVideoMode( VideoModeParams params, bool &bNewDeviceOut ); RageSurface* CreateScreenshot(); void SetViewport(int shift_left, int shift_down); - RageMatrix GetOrthoMatrix( float l, float r, float b, float t, float zn, float zf ); PixelFormat GetImgPixelFormat( RageSurface* &img, bool &FreeImg, int width, int height, bool bPalettedTexture ); bool SupportsSurfaceFormat( PixelFormat pixfmt );