Some fullscreen positioning fixes for OpenGL mode. It's getting close

to being finished now (thankfully, since I want to move to other parts
of the codebase).


git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@1570 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
This commit is contained in:
stephena 2008-12-21 19:51:35 +00:00
parent 748325301d
commit 039a0b9e36
3 changed files with 20 additions and 45 deletions

View File

@ -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.120 2008-12-20 23:32:45 stephena Exp $
// $Id: FrameBufferGL.cxx,v 1.121 2008-12-21 19:51:34 stephena Exp $
//============================================================================
#ifdef DISPLAY_OPENGL
@ -335,7 +335,7 @@ cerr << "setVidMode: w = " << mode.screen_w << ", h = " << mode.screen_h << endl
myHaveTexRectEXT = false;
// Initialize GL display
p_glViewport(mode.image_x, mode.image_y, mode.image_w, mode.image_h);
p_glViewport(0, 0, mode.screen_w, mode.screen_h);
p_glShadeModel(GL_FLAT);
p_glDisable(GL_CULL_FACE);
p_glDisable(GL_DEPTH_TEST);
@ -345,7 +345,7 @@ cerr << "setVidMode: w = " << mode.screen_w << ", h = " << mode.screen_h << endl
p_glMatrixMode(GL_PROJECTION);
p_glLoadIdentity();
p_glOrtho(0.0, mode.image_w, mode.image_h, 0.0, 0.0, 1.0);
p_glOrtho(0.0, mode.screen_w, mode.screen_h, 0.0, -1.0, 1.0);
p_glMatrixMode(GL_MODELVIEW);
p_glPushMatrix();
p_glLoadIdentity();
@ -381,8 +381,11 @@ cerr << "dimensions: " << endl
resetSurfaces();
if(!inUIMode)
{
myTiaSurface = new FBSurfaceGL(*this, baseWidth, baseHeight,
mode.image_w, mode.image_h);
myTiaSurface->setPos(mode.image_x, mode.image_y);
}
// Make sure any old parts of the screen are erased
p_glClear(GL_COLOR_BUFFER_BIT);
@ -579,11 +582,9 @@ cerr << " FBSurfaceGL::FBSurfaceGL: w = " << baseWidth << ", h = " << baseHeigh
// Based on experimentation, the following is the fastest 16-bit
// format for OpenGL (on all platforms)
myTexFormat = GL_BGRA;
myTexType = GL_UNSIGNED_SHORT_1_5_5_5_REV;
myTexture = SDL_CreateRGBSurface(SDL_SWSURFACE,
myTexWidth, myTexHeight, 16,
0x00007c00, 0x000003e0, 0x0000001f, 0x00000000);
myTexture = SDL_CreateRGBSurface(SDL_SWSURFACE,
myTexWidth, myTexHeight, 16,
0x00007c00, 0x000003e0, 0x0000001f, 0x00000000);
switch(myTexture->format->BytesPerPixel)
{
@ -607,7 +608,7 @@ cerr << " FBSurfaceGL::FBSurfaceGL: w = " << baseWidth << ", h = " << baseHeigh
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
FBSurfaceGL::~FBSurfaceGL()
{
cerr << " FBSurfaceGL::~FBSurfaceGL(): myTexID = " << myTexID << " @ " << this << endl;
//cerr << " FBSurfaceGL::~FBSurfaceGL(): myTexID = " << myTexID << " @ " << this << endl;
if(myTexture)
SDL_FreeSurface(myTexture);
@ -775,7 +776,7 @@ void FBSurfaceGL::update()
// and antialiasing
p_glBindTexture(myTexTarget, myTexID);
p_glTexSubImage2D(myTexTarget, 0, 0, 0, myTexWidth, myTexHeight,
myTexFormat, myTexType, myTexture->pixels);
GL_BGRA, GL_UNSIGNED_SHORT_1_5_5_5_REV, myTexture->pixels);
p_glBegin(GL_QUADS);
p_glTexCoord2f(myTexCoord[0], myTexCoord[1]);
p_glVertex2i(myXOrig, myYOrig);
@ -801,7 +802,7 @@ void FBSurfaceGL::free()
{
p_glDeleteTextures(1, &myTexID);
cerr << " ==> FBSurfaceGL::free(): myTexID = " << myTexID << " @ " << this << endl;
//cerr << " ==> FBSurfaceGL::free(): myTexID = " << myTexID << " @ " << this << endl;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
@ -842,11 +843,11 @@ void FBSurfaceGL::reload()
// Finally, create the texture in the most optimal format
p_glTexImage2D(myTexTarget, 0, GL_RGB5,
myTexWidth, myTexHeight, 0,
myTexFormat, myTexType, myTexture->pixels);
GL_BGRA, GL_UNSIGNED_SHORT_1_5_5_5_REV, myTexture->pixels);
p_glEnable(myTexTarget);
cerr << " ==> FBSurfaceGL::reload(): myTexID = " << myTexID << " @ " << this << endl;
//cerr << " ==> FBSurfaceGL::reload(): myTexID = " << myTexID << " @ " << this << endl;
}
#if 0

