mirror of https://github.com/stella-emu/stella.git
A few minor fixes for Win32 and dynamic OpenGL. It seems the compilers
in Windows are a little more strict than Linux. git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@959 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
This commit is contained in:
parent
2c2b06226d
commit
05c5225a6b
|
@ -13,7 +13,7 @@
|
||||||
// See the file "license" for information on usage and redistribution of
|
// See the file "license" for information on usage and redistribution of
|
||||||
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
||||||
//
|
//
|
||||||
// $Id: FrameBufferGL.cxx,v 1.49 2006-01-14 21:36:29 stephena Exp $
|
// $Id: FrameBufferGL.cxx,v 1.50 2006-01-14 22:29:34 stephena Exp $
|
||||||
//============================================================================
|
//============================================================================
|
||||||
|
|
||||||
#ifdef DISPLAY_OPENGL
|
#ifdef DISPLAY_OPENGL
|
||||||
|
@ -31,38 +31,39 @@
|
||||||
#include "Font.hxx"
|
#include "Font.hxx"
|
||||||
#include "GuiUtils.hxx"
|
#include "GuiUtils.hxx"
|
||||||
|
|
||||||
static void APIENTRY (*p_glClear)( GLbitfield );
|
// Maybe this code could be cleaner ...
|
||||||
static void APIENTRY (*p_glEnable)( GLenum );
|
static void (APIENTRY* p_glClear)( GLbitfield );
|
||||||
static void APIENTRY (*p_glDisable)( GLenum );
|
static void (APIENTRY* p_glEnable)( GLenum );
|
||||||
static void APIENTRY (*p_glPushAttrib)( GLbitfield );
|
static void (APIENTRY* p_glDisable)( GLenum );
|
||||||
static const GLubyte* APIENTRY (*p_glGetString)( GLenum );
|
static void (APIENTRY* p_glPushAttrib)( GLbitfield );
|
||||||
static void APIENTRY (*p_glHint)( GLenum, GLenum );
|
static const GLubyte* (APIENTRY* p_glGetString)( GLenum );
|
||||||
|
static void (APIENTRY* p_glHint)( GLenum, GLenum );
|
||||||
|
|
||||||
// Matrix
|
// Matrix
|
||||||
static void APIENTRY (*p_glMatrixMode)( GLenum );
|
static void (APIENTRY* p_glMatrixMode)( GLenum );
|
||||||
static void APIENTRY (*p_glOrtho)( GLdouble, GLdouble, GLdouble, GLdouble, GLdouble, GLdouble );
|
static void (APIENTRY* p_glOrtho)( GLdouble, GLdouble, GLdouble, GLdouble, GLdouble, GLdouble );
|
||||||
static void APIENTRY (*p_glViewport)( GLint, GLint, GLsizei, GLsizei );
|
static void (APIENTRY* p_glViewport)( GLint, GLint, GLsizei, GLsizei );
|
||||||
static void APIENTRY (*p_glPushMatrix)( void );
|
static void (APIENTRY* p_glPushMatrix)( void );
|
||||||
static void APIENTRY (*p_glLoadIdentity)( void );
|
static void (APIENTRY* p_glLoadIdentity)( void );
|
||||||
|
|
||||||
// Drawing
|
// Drawing
|
||||||
static void APIENTRY (*p_glBegin)( GLenum );
|
static void (APIENTRY* p_glBegin)( GLenum );
|
||||||
static void APIENTRY (*p_glEnd)( void );
|
static void (APIENTRY* p_glEnd)( void );
|
||||||
static void APIENTRY (*p_glVertex2i)( GLint, GLint );
|
static void (APIENTRY* p_glVertex2i)( GLint, GLint );
|
||||||
static void APIENTRY (*p_glTexCoord2f)( GLfloat, GLfloat );
|
static void (APIENTRY* p_glTexCoord2f)( GLfloat, GLfloat );
|
||||||
|
|
||||||
// Raster funcs
|
// Raster funcs
|
||||||
static void APIENTRY (*p_glReadPixels)( GLint, GLint, GLsizei, GLsizei, GLenum, GLenum, GLvoid* );
|
static void (APIENTRY* p_glReadPixels)( GLint, GLint, GLsizei, GLsizei, GLenum, GLenum, GLvoid* );
|
||||||
static void APIENTRY (*p_glPixelStorei)( GLenum, GLint );
|
static void (APIENTRY* p_glPixelStorei)( GLenum, GLint );
|
||||||
|
|
||||||
// Texture mapping
|
// Texture mapping
|
||||||
static void APIENTRY (*p_glTexEnvf)( GLenum, GLenum, GLfloat );
|
static void (APIENTRY* p_glTexEnvf)( GLenum, GLenum, GLfloat );
|
||||||
static void APIENTRY (*p_glGenTextures)( GLsizei, GLuint* ); // 1.1
|
static void (APIENTRY* p_glGenTextures)( GLsizei, GLuint* ); // 1.1
|
||||||
static void APIENTRY (*p_glDeleteTextures)( GLsizei, const GLuint* ); // 1.1
|
static void (APIENTRY* p_glDeleteTextures)( GLsizei, const GLuint* ); // 1.1
|
||||||
static void APIENTRY (*p_glBindTexture)( GLenum, GLuint ); // 1.1
|
static void (APIENTRY* p_glBindTexture)( GLenum, GLuint ); // 1.1
|
||||||
static void APIENTRY (*p_glTexImage2D)( GLenum, GLint, GLint, GLsizei, GLsizei, GLint, GLenum, GLenum, const GLvoid* );
|
static void (APIENTRY* p_glTexImage2D)( GLenum, GLint, GLint, GLsizei, GLsizei, GLint, GLenum, GLenum, const GLvoid* );
|
||||||
static void APIENTRY (*p_glTexSubImage2D)( GLenum, GLint, GLint, GLint, GLsizei, GLsizei, GLenum, GLenum, const GLvoid* ); // 1.1
|
static void (APIENTRY* p_glTexSubImage2D)( GLenum, GLint, GLint, GLint, GLsizei, GLsizei, GLenum, GLenum, const GLvoid* ); // 1.1
|
||||||
static void APIENTRY (*p_glTexParameteri)( GLenum, GLenum, GLint );
|
static void (APIENTRY* p_glTexParameteri)( GLenum, GLenum, GLint );
|
||||||
|
|
||||||
|
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
|
@ -91,6 +92,9 @@ FrameBufferGL::~FrameBufferGL()
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
bool FrameBufferGL::loadFuncs(const string& library)
|
bool FrameBufferGL::loadFuncs(const string& library)
|
||||||
{
|
{
|
||||||
|
if(myFuncsLoaded)
|
||||||
|
return true;
|
||||||
|
|
||||||
if(SDL_WasInit(SDL_INIT_VIDEO) == 0)
|
if(SDL_WasInit(SDL_INIT_VIDEO) == 0)
|
||||||
SDL_Init(SDL_INIT_VIDEO);
|
SDL_Init(SDL_INIT_VIDEO);
|
||||||
|
|
||||||
|
@ -101,60 +105,63 @@ bool FrameBufferGL::loadFuncs(const string& library)
|
||||||
// If anything fails, we'll know it immediately, and return false
|
// If anything fails, we'll know it immediately, and return false
|
||||||
// Yes, this syntax is ugly, but I can type it out faster than the time
|
// Yes, this syntax is ugly, but I can type it out faster than the time
|
||||||
// it takes to figure our macro magic to do it neatly
|
// it takes to figure our macro magic to do it neatly
|
||||||
p_glClear = (void(*)(GLbitfield))
|
p_glClear = (void(APIENTRY*)(GLbitfield))
|
||||||
SDL_GL_GetProcAddress("glClear"); if(!p_glClear) return false;
|
SDL_GL_GetProcAddress("glClear"); if(!p_glClear) return false;
|
||||||
p_glEnable = (void(*)(GLenum))
|
p_glEnable = (void(APIENTRY*)(GLenum))
|
||||||
SDL_GL_GetProcAddress("glEnable"); if(!p_glEnable) return false;
|
SDL_GL_GetProcAddress("glEnable"); if(!p_glEnable) return false;
|
||||||
p_glDisable = (void(*)(GLenum))
|
p_glDisable = (void(APIENTRY*)(GLenum))
|
||||||
SDL_GL_GetProcAddress("glDisable"); if(!p_glDisable) return false;
|
SDL_GL_GetProcAddress("glDisable"); if(!p_glDisable) return false;
|
||||||
p_glPushAttrib = (void(*)(GLbitfield))
|
p_glPushAttrib = (void(APIENTRY*)(GLbitfield))
|
||||||
SDL_GL_GetProcAddress("glPushAttrib"); if(!p_glPushAttrib) return false;
|
SDL_GL_GetProcAddress("glPushAttrib"); if(!p_glPushAttrib) return false;
|
||||||
p_glGetString = (const GLubyte*(*)(GLenum))
|
p_glGetString = (const GLubyte*(APIENTRY*)(GLenum))
|
||||||
SDL_GL_GetProcAddress("glGetString"); if(!p_glGetString) return false;
|
SDL_GL_GetProcAddress("glGetString"); if(!p_glGetString) return false;
|
||||||
p_glHint = (void(*)(GLenum, GLenum))
|
p_glHint = (void(APIENTRY*)(GLenum, GLenum))
|
||||||
SDL_GL_GetProcAddress("glHint"); if(!p_glHint) return false;
|
SDL_GL_GetProcAddress("glHint"); if(!p_glHint) return false;
|
||||||
|
|
||||||
p_glMatrixMode = (void(*)(GLenum))
|
p_glMatrixMode = (void(APIENTRY*)(GLenum))
|
||||||
SDL_GL_GetProcAddress("glMatrixMode"); if(!p_glMatrixMode) return false;
|
SDL_GL_GetProcAddress("glMatrixMode"); if(!p_glMatrixMode) return false;
|
||||||
p_glOrtho = (void(*)(GLdouble, GLdouble, GLdouble, GLdouble, GLdouble, GLdouble))
|
p_glOrtho = (void(APIENTRY*)(GLdouble, GLdouble, GLdouble, GLdouble, GLdouble, GLdouble))
|
||||||
SDL_GL_GetProcAddress("glOrtho"); if(!p_glOrtho) return false;
|
SDL_GL_GetProcAddress("glOrtho"); if(!p_glOrtho) return false;
|
||||||
p_glViewport = (void(*)(GLint, GLint, GLsizei, GLsizei))
|
p_glViewport = (void(APIENTRY*)(GLint, GLint, GLsizei, GLsizei))
|
||||||
SDL_GL_GetProcAddress("glViewport"); if(!p_glViewport) return false;
|
SDL_GL_GetProcAddress("glViewport"); if(!p_glViewport) return false;
|
||||||
p_glPushMatrix = (void(*)(void))
|
p_glPushMatrix = (void(APIENTRY*)(void))
|
||||||
SDL_GL_GetProcAddress("glPushMatrix"); if(!p_glPushMatrix) return false;
|
SDL_GL_GetProcAddress("glPushMatrix"); if(!p_glPushMatrix) return false;
|
||||||
p_glLoadIdentity = (void(*)(void))
|
p_glLoadIdentity = (void(APIENTRY*)(void))
|
||||||
SDL_GL_GetProcAddress("glLoadIdentity"); if(!p_glLoadIdentity) return false;
|
SDL_GL_GetProcAddress("glLoadIdentity"); if(!p_glLoadIdentity) return false;
|
||||||
|
|
||||||
p_glBegin = (void(*)(GLenum))
|
p_glBegin = (void(APIENTRY*)(GLenum))
|
||||||
SDL_GL_GetProcAddress("glBegin"); if(!p_glBegin) return false;
|
SDL_GL_GetProcAddress("glBegin"); if(!p_glBegin) return false;
|
||||||
p_glEnd = (void(*)(void))
|
p_glEnd = (void(APIENTRY*)(void))
|
||||||
SDL_GL_GetProcAddress("glEnd"); if(!p_glEnd) return false;
|
SDL_GL_GetProcAddress("glEnd"); if(!p_glEnd) return false;
|
||||||
p_glVertex2i = (void(*)(GLint, GLint))
|
p_glVertex2i = (void(APIENTRY*)(GLint, GLint))
|
||||||
SDL_GL_GetProcAddress("glVertex2i"); if(!p_glVertex2i) return false;
|
SDL_GL_GetProcAddress("glVertex2i"); if(!p_glVertex2i) return false;
|
||||||
p_glTexCoord2f = (void(*)(GLfloat, GLfloat))
|
p_glTexCoord2f = (void(APIENTRY*)(GLfloat, GLfloat))
|
||||||
SDL_GL_GetProcAddress("glTexCoord2f"); if(!p_glTexCoord2f) return false;
|
SDL_GL_GetProcAddress("glTexCoord2f"); if(!p_glTexCoord2f) return false;
|
||||||
|
|
||||||
p_glReadPixels = (void(*)(GLint, GLint, GLsizei, GLsizei, GLenum, GLenum, GLvoid*))
|
p_glReadPixels = (void(APIENTRY*)(GLint, GLint, GLsizei, GLsizei, GLenum, GLenum, GLvoid*))
|
||||||
SDL_GL_GetProcAddress("glReadPixels"); if(!p_glReadPixels) return false;
|
SDL_GL_GetProcAddress("glReadPixels"); if(!p_glReadPixels) return false;
|
||||||
p_glPixelStorei = (void(*)(GLenum, GLint))
|
p_glPixelStorei = (void(APIENTRY*)(GLenum, GLint))
|
||||||
SDL_GL_GetProcAddress("glPixelStorei"); if(!p_glPixelStorei) return false;
|
SDL_GL_GetProcAddress("glPixelStorei"); if(!p_glPixelStorei) return false;
|
||||||
|
|
||||||
p_glTexEnvf = (void(*)(GLenum, GLenum, GLfloat))
|
p_glTexEnvf = (void(APIENTRY*)(GLenum, GLenum, GLfloat))
|
||||||
SDL_GL_GetProcAddress("glTexEnvf"); if(!p_glTexEnvf) return false;
|
SDL_GL_GetProcAddress("glTexEnvf"); if(!p_glTexEnvf) return false;
|
||||||
p_glGenTextures = (void(*)(GLsizei, GLuint*))
|
p_glGenTextures = (void(APIENTRY*)(GLsizei, GLuint*))
|
||||||
SDL_GL_GetProcAddress("glGenTextures"); if(!p_glGenTextures) return false;
|
SDL_GL_GetProcAddress("glGenTextures"); if(!p_glGenTextures) return false;
|
||||||
p_glDeleteTextures = (void(*)(GLsizei, const GLuint*))
|
p_glDeleteTextures = (void(APIENTRY*)(GLsizei, const GLuint*))
|
||||||
SDL_GL_GetProcAddress("glDeleteTextures"); if(!p_glDeleteTextures) return false;
|
SDL_GL_GetProcAddress("glDeleteTextures"); if(!p_glDeleteTextures) return false;
|
||||||
p_glBindTexture = (void(*)(GLenum, GLuint))
|
p_glBindTexture = (void(APIENTRY*)(GLenum, GLuint))
|
||||||
SDL_GL_GetProcAddress("glBindTexture"); if(!p_glBindTexture) return false;
|
SDL_GL_GetProcAddress("glBindTexture"); if(!p_glBindTexture) return false;
|
||||||
p_glTexImage2D = (void(*)(GLenum, GLint, GLint, GLsizei, GLsizei, GLint, GLenum, GLenum, const GLvoid*))
|
p_glTexImage2D = (void(APIENTRY*)(GLenum, GLint, GLint, GLsizei, GLsizei, GLint, GLenum, GLenum, const GLvoid*))
|
||||||
SDL_GL_GetProcAddress("glTexImage2D"); if(!p_glTexImage2D) return false;
|
SDL_GL_GetProcAddress("glTexImage2D"); if(!p_glTexImage2D) return false;
|
||||||
p_glTexSubImage2D = (void(*)(GLenum, GLint, GLint, GLint, GLsizei, GLsizei, GLenum, GLenum, const GLvoid*))
|
p_glTexSubImage2D = (void(APIENTRY*)(GLenum, GLint, GLint, GLint, GLsizei, GLsizei, GLenum, GLenum, const GLvoid*))
|
||||||
SDL_GL_GetProcAddress("glTexSubImage2D"); if(!p_glTexSubImage2D) return false;
|
SDL_GL_GetProcAddress("glTexSubImage2D"); if(!p_glTexSubImage2D) return false;
|
||||||
p_glTexParameteri = (void(*)(GLenum, GLenum, GLint))
|
p_glTexParameteri = (void(APIENTRY*)(GLenum, GLenum, GLint))
|
||||||
SDL_GL_GetProcAddress("glTexParameteri"); if(!p_glTexParameteri) return false;
|
SDL_GL_GetProcAddress("glTexParameteri"); if(!p_glTexParameteri) return false;
|
||||||
|
|
||||||
return true;
|
if(SDL_WasInit(SDL_INIT_VIDEO))
|
||||||
|
SDL_QuitSubSystem(SDL_INIT_VIDEO);
|
||||||
|
|
||||||
|
return myFuncsLoaded = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
|
@ -729,4 +736,7 @@ void FrameBufferGL::setDimensions(GLdouble* orthoWidth, GLdouble* orthoHeight)
|
||||||
*/
|
*/
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
|
bool FrameBufferGL::myFuncsLoaded = false;
|
||||||
|
|
||||||
#endif // DISPLAY_OPENGL
|
#endif // DISPLAY_OPENGL
|
||||||
|
|
|
@ -13,7 +13,7 @@
|
||||||
// See the file "license" for information on usage and redistribution of
|
// See the file "license" for information on usage and redistribution of
|
||||||
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
||||||
//
|
//
|
||||||
// $Id: FrameBufferGL.hxx,v 1.27 2006-01-14 21:36:29 stephena Exp $
|
// $Id: FrameBufferGL.hxx,v 1.28 2006-01-14 22:29:34 stephena Exp $
|
||||||
//============================================================================
|
//============================================================================
|
||||||
|
|
||||||
#ifndef FRAMEBUFFER_GL_HXX
|
#ifndef FRAMEBUFFER_GL_HXX
|
||||||
|
@ -37,7 +37,7 @@ class GUI::Font;
|
||||||
This class implements an SDL OpenGL framebuffer.
|
This class implements an SDL OpenGL framebuffer.
|
||||||
|
|
||||||
@author Stephen Anthony
|
@author Stephen Anthony
|
||||||
@version $Id: FrameBufferGL.hxx,v 1.27 2006-01-14 21:36:29 stephena Exp $
|
@version $Id: FrameBufferGL.hxx,v 1.28 2006-01-14 22:29:34 stephena Exp $
|
||||||
*/
|
*/
|
||||||
class FrameBufferGL : public FrameBuffer
|
class FrameBufferGL : public FrameBuffer
|
||||||
{
|
{
|
||||||
|
@ -249,6 +249,9 @@ class FrameBufferGL : public FrameBuffer
|
||||||
|
|
||||||
// TODO - will be removed when textured dirty rect support is added
|
// TODO - will be removed when textured dirty rect support is added
|
||||||
bool myDirtyFlag;
|
bool myDirtyFlag;
|
||||||
|
|
||||||
|
// Indicates if the OpenGL functions have been properly loaded
|
||||||
|
static bool myFuncsLoaded;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // DISPLAY_OPENGL
|
#endif // DISPLAY_OPENGL
|
||||||
|
|
|
@ -36,8 +36,8 @@
|
||||||
AdditionalOptions="SDL.lib
|
AdditionalOptions="SDL.lib
|
||||||
SDLmain.lib
|
SDLmain.lib
|
||||||
libpng.lib
|
libpng.lib
|
||||||
opengl32.lib"
|
"
|
||||||
AdditionalDependencies="sdl.lib sdlmain.lib libpng.lib opengl32.lib zdll.lib"
|
AdditionalDependencies="sdl.lib sdlmain.lib libpng.lib zdll.lib"
|
||||||
OutputFile="$(OutDir)/Stella.exe"
|
OutputFile="$(OutDir)/Stella.exe"
|
||||||
LinkIncremental="2"
|
LinkIncremental="2"
|
||||||
GenerateDebugInformation="TRUE"
|
GenerateDebugInformation="TRUE"
|
||||||
|
@ -87,8 +87,8 @@ opengl32.lib"
|
||||||
AdditionalOptions="SDL.lib
|
AdditionalOptions="SDL.lib
|
||||||
SDLmain.lib
|
SDLmain.lib
|
||||||
libpng.lib
|
libpng.lib
|
||||||
opengl32.lib"
|
"
|
||||||
AdditionalDependencies="sdl.lib sdlmain.lib libpng.lib opengl32.lib zdll.lib"
|
AdditionalDependencies="sdl.lib sdlmain.lib libpng.lib zdll.lib"
|
||||||
OutputFile="$(OutDir)/Stella.exe"
|
OutputFile="$(OutDir)/Stella.exe"
|
||||||
GenerateDebugInformation="TRUE"
|
GenerateDebugInformation="TRUE"
|
||||||
SubSystem="2"
|
SubSystem="2"
|
||||||
|
|
Loading…
Reference in New Issue