Difference between revisions of "Example/OpenGL Error Testing"

From OpenGL Wiki
Jump to: navigation, search
(Error testing code snippet.)
 
(Still attempting to fix syntax highlighting.)
 
(2 intermediate revisions by 2 users not shown)
Line 1: Line 1:
 
A simple loop to extract the current OpenGL errors:
 
A simple loop to extract the current OpenGL errors:
  
<source lang=cpp>
+
<syntaxhighlight lang="cpp">
 
GLenum err;
 
GLenum err;
 
while((err = glGetError()) != GL_NO_ERROR)
 
while((err = glGetError()) != GL_NO_ERROR)
 
{
 
{
   //Process/log the error.
+
   // Process/log the error.
 
}
 
}
</source>
+
</syntaxhighlight>
 
<noinclude>[[Category:Example Code]]</noinclude>
 
<noinclude>[[Category:Example Code]]</noinclude>

Latest revision as of 02:27, 25 May 2020

A simple loop to extract the current OpenGL errors:

GLenum err;
while((err = glGetError()) != GL_NO_ERROR)
{
  // Process/log the error.
}