Graphics‎ > ‎Graphic API‎ > ‎

Debug Graphics

This page contains ideas and how to debug graphic's issues. It a shared page for all API's.

Get Error Message
In openGL use glGetError() to get any error flag that is set. If all is fine it returns GL_NO_ERROR ( 0 ). The OpenGL documentation list for each function what error codes it can set. The call to glGetError also clears the error flag.

Debugging Shader Output
One way to debug shaders it to send different values out as the Fragment color so it is possible to see them. For example by sending out the normals as the rgb color.

Debug Framebuffer's
If more then one framebuffer is used it is good to be able to switch between them. One useful way is to add support to show FBO's in small viewports in the main window.

Graphical Debuggers
A graphical debugger let's you run your game and it captures all the call your program does to the graphical API. Then you can pause your game and inspect all the calls, look at the shaders, textures and other thing. The list of them is found in the Tools section.