void checkGlError ( const char * title ) { const char * str = getGlErrorString (); if ( str != NULL ) printf ( "%s - OpenGL error: %s\n", title, str ); }
/*! * \brief This macro displays the error related to an OpenGL function * * \param p_where: Name of the function calling the GL function * \param p_op: Name of the GL function * */ void checkGlError(const char* p_where, const char* p_op) { #ifdef DEBUG for (GLint error = glGetError(); error; error = glGetError()) { LOGE(p_where<<":after "<<p_op<<":glError code:"<<getGlErrorString(error)); } #endif }
MyWindow () : GlutWindow ( 200, 100, 400, 400, "ARB_shader_atomic_counters" ) { glClearColor ( 0.5, 0.5, 0.5, 1.0 ); glEnable ( GL_DEPTH_TEST ); glDepthFunc ( GL_LEQUAL ); const char * err = getGlErrorString (); if ( !program.loadProgram ( "atomic-counters.glsl" ) ) { printf ( "Error building program: %s\n", program.getLog ().c_str () ); exit ( 2 ); } else printf ( "Shader loaded:\n%s\n", program.getLog ().c_str () ); mesh = createTorus ( 2, 4, 30, 30 ); counterBuf.create (); counterBuf.bindBase ( GL_ATOMIC_COUNTER_BUFFER, 0 ); // unbind ??? }