GLFB: fix X window at 16:9 aspect ratio

Origin commit data
------------------
Branch: master
Commit: 631c48e65b
Author: Stefan Seyfried <seife@tuxbox-git.slipkontur.de>
Date: 2013-05-04 (Sat, 04 May 2013)


------------------
No further description and justification available within origin commit message!

------------------
This commit was generated by Migit
This commit is contained in:
Stefan Seyfried
2013-05-04 17:25:31 +02:00
parent 05951af416
commit 8e329f1e26

View File

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