From a8a268926911c0bec788e2b72f812a4031ae3c22 Mon Sep 17 00:00:00 2001 From: stephena Date: Thu, 18 Dec 2008 23:36:32 +0000 Subject: [PATCH] I think I've found the issue with OpenGL weirdness in OSX. Now I need to make sure it doesn't break on other systems. git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@1566 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba --- stella/src/common/FrameBufferGL.cxx | 16 ++++++++-------- stella/src/gui/Dialog.cxx | 23 ++++------------------- 2 files changed, 12 insertions(+), 27 deletions(-) diff --git a/stella/src/common/FrameBufferGL.cxx b/stella/src/common/FrameBufferGL.cxx index 969b6e8b9..bddf54b6f 100644 --- a/stella/src/common/FrameBufferGL.cxx +++ b/stella/src/common/FrameBufferGL.cxx @@ -13,7 +13,7 @@ // See the file "license" for information on usage and redistribution of // this file, and for a DISCLAIMER OF ALL WARRANTIES. // -// $Id: FrameBufferGL.cxx,v 1.118 2008-12-15 17:53:01 stephena Exp $ +// $Id: FrameBufferGL.cxx,v 1.119 2008-12-18 23:36:32 stephena Exp $ //============================================================================ #ifdef DISPLAY_OPENGL @@ -361,10 +361,6 @@ cerr << "dimensions: " << endl << " imageh = " << mode.image_h << endl << endl; - // Any previously allocated textures currently in use by various UI items - // need to be refreshed as well (only seems to be required for OSX) - reloadSurfaces(); - // The framebuffer only takes responsibility for TIA surfaces // Other surfaces (such as the ones used for dialogs) are allocated // in the Dialog class @@ -375,6 +371,10 @@ cerr << "dimensions: " << endl mode.image_w, mode.image_h); } + // Any previously allocated textures currently in use by various UI items + // need to be refreshed as well (only seems to be required for OSX) + reloadSurfaces(); + // Make sure any old parts of the screen are erased p_glClear(GL_COLOR_BUFFER_BIT); SDL_GL_SwapBuffers(); @@ -598,7 +598,7 @@ cerr << " FBSurfaceGL::FBSurfaceGL: w = " << baseWidth << ", h = " << baseHeigh // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - FBSurfaceGL::~FBSurfaceGL() { -cerr << " FBSurfaceGL::~FBSurfaceGL(): " << this << endl; +cerr << " FBSurfaceGL::~FBSurfaceGL(): myTexID = " << myTexID << " @ " << this << endl; if(myTexture) SDL_FreeSurface(myTexture); @@ -814,7 +814,7 @@ void FBSurfaceGL::reload() } */ - p_glDeleteTextures(1, &myTexID); +// p_glDeleteTextures(1, &myTexID); p_glGenTextures(1, &myTexID); p_glBindTexture(myTexTarget, myTexID); p_glTexParameteri(myTexTarget, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); @@ -831,7 +831,7 @@ void FBSurfaceGL::reload() p_glEnable(myTexTarget); -cerr << " ==> FBSurfaceGL::reload(): myTexID = " << myTexID << endl; +cerr << " ==> FBSurfaceGL::reload(): myTexID = " << myTexID << " @ " << this << endl; } #if 0 diff --git a/stella/src/gui/Dialog.cxx b/stella/src/gui/Dialog.cxx index d788a35eb..5017cfd77 100644 --- a/stella/src/gui/Dialog.cxx +++ b/stella/src/gui/Dialog.cxx @@ -13,7 +13,7 @@ // See the file "license" for information on usage and redistribution of // this file, and for a DISCLAIMER OF ALL WARRANTIES. // -// $Id: Dialog.cxx,v 1.67 2008-12-14 21:44:06 stephena Exp $ +// $Id: Dialog.cxx,v 1.68 2008-12-18 23:36:32 stephena Exp $ // // Based on code from ScummVM - Scumm Interpreter // Copyright (C) 2002-2004 The ScummVM project @@ -79,27 +79,12 @@ void Dialog::open() // However, this policy is left entirely to the framebuffer // We suggest the hint here, but specific framebuffers are free to // ignore it - if(_surfaceID < 0 || _surface == NULL) + _surface = instance().frameBuffer().surface(_surfaceID); + if(_surface == NULL) { _surfaceID = instance().frameBuffer().allocateSurface(_w, _h, _isBase); _surface = instance().frameBuffer().surface(_surfaceID); } - else if((uInt32)_w > _surface->getWidth() || (uInt32)_h > _surface->getHeight()) - { -cerr << "!!!! surface is too small !!!!" << endl; -/* - _surfaceID = instance().frameBuffer().freeSurface(_surfaceID); - _surfaceID = instance().frameBuffer().allocateSurface(_w, _h, _isBase); - _surface = instance().frameBuffer().surface(_surfaceID); -*/ - } -/* - else - { - _surface->setWidth(_w); - _surface->setHeight(_h); - } -*/ center(); @@ -265,7 +250,7 @@ void Dialog::drawDialog() if(_dirty) { - cerr << "Dialog::drawDialog(): w = " << _w << ", h = " << _h << endl << endl; + cerr << "Dialog::drawDialog(): w = " << _w << ", h = " << _h << " @ " << &s << endl << endl; s.fillRect(_x+1, _y+1, _w-2, _h-2, kDlgColor); s.box(_x, _y, _w, _h, kColor, kShadowColor);