vrshoot

diff 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
line diff
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/src/opengl.cc	Sat Feb 01 19:58:19 2014 +0200
     1.3 @@ -0,0 +1,29 @@
     1.4 +#include "opengl.h"
     1.5 +
     1.6 +void init_opengl()
     1.7 +{
     1.8 +#ifdef __GLEW_H__
     1.9 +	glewInit();
    1.10 +#endif
    1.11 +}
    1.12 +
    1.13 +const char *strglerr(int err)
    1.14 +{
    1.15 +	static const char *errnames[] = {
    1.16 +		"GL_INVALID_ENUM",
    1.17 +		"GL_INVALID_VALUE",
    1.18 +		"GL_INVALID_OPERATION",
    1.19 +		"GL_STACK_OVERFLOW",
    1.20 +		"GL_STACK_UNDERFLOW",
    1.21 +		"GL_OUT_OF_MEMORY",
    1.22 +		"GL_INVALID_FRAMEBUFFER_OPERATION"
    1.23 +	};
    1.24 +
    1.25 +	if(!err) {
    1.26 +		return "GL_NO_ERROR";
    1.27 +	}
    1.28 +	if(err < GL_INVALID_ENUM || err > GL_OUT_OF_MEMORY) {
    1.29 +		return "<invalid gl error>";
    1.30 +	}
    1.31 +	return errnames[err - GL_INVALID_ENUM];
    1.32 +}