medfall

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

commit 3020202dcfe1bb1ff017c85d4b42faebf347e00a
parent b7d5d59c344dfa576799fb3a56585f0f5e69d7e9
Author: Michael Savage <mikejsavage@gmail.com>
Date:   Sun Aug 16 18:20:12 +0200

Rename opengl.h to platform_opengl.h, add glterrible

Diffstat:
heightmap.cc | 2+-
heightmap.h | 2+-
opengl.h | 6------
platform_opengl.h | 29+++++++++++++++++++++++++++++
4 files changed, 31 insertions(+), 8 deletions(-)
diff --git a/heightmap.cc b/heightmap.cc @@ -3,7 +3,7 @@ #include <string> -#include "opengl.h" +#include "platform_opengl.h" #include <glm/glm.hpp> #include <glm/gtc/type_ptr.hpp> diff --git a/heightmap.h b/heightmap.h @@ -3,7 +3,7 @@ #include <string> -#include "opengl.h" +#include "platform_opengl.h" #include <glm/glm.hpp> #include "intrinsics.h" diff --git a/opengl.h b/opengl.h @@ -1,6 +0,0 @@ -#ifdef __APPLE__ - #include <OpenGL/gl3.h> -#else - #include <GL/gl.h> - #include <GL/glew.h> -#endif diff --git a/platform_opengl.h b/platform_opengl.h @@ -0,0 +1,29 @@ +#ifndef _PLATFORM_OPENGL_H_ +#define _PLATFORM_OPENGL_H_ + +#ifdef __APPLE__ + #include <OpenGL/gl3.h> +#else + #include <GL/gl.h> + #include <GL/glew.h> +#endif + +#include <stdio.h> + +inline void glterrible() { + GLenum err = glGetError(); + const char * error; + + switch(err) { + case GL_INVALID_OPERATION: error="INVALID_OPERATION"; break; + case GL_INVALID_ENUM: error="INVALID_ENUM"; break; + case GL_INVALID_VALUE: error="INVALID_VALUE"; break; + case GL_OUT_OF_MEMORY: error="OUT_OF_MEMORY"; break; + case GL_INVALID_FRAMEBUFFER_OPERATION: error="INVALID_FRAMEBUFFER_OPERATION"; break; + default: error = "shit bro"; break; + } + + printf( "GL error: %s\n", error ); +} + +#endif // _PLATFORM_OPENGL_H_