Sha256: 2a1e229f7999588418bb67d5b34b316b9a380e51ea66a1d2780a4bf24c02c3de

Contents?: true

Size: 1.12 KB

Versions: 6

Compression:

Stored size: 1.12 KB

Contents

#include "rays/opengl.h"


#include "rays/exception.h"


namespace Rays
{


	GLenum
	get_error ()
	{
		return glGetError();
	}

	bool
	no_error ()
	{
		return get_error() == GL_NO_ERROR;
	}

	bool
	is_error (GLenum err)
	{
		return get_error() == err;
	}

	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";
		#ifndef IOS
			case GL_STACK_OVERFLOW:    return "GL_STACK_OVERFLOW";
			case GL_STACK_UNDERFLOW:   return "GL_STACK_UNDERFLOW";
		#endif
			case GL_OUT_OF_MEMORY:     return "GL_OUT_OF_MEMORY";
			case 0x506:                return "GL_INVALID_FRAMEBUFFER_OPERATION";
			case 0x8031:               return "GL_TABLE_TOO_LARGE";
		}
		return "UNKNOWN ERROR";
	}

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

	void
	clear_error ()
	{
		get_error();
	}


}// Rays

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
rays-0.1.12 src/opengl.cpp
rays-0.1.11 src/opengl.cpp
rays-0.1.10 src/opengl.cpp
rays-0.1.9 src/opengl.cpp
rays-0.1.8 src/opengl.cpp
rays-0.1.7 src/opengl.cpp