c++ - glGetError returns 1282 infinitely -


here function logging errors:

void check_error(const char* st) {     glenum err(glgeterror());      while (err != gl_no_error)     {         cerr << "opengl error: " << err << " "<<st<<endl;         err = glgeterror();     }     cerr << "?\n"; } 

it's called way:

int _tmain(int argc, char* argv[]) {     check_error("start");     ... } 

it's not called anywhere else.

it produces: opengl error 1282 start in infinite loop.

here includes:

#include <opencv2/highgui/highgui.hpp> #include <opencv2/opencv.hpp> #include <stdio.h> #include <stdlib.h> #include <fstream> #include <gl/glew.h> #include <gl/glut.h> #include <gl/glfw3.h> #include <glm/glm.hpp> #include <glm/gtc/matrix_transform.hpp> 

visual studio 2013

this isn't direct answer; in lieu of comment, have function in gl library:

glenum g0::glflusherror () // noexcept {     glenum ret = glgeterror();      if (ret != gl_no_error)     {         gluint finite = 255; // (watchdog count)         glenum gl_err = ret;          while (gl_err != gl_no_error && finite--)             gl_err = glgeterror();          if (gl_err != gl_no_error)             g0::terminate("glgeterror: reset failed\n");     }      return ret; } 

where g0 library's namespace. when want test recent gl error - , clear - glgeterror needs called in loop. it's 'expensive' call, stalls pipeline, , therefore should used in 'setup' code, or during debugging.


Comments