Hello,
I am trying to catch OpenGL errors.
So, I wrote a class that do this job:
class OGLlog : public Log
{
public:
OGLlog(char* fn);
/**
* @brief returns 1 if an OpenGL error occurred, 0 otherwise
*/
static int printError(char* fn)
{
GLenum glErr;
int retCode = 0;
glErr = glGetError();
ofstream f(fn, ios::app);
if(f.is_open())
{
tm now;
time_t t;
time(&t);
now=*localtime(&t);
while (glErr != GL_NO_ERROR)
{
f<<now.tm_hour<<":"<<now.tm_min<<":"<<now.tm_sec<<" /!\\ GL ERROR: "<<gluErrorString(glErr)<<endl;
retCode = 1;
glErr = glGetError();
}
}
else return -1;
f.close();
return retCode;
}
};
And now, this is the problem: When I call the printError function, My program stays stuck in the while loop that check if an ogl error remains!
I always have the opengl invalid operation error.
The more strange is that error occurs, even in the beginning of my program, where I did not call any opengl function!
I think that a fresh eye will see the big mistake I have made!
Thanks a lot.