goat3dgfx

annotate src/opengl.cc @ 34:3eb6c8f89fe1

merge
author John Tsiombikas <nuclear@member.fsf.org>
date Sun, 02 Mar 2014 17:41:10 +0200
parents 1873dfd13f2d
children
rev   line source
nuclear@0 1 #include "opengl.h"
nuclear@0 2
nuclear@15 3 using namespace goatgfx;
nuclear@15 4
nuclear@15 5 namespace goatgfx {
nuclear@15 6
nuclear@0 7 void init_opengl()
nuclear@0 8 {
nuclear@0 9 #ifdef __GLEW_H__
nuclear@0 10 glewInit();
nuclear@0 11 #endif
nuclear@0 12 }
nuclear@0 13
nuclear@0 14 const char *strglerr(int err)
nuclear@0 15 {
nuclear@0 16 static const char *errnames[] = {
nuclear@0 17 "GL_INVALID_ENUM",
nuclear@0 18 "GL_INVALID_VALUE",
nuclear@0 19 "GL_INVALID_OPERATION",
nuclear@0 20 "GL_STACK_OVERFLOW",
nuclear@0 21 "GL_STACK_UNDERFLOW",
nuclear@0 22 "GL_OUT_OF_MEMORY",
nuclear@0 23 "GL_INVALID_FRAMEBUFFER_OPERATION"
nuclear@0 24 };
nuclear@0 25
nuclear@0 26 if(!err) {
nuclear@0 27 return "GL_NO_ERROR";
nuclear@0 28 }
nuclear@0 29 if(err < GL_INVALID_ENUM || err > GL_OUT_OF_MEMORY) {
nuclear@0 30 return "<invalid gl error>";
nuclear@0 31 }
nuclear@0 32 return errnames[err - GL_INVALID_ENUM];
nuclear@0 33 }
nuclear@15 34
nuclear@15 35 } // namespace goatgfx