OpenGL Programming/Debugging

< OpenGL Programming

Mesa

If you are using the Mesa OpenGL implementation you can set the following environment variables:

See also Mesa's debugging and environment variables pages.

Common mistakes

If you manually draw lines or triangles, and nothing appears:

Error reporting

OpenGL uses glGetError() to report errors:

	switch (glGetError()) {
	case GL_NO_ERROR:
		cerr << "GL_NO_ERROR" << endl;
		break;
	case GL_INVALID_ENUM:
		cerr << "GL_INVALID_ENUM" << endl;
		break;
	case GL_INVALID_VALUE:
		cerr << "GL_INVALID_VALUE" << endl;
		break;
	case GL_INVALID_OPERATION:
		cerr << "GL_INVALID_OPERATION" << endl;
		break;
	case GL_INVALID_FRAMEBUFFER_OPERATION:
		cerr << "GL_INVALID_FRAMEBUFFER_OPERATION" << endl;
		break;
	case GL_OUT_OF_MEMORY:
		cerr << "GL_OUT_OF_MEMORY" << endl;
		break;
	}

Stencil buffer

For tips on how to debug the stencil buffer, you can check the Stencil buffer section.

Links

- Comment on this page

- Recent stats

< OpenGL Programming

Browse & download complete code
This article is issued from Wikibooks. The text is licensed under Creative Commons - Attribution - Sharealike. Additional terms may apply for the media files.