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