View File

@ -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.63 2008-12-20 23:32:46 stephena Exp $
// $Id: FrameBufferGL.hxx,v 1.64 2008-12-21 19:51:35 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.63 2008-12-20 23:32:46 stephena Exp $
@version $Id: FrameBufferGL.hxx,v 1.64 2008-12-21 19:51:35 stephena Exp $
*/
class FrameBufferGL : public FrameBuffer
{
@ -156,30 +156,9 @@ class FrameBufferGL : public FrameBuffer
// since Dialog surfaces are allocated by the Dialog class directly).
FBSurfaceGL* myTiaSurface;
// Used for mapRGB (when palettes are created)
// Used by mapRGB (when palettes are created)
SDL_PixelFormat myPixelFormat;
/*
// Holds all items specifically needed by GL commands
struct glBufferType
{
GLuint texture;
GLsizei texture_width;
GLsizei texture_height;
GLfloat tex_coord[4];
GLenum target;
GLenum format;
GLenum type;
GLint filter;
void* pixels;
int width, height;
int pitch;
};
glBufferType myBuffer;
*/
// The depth of the texture buffer
uInt32 myDepth;
@ -206,7 +185,7 @@ class FrameBufferGL : public FrameBuffer
A surface suitable for OpenGL rendering mode.
@author Stephen Anthony
@version $Id: FrameBufferGL.hxx,v 1.63 2008-12-20 23:32:46 stephena Exp $
@version $Id: FrameBufferGL.hxx,v 1.64 2008-12-21 19:51:35 stephena Exp $
*/
class FBSurfaceGL : public FBSurface
{
@ -238,7 +217,6 @@ class FBSurfaceGL : public FBSurface
private:
inline void* pixels() const { return myTexture->pixels; }
inline uInt32 pitch() const { return myPitch; }
void recalc();
static uInt32 power_of_two(uInt32 input)
{
@ -258,17 +236,12 @@ class FBSurfaceGL : public FBSurface
GLfloat myTexCoord[4];
GLenum myTexTarget;
GLenum myTexFormat;
GLenum myTexType;
GLint myTexFilter;
uInt32 myXOrig, myYOrig;
uInt32 myWidth, myHeight;
bool mySurfaceIsDirty;
// int myBaseOffset;
uInt32 myPitch;
uInt32 myXOffset, myYOffset;
};
#endif // DISPLAY_OPENGL

View File

@ -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.48 2008-12-08 18:56:54 stephena Exp $
// $Id: DialogContainer.cxx,v 1.49 2008-12-21 19:51:35 stephena Exp $
//============================================================================
#include "OSystem.hxx"
@ -94,6 +94,7 @@ void DialogContainer::draw()
{
for(int i = 0; i < myDialogStack.size(); i++)
{
myDialogStack[i]->center();
myDialogStack[i]->setDirty();
myDialogStack[i]->drawDialog();
}