OPENGL: Fix SDL OpenGL context not resizing well on Linux.

svn-id: r51047
This commit is contained in:
Alejandro Marzini 2010-07-20 00:21:17 +00:00
parent f6e04fe03b
commit 014d7b791c
2 changed files with 15 additions and 6 deletions

View File

@ -30,7 +30,8 @@
OpenGLSdlGraphicsManager::OpenGLSdlGraphicsManager()
:
_hwscreen(0) {
_hwscreen(0),
_screenResized(false) {
if (SDL_InitSubSystem(SDL_INIT_VIDEO) == -1) {
error("Could not initialize SDL: %s", SDL_GetError());
@ -125,8 +126,11 @@ void OpenGLSdlGraphicsManager::warpMouse(int x, int y) {
bool OpenGLSdlGraphicsManager::loadGFXMode() {
_videoMode.overlayWidth = _videoMode.screenWidth * _videoMode.scaleFactor;
_videoMode.overlayHeight = _videoMode.screenHeight * _videoMode.scaleFactor;
_videoMode.hardwareWidth = _videoMode.screenWidth * _videoMode.scaleFactor;
_videoMode.hardwareHeight = _videoMode.screenHeight * _videoMode.scaleFactor;
if (!_screenResized) {
_videoMode.hardwareWidth = _videoMode.screenWidth * _videoMode.scaleFactor;
_videoMode.hardwareHeight = _videoMode.screenHeight * _videoMode.scaleFactor;
}
_screenResized = false;
// Setup OpenGL attributes for SDL
SDL_GL_SetAttribute(SDL_GL_RED_SIZE, 8);
@ -279,9 +283,12 @@ bool OpenGLSdlGraphicsManager::notifyEvent(const Common::Event &event) {
break;*/
// HACK: Handle special SDL event
case OSystem_SDL::kSdlEventResize:
_videoMode.hardwareWidth = event.mouse.x;
_videoMode.hardwareHeight = event.mouse.y;
initGL();
beginGFXTransaction();
_videoMode.hardwareWidth = event.mouse.x;
_videoMode.hardwareHeight = event.mouse.y;
_screenResized = true;
_transactionDetails.sizeChanged = true;
endGFXTransaction();
return true;
default:

View File

@ -65,6 +65,8 @@ protected:
// Hardware screen
SDL_Surface *_hwscreen;
bool _screenResized;
};
#endif