mirror of
https://github.com/love2d/love.git
synced 2026-08-19 20:19:42 +02:00
Make setMode get the actual width and height after setting, fixes bug with width and height 0 (aka desktop resolution)
This commit is contained in:
@@ -113,7 +113,11 @@ namespace opengl
|
|||||||
// the display mode change.
|
// the display mode change.
|
||||||
Volatile::unloadAll();
|
Volatile::unloadAll();
|
||||||
|
|
||||||
currentWindow->setWindow(width, height, fullscreen, vsync, fsaa);
|
bool success = currentWindow->setWindow(width, height, fullscreen, vsync, fsaa);
|
||||||
|
// Regardless of failure, we'll have to set up OpenGL once again.
|
||||||
|
|
||||||
|
width = currentWindow->getWidth();
|
||||||
|
height = currentWindow->getHeight();
|
||||||
|
|
||||||
// Okay, setup OpenGL.
|
// Okay, setup OpenGL.
|
||||||
|
|
||||||
@@ -132,14 +136,14 @@ namespace opengl
|
|||||||
glEnable(GL_TEXTURE_2D);
|
glEnable(GL_TEXTURE_2D);
|
||||||
|
|
||||||
// Set the viewport to top-left corner
|
// Set the viewport to top-left corner
|
||||||
glViewport(0,0, width, height);
|
glViewport(0, 0, width, height);
|
||||||
|
|
||||||
// Reset the projection matrix
|
// Reset the projection matrix
|
||||||
glMatrixMode(GL_PROJECTION);
|
glMatrixMode(GL_PROJECTION);
|
||||||
glLoadIdentity();
|
glLoadIdentity();
|
||||||
|
|
||||||
// Set up orthographic view (no depth)
|
// Set up orthographic view (no depth)
|
||||||
glOrtho(0.0, width, height,0.0, -1.0, 1.0);
|
glOrtho(0.0, width, height, 0.0, -1.0, 1.0);
|
||||||
|
|
||||||
// Reset modelview matrix
|
// Reset modelview matrix
|
||||||
glMatrixMode(GL_MODELVIEW);
|
glMatrixMode(GL_MODELVIEW);
|
||||||
@@ -160,7 +164,7 @@ namespace opengl
|
|||||||
glGetIntegerv(GL_MAX_MODELVIEW_STACK_DEPTH, &matrixLimit);
|
glGetIntegerv(GL_MAX_MODELVIEW_STACK_DEPTH, &matrixLimit);
|
||||||
matrixLimit -= 5;
|
matrixLimit -= 5;
|
||||||
|
|
||||||
return true;
|
return success;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Graphics::getMode(int &width, int &height, bool &fullscreen, bool &vsync, int &fsaa)
|
void Graphics::getMode(int &width, int &height, bool &fullscreen, bool &vsync, int &fsaa)
|
||||||
|
|||||||
Reference in New Issue
Block a user