From: Côme Chilliet Date: Wed, 7 Dec 2016 11:16:15 +0000 (+0700) Subject: Fixes #8 Removed glstubs.h and its uses X-Git-Url: https://git.jsancho.org/?p=lugaru.git;a=commitdiff_plain;h=e4d3d3f1df59e142d358503b8c41dfb1db4f4231 Fixes #8 Removed glstubs.h and its uses --- diff --git a/CMakeLists.txt b/CMakeLists.txt index b507ffe..3a87ea6 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -96,7 +96,6 @@ set(LUGARU_H ${SRCDIR}/openal_wrapper.h ${SRCDIR}/optionparser.h ${SRCDIR}/gamegl.h - ${SRCDIR}/glstubs.h ${SRCDIR}/private.h ${SRCDIR}/Settings.h ${SRCDIR}/Stereo.h diff --git a/Source/glstubs.h b/Source/glstubs.h deleted file mode 100644 index 1997340..0000000 --- a/Source/glstubs.h +++ /dev/null @@ -1,105 +0,0 @@ -/* -Copyright (C) 2003, 2010 - Wolfire Games -Copyright (C) 2010-2016 - Lugaru contributors (see AUTHORS file) - -This file is part of Lugaru. - -Lugaru is free software; you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation; either version 2 of the License, or -(at your option) any later version. - -Lugaru is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with Lugaru. If not, see . -*/ - -GL_FUNC(void,glAlphaFunc,(GLenum f,GLclampf x),(f,x),) -GL_FUNC(void,glBegin,(GLenum e),(e),) -GL_FUNC(void,glBindTexture,(GLenum target,GLuint name),(target,name),) -GL_FUNC(void,glBlendFunc,(GLenum f,GLenum x),(f,x),) -GL_FUNC(void,glCallLists,(GLsizei a,GLenum b,const GLvoid* c),(a,b,c),) -GL_FUNC(void,glClear,(GLbitfield a),(a),) -GL_FUNC(void,glClearColor,(GLclampf r,GLclampf g,GLclampf b,GLclampf a),(r,g,b,a),) -GL_FUNC(void,glClearDepth,(GLclampd x),(x),) -GL_FUNC(void,glColor3f,(GLfloat r,GLfloat g,GLfloat b),(r,g,b),) -GL_FUNC(void,glColor4f,(GLfloat r,GLfloat g,GLfloat b,GLfloat a),(r,g,b,a),) -GL_FUNC(void,glColorMask,(GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha),(red,green,blue,alpha),) -GL_FUNC(void,glColorPointer,(GLint size, GLenum type, GLsizei stride, const GLvoid *pointer),(size, type, stride, pointer),) -GL_FUNC(void,glCopyTexImage2D,(GLenum target, GLint level, GLenum internalFormat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border),(target, level, internalFormat, x, y, width, height, border),) -GL_FUNC(void,glCopyTexSubImage2D,(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height),(target, level, xoffset, yoffset, x, y, width, height),) -GL_FUNC(void,glCullFace,(GLenum mode),(mode),) -GL_FUNC(void,glDeleteLists,(GLuint list, GLsizei range),(list,range),) -GL_FUNC(void,glDeleteTextures,(GLsizei n, const GLuint *textures),(n,textures),) -GL_FUNC(void,glDepthFunc,(GLenum func),(func),) -GL_FUNC(void,glDepthMask,(GLboolean flag),(flag),) -GL_FUNC(void,glDisable,(GLenum cap),(cap),) -GL_FUNC(void,glDisableClientState,(GLenum array),(array),) -GL_FUNC(void,glDrawArrays,(GLenum mode, GLint first, GLsizei count),(mode,first,count),) -GL_FUNC(void,glDrawBuffer,(GLenum mode),(mode),) -GL_FUNC(void,glEnable,(GLenum cap),(cap),) -GL_FUNC(void,glEnableClientState,(GLenum array),(array),) -GL_FUNC(void,glEnd,(void),(),) -GL_FUNC(void,glEndList,(void),(),) -GL_FUNC(void,glFinish,(void),(),) -GL_FUNC(GLuint,glGenLists,(GLsizei range),(range),return) -GL_FUNC(void,glGenTextures,(GLsizei n, GLuint *textures),(n,textures),) -GL_FUNC(GLenum,glGetError,(void),(),return) -GL_FUNC(void,glGetFloatv,(GLenum pname, GLfloat *params),(pname,params),) -GL_FUNC(void,glHint,(GLenum target, GLenum mode),(target,mode),) -GL_FUNC(void,glInterleavedArrays,(GLenum format, GLsizei stride, const GLvoid *pointer),(format,stride,pointer),) -GL_FUNC(GLboolean,glIsTexture,(GLuint texture),(texture),return) -GL_FUNC(void,glLightfv,(GLenum light, GLenum pname, const GLfloat *params),(light,pname,params),) -GL_FUNC(void,glListBase,(GLuint base),(base),) -GL_FUNC(void,glLoadIdentity,(void),(),) -GL_FUNC(void,glLoadMatrixf,(const GLfloat *m),(m),) -GL_FUNC(void,glMatrixMode,(GLenum mode),(mode),) -GL_FUNC(void,glNewList,(GLuint list, GLenum mode),(list,mode),) -GL_FUNC(void,glNormal3f,(GLfloat nx, GLfloat ny, GLfloat nz),(nx,ny,nz),) -GL_FUNC(void,glOrtho,(GLdouble left, GLdouble right, GLdouble bottom, GLdouble top, GLdouble zNear, GLdouble zFar),(left,right,bottom,top,zNear,zFar),) -GL_FUNC(void,glPixelStorei,(GLenum pname, GLint param),(pname,param),) -GL_FUNC(void,glPixelTransferi,(GLenum pname, GLint param),(pname,param),) -GL_FUNC(void,glPointSize,(GLfloat size),(size),) -GL_FUNC(void,glPopMatrix,(void),(),) -GL_FUNC(void,glPushMatrix,(void),(),) -GL_FUNC(void,glReadBuffer,(GLenum mode),(mode),) -GL_FUNC(void,glReadPixels,(GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLvoid *pixels),(x,y,width,height,format,type,pixels),) -GL_FUNC(void,glRotatef,(GLfloat angle, GLfloat x, GLfloat y, GLfloat z),(angle,x,y,z),) -GL_FUNC(void,glScalef,(GLfloat x, GLfloat y, GLfloat z),(x,y,z),) -GL_FUNC(void,glShadeModel,(GLenum mode),(mode),) -GL_FUNC(void,glTexCoord2f,(GLfloat s, GLfloat t),(s,t),) -GL_FUNC(void,glTexCoordPointer,(GLint size, GLenum type, GLsizei stride, const GLvoid *pointer),(size,type,stride,pointer),) -GL_FUNC(void,glTexEnvf,(GLenum target, GLenum pname, GLfloat param),(target,pname,param),) -GL_FUNC(void,glTexEnvfv,(GLenum target, GLenum pname, const GLfloat *params),(target,pname,params),) -GL_FUNC(void,glTexEnvi,(GLenum target, GLenum pname, GLint param),(target,pname,param),) -GL_FUNC(void,glTexParameterf,(GLenum target, GLenum pname, GLfloat param),(target,pname,param),) -GL_FUNC(void,glTexParameteri,(GLenum target, GLenum pname, GLint param),(target,pname,param),) -GL_FUNC(void,glTexSubImage2D,(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *pixels),(target,level,xoffset,yoffset,width,height,format,type,pixels),) -GL_FUNC(void,glTranslated,(GLdouble x, GLdouble y, GLdouble z),(x,y,z),) -GL_FUNC(void,glTranslatef,(GLfloat x, GLfloat y, GLfloat z),(x,y,z),) -GL_FUNC(void,glVertex2i,(GLint x, GLint y),(x,y),) -GL_FUNC(void,glVertex3f,(GLfloat x, GLfloat y, GLfloat z),(x,y,z),) -GL_FUNC(void,glVertexPointer,(GLint size, GLenum type, GLsizei stride, const GLvoid *pointer),(size,type,stride,pointer),) -GL_FUNC(void,glViewport,(GLint x, GLint y, GLsizei width, GLsizei height),(x,y,width,height),) -GL_FUNC(void,glLockArraysEXT,(GLint first, GLsizei count),(first,count),) -GL_FUNC(void,glUnlockArraysEXT,(void),(),) -GL_FUNC(void,glStencilFunc,(GLenum func, GLint ref, GLuint mask),(func,ref,mask),) -GL_FUNC(void,glStencilOp,(GLenum fail, GLenum zfail, GLenum zpass),(fail,zfail,zpass),) -GL_FUNC(void,glClearStencil,(GLint s),(s),) -GL_FUNC(void,glLineWidth,(GLfloat width),(width),) - -// stuff GLU needs... -GL_FUNC(void,glGetIntegerv,(GLenum pname, GLint *params),(pname,params),) -GL_FUNC(const GLubyte *,glGetString,(GLenum name),(name),return) -GL_FUNC(void,glGetTexLevelParameteriv,(GLenum target, GLint level, GLenum pname, GLint *params),(target,level,pname,params),) -GL_FUNC(void,glMultMatrixd,(const GLdouble *m),(m),) -GL_FUNC(void,glMultMatrixf,(const GLfloat *m),(m),) -GL_FUNC(void,glGetTexImage,(GLenum target, GLint level, GLenum format, GLenum type, GLvoid *pixels),(target,level,format,type,pixels),) -GL_FUNC(void,glTexImage1D,(GLenum target, GLint level, GLint internalFormat, GLsizei width, GLint border, GLenum format, GLenum type, const GLvoid *pixels),(target,level,internalFormat,width,border,format,type,pixels),) -GL_FUNC(void,glTexImage2D,(GLenum target, GLint level, GLint internalFormat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const GLvoid *pixels),(target,level,internalFormat,width,height,border,format,type,pixels),) -GL_FUNC(void,glTexImage3D,(GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, const GLvoid *pixels),(target,level,internalformat,width,height,depth,border,format,type,pixels),) - diff --git a/Source/main.cpp b/Source/main.cpp index 9e1c110..c50e893 100644 --- a/Source/main.cpp +++ b/Source/main.cpp @@ -63,54 +63,6 @@ set> resolutions; // statics/globals (internal only) ------------------------------------------ -#ifdef _MSC_VER -#pragma warning(push) -#pragma warning(disable: 4273) -#endif - -#ifndef __MINGW32__ // FIXME: Temporary workaround for GL-8 -#define GL_FUNC(ret,fn,params,call,rt) \ - extern "C" { \ - static ret (GLAPIENTRY *p##fn) params = NULL; \ - ret GLAPIENTRY fn params { rt p##fn call; } \ - } -#include "glstubs.h" -#undef GL_FUNC -#endif // __MINGW32__ - -#ifdef _MSC_VER -#pragma warning(pop) -#endif - -static bool lookup_glsym(const char *funcname, void **func) -{ - *func = SDL_GL_GetProcAddress(funcname); - if (*func == NULL) { - fprintf(stderr, "Failed to find OpenGL symbol \"%s\"\n", funcname); - return false; - } - return true; -} - -static bool lookup_all_glsyms(void) -{ - bool retval = true; -#ifndef __MINGW32__ // FIXME: Temporary workaround for GL-8 -#define GL_FUNC(ret,fn,params,call,rt) \ - if (!lookup_glsym(#fn, (void **) &p##fn)) retval = false; -#include "glstubs.h" -#undef GL_FUNC -#endif // __MINGW32__ - return retval; -} - -#ifndef __MINGW32__ // FIXME: Temporary workaround for GL-8 -static void GLAPIENTRY glDeleteTextures_doNothing(GLsizei n, const GLuint *textures) -{ - // no-op. -} -#endif // __MINGW32__ - // Menu defs int kContextWidth; @@ -318,12 +270,6 @@ bool SetUp () SDL_GL_MakeCurrent(sdlwindow, glctx); - if (!lookup_all_glsyms()) { - fprintf(stderr, "Missing required OpenGL functions.\n"); - SDL_Quit(); - return false; - } - int dblbuf = 0; if ((SDL_GL_GetAttribute(SDL_GL_DOUBLEBUFFER, &dblbuf) == -1) || (!dblbuf)) { @@ -515,14 +461,6 @@ void CleanUp (void) delete[] commandLineOptionsBuffer; SDL_Quit(); -#ifndef __MINGW32__ // FIXME: Temporary workaround for GL-8 -#define GL_FUNC(ret,fn,params,call,rt) p##fn = NULL; -#include "glstubs.h" -#undef GL_FUNC - // cheat here...static destructors are calling glDeleteTexture() after - // the context is destroyed and libGL unloaded by SDL_Quit(). - pglDeleteTextures = glDeleteTextures_doNothing; -#endif // __MINGW32__ } // --------------------------------------------------------------------------