medfall

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs

commit e8d6bd859c4811e40342f0b4d84854fc9e2bf468
parent af448a87bb0c06cfe3cb3733f39c150877e67e30
Author: Michael Savage <mikejsavage@gmail.com>
Date:   Sun Aug 16 14:27:37 +0200

Don't use GLEW on OS X

Diffstat:
gl.cc | 26+++++++++++++++-----------
opengl.h | 1+
2 files changed, 16 insertions(+), 11 deletions(-)
diff --git a/gl.cc b/gl.cc @@ -1,8 +1,11 @@ #include <stdlib.h> #include <err.h> -#include <GL/glew.h> #include <GLFW/glfw3.h> +#ifndef __APPLE__ +#include <GL/glew.h> +#endif + #include "gl.h" static const int WIDTH = 640; @@ -13,6 +16,7 @@ static const int HEIGHT = 480; #define YELLOW "\e[1;32m" #define GREEN "\e[1;33m" +#ifndef __APPLE__ char * type_string( const GLenum type ) { switch (type) { case GL_DEBUG_TYPE_ERROR: @@ -58,6 +62,7 @@ void gl_error_printer( exit( 1 ); } } +#endif void glfw_error_printer( const int code, const char * const message ) { warnx( "GLFW error %d: %s", code, message ); @@ -65,7 +70,7 @@ void glfw_error_printer( const int code, const char * const message ) { GLFWwindow * GL::init() { glfwSetErrorCallback( glfw_error_printer ); - + if( !glfwInit() ) { errx( 1, "glfwInit" ); } @@ -85,16 +90,15 @@ GLFWwindow * GL::init() { glfwMakeContextCurrent( window ); - glewExperimental = true; - GLenum glew_error = glewInit(); - if( glew_error != GLEW_OK ) { - errx( 1, "glewInit: %s", glewGetErrorString( glew_error ) ); - } - - glEnable( GL_DEBUG_OUTPUT ); - #ifndef __APPLE__ - glDebugMessageCallback( gl_error_printer, nullptr ); + glewExperimental = true; + GLenum glew_error = glewInit(); + if( glew_error != GLEW_OK ) { + errx( 1, "glewInit: %s", glewGetErrorString( glew_error ) ); + } + + glEnable( GL_DEBUG_OUTPUT ); + glDebugMessageCallback( gl_error_printer, nullptr ); #endif warnx( "Version %s", glGetString( GL_VERSION ) ); diff --git a/opengl.h b/opengl.h @@ -2,4 +2,5 @@ #include <OpenGL/gl3.h> #else #include <GL/gl.h> + #include <GL/glew.h> #endif