vrshoot
annotate src/opengl.cc @ 0:b2f14e535253
initial commit
author | John Tsiombikas <nuclear@member.fsf.org> |
---|---|
date | Sat, 01 Feb 2014 19:58:19 +0200 |
parents | |
children |
rev | line source |
---|---|
nuclear@0 | 1 #include "opengl.h" |
nuclear@0 | 2 |
nuclear@0 | 3 void init_opengl() |
nuclear@0 | 4 { |
nuclear@0 | 5 #ifdef __GLEW_H__ |
nuclear@0 | 6 glewInit(); |
nuclear@0 | 7 #endif |
nuclear@0 | 8 } |
nuclear@0 | 9 |
nuclear@0 | 10 const char *strglerr(int err) |
nuclear@0 | 11 { |
nuclear@0 | 12 static const char *errnames[] = { |
nuclear@0 | 13 "GL_INVALID_ENUM", |
nuclear@0 | 14 "GL_INVALID_VALUE", |
nuclear@0 | 15 "GL_INVALID_OPERATION", |
nuclear@0 | 16 "GL_STACK_OVERFLOW", |
nuclear@0 | 17 "GL_STACK_UNDERFLOW", |
nuclear@0 | 18 "GL_OUT_OF_MEMORY", |
nuclear@0 | 19 "GL_INVALID_FRAMEBUFFER_OPERATION" |
nuclear@0 | 20 }; |
nuclear@0 | 21 |
nuclear@0 | 22 if(!err) { |
nuclear@0 | 23 return "GL_NO_ERROR"; |
nuclear@0 | 24 } |
nuclear@0 | 25 if(err < GL_INVALID_ENUM || err > GL_OUT_OF_MEMORY) { |
nuclear@0 | 26 return "<invalid gl error>"; |
nuclear@0 | 27 } |
nuclear@0 | 28 return errnames[err - GL_INVALID_ENUM]; |
nuclear@0 | 29 } |