GLFB: fix X window at 16:9 aspect ratio

This commit is contained in:
Stefan Seyfried
2013-05-04 17:25:31 +02:00
parent 9c1419c25b
commit 631c48e65b

View File

@@ -291,10 +291,11 @@ void GLFramebuffer::render()
{
mReInit = false;
glViewport(0, 0, mX, mY);
glutReshapeWindow(mX, mY);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
float aspect = static_cast<float>(mX)/mY;
float osdaspect = 1.0/aspect; //(static_cast<float>(mState.width)/mState.height);
float osdaspect = 1.0/(static_cast<float>(16.0)/9);
// if(!mState.go3d)
{
glOrtho(aspect*-osdaspect, aspect*osdaspect, -1.0, 1.0, -1.0, 1.0 );
@@ -370,6 +371,11 @@ void GLFramebuffer::checkReinit()
{
mX = x;
mY = y;
/* fix aspect ratio */
if (x < mY * 16 / 9)
mX = mY * 16 / 9;
else
mY = mX * 9 / 16;
mReInit = true;
}
}