Files Class List

Detailed Description

OpenGL debug callback class.

For this class to work, you may need to initialize the OpenGL context in debug mode. This class registers an OpenGL debug callback function, which is called when there is an OpenGL generates a debug message. The class has no local storage, so it can be safely deleted. Deleting an object of this class, however, does not automatically disable the debug callbacks.

#include <cyGL.h>

Public Member Functions

 GLDebugCallback (bool registerCallback=false, bool ignoreNotifications=false, std::ostream *outStream=&std::cout)
void Register (std::ostream *outStream=&std::cout)
void Unregister ()
void SetIgnoredTypes (bool deprecated_behavior, bool portability, bool performance, bool other)
void IgnoreNotifications (bool ignore=true)

Static Protected Member Functions

static void _CY_APIENTRY Callback (GLenum source, GLenum type, GLuint id, GLenum severity, GLsizei length, const GLchar *message, const void *userParam)

Constructor & Destructor Documentation

§ GLDebugCallback()

GLDebugCallback ( bool  registerCallback = false,
bool  ignoreNotifications = false,
std::ostream *  outStream = &std::cout 

Constructor can register the callback, but only if the OpenGL context is created before the constructor is called. If the regsiterCallback argument is false, the other arguments are ignored.

Member Function Documentation

§ Register()

void Register ( std::ostream *  outStream = &std::cout)

Registers the debug callback function. The callback function outputs the debug data to the given stream. Note that if the OpenGL context is not created in debug mode, OpenGL may not call the callback function. If there is a previously registered callback function, calling this function overwrites the previous callback registration.

§ Unregister()

void Unregister ( )

Unregisters the OpenGL debug callback function.

§ SetIgnoredTypes()

void SetIgnoredTypes ( bool  deprecated_behavior,
bool  portability,
bool  performance,
bool  other 

Sets which type of non-critical debug messages should be ignored. By default, no debug message type is ignored.

§ IgnoreNotifications()

void IgnoreNotifications ( bool  ignore = true)

Sets weather notification messages should be ignored.

§ Callback()

void _CY_APIENTRY Callback ( GLenum  source,
GLenum  type,
GLuint  id,
GLenum  severity,
GLsizei  length,
const GLchar *  message,
const void *  userParam 

This callback function that is called by OpenGL whenever there is a debug message. See the OpenGL documentation for glDebugMessageCallback for details. Placing the break point in this function allows easily identifying the OpenGL call that triggered the debug message (using the call stack).