From 530e093d8b25f8ac9be48507319f1353f4695679 Mon Sep 17 00:00:00 2001 From: Bryan Hoyle Date: Sun, 12 Aug 2012 14:29:27 -0400 Subject: [PATCH] now opengl and opengl renderer run and compile, but renderer has a segfault, will fix --- src/PowderToySDL.cpp | 16 ++++++++-------- src/graphics/OpenGLGraphics.cpp | 5 ++--- src/graphics/Renderer.h | 1 + 3 files changed, 11 insertions(+), 11 deletions(-) diff --git a/src/PowderToySDL.cpp b/src/PowderToySDL.cpp index 48c6292fa..10855610c 100644 --- a/src/PowderToySDL.cpp +++ b/src/PowderToySDL.cpp @@ -199,14 +199,6 @@ int SDLOpen() //SDL_EnableKeyRepeat(SDL_DEFAULT_REPEAT_DELAY, SDL_DEFAULT_REPEAT_INTERVAL); atexit(SDL_Quit); -#if defined(OGLI) - int status = glewInit(); - if(status != GLEW_OK) - { - fprintf(stderr, "Initializing Glew: %d\n", status); - exit(-1); - } -#endif return 0; } @@ -351,6 +343,14 @@ int main(int argc, char * argv[]) #ifdef OGLI SDL_GL_SetAttribute (SDL_GL_DOUBLEBUFFER, 1); //glScaled(2.0f, 2.0f, 1.0f); +#endif +#if defined(OGLI) + int status = glewInit(); + if(status != GLEW_OK) + { + fprintf(stderr, "Initializing Glew: %d\n", status); + exit(-1); + } #endif ui::Engine::Ref().g = new Graphics(); ui::Engine::Ref().Scale = scale; diff --git a/src/graphics/OpenGLGraphics.cpp b/src/graphics/OpenGLGraphics.cpp index 34935e753..4f1d5d4ee 100644 --- a/src/graphics/OpenGLGraphics.cpp +++ b/src/graphics/OpenGLGraphics.cpp @@ -7,13 +7,12 @@ #ifdef OGLI static pthread_mutex_t gMutex = PTHREAD_MUTEX_INITIALIZER; - +//static pthread_mutex_t TMPMUT = PTHREAD_MUTEX_INITIALIZER; Graphics::Graphics(): sdl_scale(1) { -// if(gMutex == PTHREAD_MUTEX_INITIALIZER) +// if(gMutex == TMPMUT) // pthread_mutex_init (&gMutex, NULL); -printf("PTHREAD_MUTEX_INITIALIZER\n"); Reset(); glEnable(GL_BLEND); diff --git a/src/graphics/Renderer.h b/src/graphics/Renderer.h index 606dbc840..c395a91f3 100644 --- a/src/graphics/Renderer.h +++ b/src/graphics/Renderer.h @@ -85,6 +85,7 @@ public: void checkShader(GLuint shader, char * shname); void checkProgram(GLuint program, char * progname); void loadShaders(); + GLuint vidBuf,textTexture; #endif pixel * vid; pixel * persistentVid;