mirror of https://github.com/stella-emu/stella.git
Finally, I've eliminated the redraw issues in windowed OpenGL mode.
Can you believe it was because of ONE #$&#%&** line of code! Still TODO, a general cleanup of the positioning code (ie, switching from windowed to fullscreen & vice-versa) used the 'old' coordinates, so things often aren't centered. git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@1557 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
This commit is contained in:
parent
86cc191168
commit
a3de0dcbaf
|
@ -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.109 2008-12-04 16:53:26 stephena Exp $
|
||||
// $Id: FrameBufferGL.cxx,v 1.110 2008-12-08 18:56:53 stephena Exp $
|
||||
//============================================================================
|
||||
|
||||
#ifdef DISPLAY_OPENGL
|
||||
|
@ -73,10 +73,10 @@ static void (APIENTRY* p_glTexParameteri)( GLenum, GLenum, GLint );
|
|||
FrameBufferGL::FrameBufferGL(OSystem* osystem)
|
||||
: FrameBuffer(osystem),
|
||||
myTiaSurface(NULL),
|
||||
myHaveTexRectEXT(false),
|
||||
myFilterParamName("GL_NEAREST"),
|
||||
myWidthScaleFactor(1.0),
|
||||
myHeightScaleFactor(1.0),
|
||||
myHaveTexRectEXT(false),
|
||||
myDirtyFlag(true)
|
||||
{
|
||||
}
|
||||
|
@ -424,21 +424,24 @@ void FrameBufferGL::drawMediaSource()
|
|||
}
|
||||
|
||||
// And blit the surface
|
||||
myTiaSurface->addDirtyRect(0, 0, 0, 0);
|
||||
myTiaSurface->update();
|
||||
if(myDirtyFlag)
|
||||
{
|
||||
myTiaSurface->addDirtyRect(0, 0, 0, 0);
|
||||
myTiaSurface->update();
|
||||
}
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
void FrameBufferGL::postFrameUpdate()
|
||||
{
|
||||
static int FCOUNT = 0;
|
||||
//static int FCOUNT = 0;
|
||||
if(myDirtyFlag)
|
||||
{
|
||||
//cerr << " SWAP buffers\n";
|
||||
// Now show all changes made to the texture
|
||||
SDL_GL_SwapBuffers();
|
||||
myDirtyFlag = false;
|
||||
// cerr << FCOUNT++ << " : SWAP buffers" << endl;
|
||||
//cerr << FCOUNT++ % 2 << " : SWAP buffers" << endl;
|
||||
//cerr << "--------------------------------------------------------------------" << endl;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -546,9 +549,13 @@ FBSurfaceGL::FBSurfaceGL(FrameBufferGL& buffer,
|
|||
// Based on experimentation, the following is the fastest 16-bit
|
||||
// format for OpenGL (on all platforms)
|
||||
// TODO - make sure this is endian-clean
|
||||
myTexture = SDL_CreateRGBSurface(SDL_SWSURFACE,
|
||||
myTexWidth, myTexHeight, 16,
|
||||
0x00007c00, 0x000003e0, 0x0000001f, 0x00000000);
|
||||
GLenum tex_intformat;
|
||||
tex_intformat = GL_RGB5;
|
||||
myTexFormat = GL_BGRA;
|
||||
myTexType = GL_UNSIGNED_SHORT_1_5_5_5_REV;
|
||||
myTexture = SDL_CreateRGBSurface(SDL_SWSURFACE,
|
||||
myTexWidth, myTexHeight, 16,
|
||||
0x00007c00, 0x000003e0, 0x0000001f, 0x00000000);
|
||||
|
||||
switch(myTexture->format->BytesPerPixel)
|
||||
{
|
||||
|
@ -590,11 +597,6 @@ FBSurfaceGL::FBSurfaceGL(FrameBufferGL& buffer,
|
|||
p_glTexParameteri(myTexTarget, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
|
||||
|
||||
// Finally, create the texture in the most optimal format
|
||||
GLenum tex_intformat;
|
||||
tex_intformat = GL_RGB5;
|
||||
myTexFormat = GL_BGRA;
|
||||
myTexType = GL_UNSIGNED_SHORT_1_5_5_5_REV;
|
||||
|
||||
p_glTexImage2D(myTexTarget, 0, tex_intformat,
|
||||
myTexWidth, myTexHeight, 0,
|
||||
myTexFormat, myTexType, myTexture->pixels);
|
||||
|
@ -779,9 +781,9 @@ void FBSurfaceGL::update()
|
|||
{
|
||||
if(mySurfaceIsDirty)
|
||||
{
|
||||
//cerr << " FBSurfaceGL::update(): x = " << myXOrig << ", y = " << myYOrig << ", w = " << myWidth << ", h = " << myHeight << endl;
|
||||
// Texturemap complete texture to surface so we have free scaling
|
||||
// and antialiasing
|
||||
p_glBindTexture(myTexTarget, myTexID);
|
||||
p_glTexSubImage2D(myTexTarget, 0, 0, 0, myTexWidth, myTexHeight,
|
||||
myTexFormat, myTexType, myTexture->pixels);
|
||||
p_glBegin(GL_QUADS);
|
||||
|
@ -797,7 +799,6 @@ void FBSurfaceGL::update()
|
|||
p_glTexCoord2f(myTexCoord[0], myTexCoord[3]);
|
||||
p_glVertex2i(myXOrig, myYOrig + myHeight);
|
||||
p_glEnd();
|
||||
|
||||
mySurfaceIsDirty = false;
|
||||
|
||||
// Let postFrameUpdate() know that a change has been made
|
||||
|
|
|
@ -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.hxx,v 1.58 2008-11-24 18:02:19 stephena Exp $
|
||||
// $Id: FrameBufferGL.hxx,v 1.59 2008-12-08 18:56:53 stephena Exp $
|
||||
//============================================================================
|
||||
|
||||
#ifndef FRAMEBUFFER_GL_HXX
|
||||
|
@ -35,7 +35,7 @@ class FBSurfaceGL;
|
|||
This class implements an SDL OpenGL framebuffer.
|
||||
|
||||
@author Stephen Anthony
|
||||
@version $Id: FrameBufferGL.hxx,v 1.58 2008-11-24 18:02:19 stephena Exp $
|
||||
@version $Id: FrameBufferGL.hxx,v 1.59 2008-12-08 18:56:53 stephena Exp $
|
||||
*/
|
||||
class FrameBufferGL : public FrameBuffer
|
||||
{
|
||||
|
@ -175,9 +175,6 @@ class FrameBufferGL : public FrameBuffer
|
|||
glBufferType myBuffer;
|
||||
*/
|
||||
|
||||
// Optional GL extensions that may increase performance
|
||||
bool myHaveTexRectEXT;
|
||||
|
||||
// The depth of the texture buffer
|
||||
uInt32 myDepth;
|
||||
|
||||
|
@ -190,6 +187,9 @@ class FrameBufferGL : public FrameBuffer
|
|||
// The amount by which to scale the image in each dimension in fullscreen mode
|
||||
float myWidthScaleFactor, myHeightScaleFactor;
|
||||
|
||||
// Optional GL extensions that may increase performance
|
||||
bool myHaveTexRectEXT;
|
||||
|
||||
// Indicates that the texture has been modified, and should be redrawn
|
||||
bool myDirtyFlag;
|
||||
|
||||
|
@ -201,7 +201,7 @@ class FrameBufferGL : public FrameBuffer
|
|||
A surface suitable for OpenGL rendering mode.
|
||||
|
||||
@author Stephen Anthony
|
||||
@version $Id: FrameBufferGL.hxx,v 1.58 2008-11-24 18:02:19 stephena Exp $
|
||||
@version $Id: FrameBufferGL.hxx,v 1.59 2008-12-08 18:56:53 stephena Exp $
|
||||
*/
|
||||
class FBSurfaceGL : public FBSurface
|
||||
{
|
||||
|
@ -221,7 +221,7 @@ class FBSurfaceGL : public FBSurface
|
|||
void addDirtyRect(uInt32 x, uInt32 y, uInt32 w, uInt32 h);
|
||||
void getPos(uInt32& x, uInt32& y) const;
|
||||
void setPos(uInt32 x, uInt32 y);
|
||||
uInt32 getWidth() const { return myWidth; }
|
||||
uInt32 getWidth() const { return myWidth; }
|
||||
uInt32 getHeight() const { return myHeight; }
|
||||
void setWidth(uInt32 w);
|
||||
void setHeight(uInt32 h);
|
||||
|
|
|
@ -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: mainSDL.cxx,v 1.81 2008-05-30 19:07:55 stephena Exp $
|
||||
// $Id: mainSDL.cxx,v 1.82 2008-12-08 18:56:53 stephena Exp $
|
||||
//============================================================================
|
||||
|
||||
#include <SDL.h>
|
||||
|
@ -182,13 +182,13 @@ int main(int argc, char* argv[])
|
|||
theOSystem->eventHandler().handleEvent(Event::JoystickZeroFire1, 1);
|
||||
|
||||
#ifdef DEBUGGER_SUPPORT
|
||||
Debugger& dbg = theOSystem->debugger();
|
||||
|
||||
// Set up any breakpoint that was on the command line
|
||||
// (and remove the key from the settings, so they won't get set again)
|
||||
const string& initBreak = theOSystem->settings().getString("break");
|
||||
if(initBreak != "")
|
||||
{
|
||||
Debugger& dbg = theOSystem->debugger();
|
||||
int bp = dbg.stringToValue(initBreak);
|
||||
dbg.setBreakPoint(bp, true);
|
||||
theOSystem->settings().setString("break", "");
|
||||
|
|
|
@ -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: FrameBuffer.cxx,v 1.141 2008-12-04 16:53:26 stephena Exp $
|
||||
// $Id: FrameBuffer.cxx,v 1.142 2008-12-08 18:56:54 stephena Exp $
|
||||
//============================================================================
|
||||
|
||||
#include <algorithm>
|
||||
|
@ -194,8 +194,7 @@ void FrameBuffer::update()
|
|||
{
|
||||
// Only update the screen if it's been invalidated
|
||||
if(myRedrawEntireFrame)
|
||||
{cerr << " ==> redraw TIA before menu\n";
|
||||
drawMediaSource();}
|
||||
drawMediaSource();
|
||||
|
||||
myOSystem->menu().draw();
|
||||
break; // S_MENU
|
||||
|
|
|
@ -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: DialogContainer.cxx,v 1.47 2008-12-04 16:53:26 stephena Exp $
|
||||
// $Id: DialogContainer.cxx,v 1.48 2008-12-08 18:56:54 stephena Exp $
|
||||
//============================================================================
|
||||
|
||||
#include "OSystem.hxx"
|
||||
|
@ -92,7 +92,6 @@ void DialogContainer::draw()
|
|||
// Draw all the dialogs on the stack when we want a full refresh
|
||||
if(myRefreshFlag)
|
||||
{
|
||||
cerr << "FULL refresh" << endl;
|
||||
for(int i = 0; i < myDialogStack.size(); i++)
|
||||
{
|
||||
myDialogStack[i]->setDirty();
|
||||
|
|
Loading…
Reference in New Issue