X-Git-Url: https://git.octo.it/?a=blobdiff_plain;f=src%2Fvideo%2Fglutil.hpp;h=4d5af681543c55f7a2fa5ece13f813bc2da263a0;hb=e4fe001c2e244bcd86870d2a3d936c4eca59c576;hp=be09ba46e802ace3ce55844f099bd582635a6d5b;hpb=551c54f2ea0a4ef991a24e66e70635ed8c41fb10;p=supertux.git diff --git a/src/video/glutil.hpp b/src/video/glutil.hpp index be09ba46e..4d5af6815 100644 --- a/src/video/glutil.hpp +++ b/src/video/glutil.hpp @@ -1,12 +1,10 @@ -// $Id$ +// SuperTux +// Copyright (C) 2006 Matthias Braun // -// SuperTux - A Jump'n Run -// Copyright (C) 2004 Matthias Braun . + +#ifndef HEADER_SUPERTUX_VIDEO_GLUTIL_HPP +#define HEADER_SUPERTUX_VIDEO_GLUTIL_HPP + +#include + +#ifdef HAVE_OPENGL #include #include -#include -static inline void assert_gl(const char* message) +#if defined(MACOSX) +# include +# include +#elif defined(GL_VERSION_ES_CM_1_0) +# include +# include +#else +# include +# include +#endif + +static inline void check_gl_error(const char* message) { #ifdef DEBUG GLenum error = glGetError(); @@ -33,14 +45,14 @@ static inline void assert_gl(const char* message) switch(error) { case GL_INVALID_ENUM: msg << "INVALID_ENUM: An unacceptable value is specified for an " - "enumerated argument."; + "enumerated argument."; break; case GL_INVALID_VALUE: msg << "INVALID_VALUE: A numeric argument is out of range."; break; case GL_INVALID_OPERATION: msg << "INVALID_OPERATION: The specified operation is not allowed " - "in the current state."; + "in the current state."; break; case GL_STACK_OVERFLOW: msg << "STACK_OVERFLOW: This command would cause a stack overflow."; @@ -50,16 +62,44 @@ static inline void assert_gl(const char* message) break; case GL_OUT_OF_MEMORY: msg << "OUT_OF_MEMORY: There is not enough memory left to execute the " - "command."; + "command."; + break; +#ifdef GL_TABLE_TOO_LARGE + case GL_TABLE_TOO_LARGE: + msg << "TABLE_TOO_LARGE: table is too large"; break; +#endif default: msg << "Unknown error (code " << error << ")"; } - + throw std::runtime_error(msg.str()); } +#else + (void) message; #endif } +static inline void assert_gl(const char* message) +{ +#ifdef DEBUG + check_gl_error(message); +#else + (void) message; +#endif +} + +#else + +#define GLenum int +#define GLint int +#define GL_SRC_ALPHA 0 +#define GL_ONE_MINUS_SRC_ALPHA 1 +#define GL_RGBA 2 +#define GL_ONE 3 + +#endif + #endif +/* EOF */