Sha256: 530d6c363b91f7a88103b74e36a553b6556e05882219de536254d73f33ee4790

Contents?: true

Size: 1.33 KB

Versions: 22

Compression:

Stored size: 1.33 KB

Contents

#include "opengl.h"


#include "rays/exception.h"


namespace Rays
{


	bool
	OpenGL_has_error ()
	{
		return glGetError() != GL_NO_ERROR;
	}

	static String
	get_error_name (GLenum error)
	{
		switch (error)
		{
			case GL_NO_ERROR:          return "GL_NO_ERROR";
			case GL_INVALID_ENUM:      return "GL_INVALID_ENUM";
			case GL_INVALID_VALUE:     return "GL_INVALID_VALUE";
			case GL_INVALID_OPERATION: return "GL_INVALID_OPERATION";
			case GL_OUT_OF_MEMORY:     return "GL_OUT_OF_MEMORY";
			#if !defined(GL_VERSION_3_0) && !defined(GL_ES_VERSION_2_0)
				case GL_STACK_OVERFLOW:  return "GL_STACK_OVERFLOW";
				case GL_STACK_UNDERFLOW: return "GL_STACK_UNDERFLOW";
				case GL_INVALID_FRAMEBUFFER_OPERATION: return "GL_INVALID_FRAMEBUFFER_OPERATION";
				case GL_TABLE_TOO_LARGE: return "GL_TABLE_TOO_LARGE";
			#endif
			default:                   return "UNKNOWN ERROR";
		}
	}

	void
	OpenGL_check_error (const char* file, int line)
	{
		GLenum e = glGetError();
		if (e != GL_NO_ERROR)
			opengl_error(file, line, "OpenGL error %s", get_error_name(e).c_str());
	}

	void
	OpenGL_check_error (const char* file, int line, const char* format, ...)
	{
		GLenum e = glGetError();
		if (e != GL_NO_ERROR)
		{
			XOT_STRINGF(format, s);
			opengl_error(
				file, line,
				"OpenGL error %s: %s", get_error_name(e).c_str(), s.c_str());
		}
	}


}// Rays

Version data entries

22 entries across 22 versions & 1 rubygems

Version Path
rays-0.3 src/opengl.cpp
rays-0.2.1 src/opengl.cpp
rays-0.2 src/opengl.cpp
rays-0.1.49 src/opengl.cpp
rays-0.1.48 src/opengl.cpp
rays-0.1.47 src/opengl.cpp
rays-0.1.46 src/opengl.cpp
rays-0.1.45 src/opengl.cpp
rays-0.1.44 src/opengl.cpp
rays-0.1.43 src/opengl.cpp
rays-0.1.42 src/opengl.cpp
rays-0.1.40 src/opengl.cpp
rays-0.1.39 src/opengl.cpp
rays-0.1.38 src/opengl.cpp
rays-0.1.37 src/opengl.cpp
rays-0.1.36 src/opengl.cpp
rays-0.1.35 src/opengl.cpp
rays-0.1.34 src/opengl.cpp
rays-0.1.33 src/opengl.cpp
rays-0.1.32 src/opengl.cpp