mirror of https://github.com/CGAL/cgal
Re-implementation of opengl_check_errors
This commit is contained in:
parent
ca841c9623
commit
b99c616c23
|
|
@ -41,6 +41,11 @@ CGAL_QT_EXPORT void traverse_resources(const QString& name,
|
||||||
const QString& dirname = QString(),
|
const QString& dirname = QString(),
|
||||||
int indent = 0);
|
int indent = 0);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Call this in the end of an OpenGL implementation to check if it returns errors.
|
||||||
|
*/
|
||||||
|
CGAL_QT_EXPORT void opengl_check_errors(unsigned int line);
|
||||||
|
|
||||||
} // namespace Qt
|
} // namespace Qt
|
||||||
} // namespace CGAL
|
} // namespace CGAL
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -27,9 +27,8 @@
|
||||||
|
|
||||||
#include <CGAL/Qt/debug.h>
|
#include <CGAL/Qt/debug.h>
|
||||||
#include <QDir>
|
#include <QDir>
|
||||||
|
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
|
#include <GL/gl.h>
|
||||||
namespace CGAL {
|
namespace CGAL {
|
||||||
namespace Qt {
|
namespace Qt {
|
||||||
|
|
||||||
|
|
@ -56,5 +55,28 @@ void traverse_resources(const QString& name, const QString& dirname, int indent)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
CGAL_INLINE_FUNCTION
|
||||||
|
void opengl_check_errors(unsigned int line)
|
||||||
|
{
|
||||||
|
GLenum error = ::glGetError();
|
||||||
|
while (error != GL_NO_ERROR)
|
||||||
|
{
|
||||||
|
if(error == GL_INVALID_ENUM)
|
||||||
|
std::cerr << "An unacceptable value is specified for an enumerated argument." << "@" << line << std::endl;
|
||||||
|
if(error == GL_INVALID_VALUE)
|
||||||
|
std::cerr << "A numeric argument is out of range." << "@" << line << std::endl;
|
||||||
|
if(error == GL_INVALID_OPERATION)
|
||||||
|
std::cerr << "The specified operation is not allowed in the current state." << "@" << line << std::endl;
|
||||||
|
if(error == GL_INVALID_FRAMEBUFFER_OPERATION)
|
||||||
|
std::cerr << "The framebuffer object is not complete." << "@" << line << std::endl;
|
||||||
|
if(error == GL_OUT_OF_MEMORY)
|
||||||
|
std::cerr << "There is not enough memory left to execute the command." << "@" << line << std::endl;
|
||||||
|
if(error == GL_STACK_UNDERFLOW)
|
||||||
|
std::cerr << "An attempt has been made to perform an operation that would cause an internal stack to underflow." << "@" << line << std::endl;
|
||||||
|
if(error == GL_STACK_OVERFLOW)
|
||||||
|
std::cerr << "An attempt has been made to perform an operation that would cause an internal stack to overflow." << "@" << line << std::endl;
|
||||||
|
error = ::glGetError();
|
||||||
|
}
|
||||||
|
}
|
||||||
} // namesapce Qt
|
} // namesapce Qt
|
||||||
} // namespace CGAL
|
} // namespace CGAL
|
||||||
|
|
|
||||||
|
|
@ -13,28 +13,12 @@
|
||||||
#include <QOpenGLVertexArrayObject>
|
#include <QOpenGLVertexArrayObject>
|
||||||
#include <QOpenGLBuffer>
|
#include <QOpenGLBuffer>
|
||||||
#include <QOpenGLShaderProgram>
|
#include <QOpenGLShaderProgram>
|
||||||
|
#include <CGAL/Qt/debug.h>
|
||||||
|
|
||||||
#if !defined(NDEBUG)
|
#if !defined(NDEBUG)
|
||||||
inline
|
inline
|
||||||
void printGlError(unsigned int line) {
|
void printGlError(unsigned int line) {
|
||||||
GLenum error = glGetError();
|
CGAL::Qt::opengl_check_errors(line);
|
||||||
if(error != GL_NO_ERROR)
|
|
||||||
{
|
|
||||||
if(error == GL_INVALID_ENUM)
|
|
||||||
std::cerr << "An unacceptable value is specified for an enumerated argument." << "@" << line << std::endl;
|
|
||||||
if(error == GL_INVALID_VALUE)
|
|
||||||
std::cerr << "A numeric argument is out of range." << "@" << line << std::endl;
|
|
||||||
if(error == GL_INVALID_OPERATION)
|
|
||||||
std::cerr << "The specified operation is not allowed in the current state." << "@" << line << std::endl;
|
|
||||||
if(error == GL_INVALID_FRAMEBUFFER_OPERATION)
|
|
||||||
std::cerr << "The framebuffer object is not complete." << "@" << line << std::endl;
|
|
||||||
if(error == GL_OUT_OF_MEMORY)
|
|
||||||
std::cerr << "There is not enough memory left to execute the command." << "@" << line << std::endl;
|
|
||||||
if(error == GL_STACK_UNDERFLOW)
|
|
||||||
std::cerr << "An attempt has been made to perform an operation that would cause an internal stack to underflow." << "@" << line << std::endl;
|
|
||||||
if(error == GL_STACK_OVERFLOW)
|
|
||||||
std::cerr << "An attempt has been made to perform an operation that would cause an internal stack to overflow." << "@" << line << std::endl;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
inline
|
inline
|
||||||
|
|
|
||||||
|
|
@ -14,31 +14,14 @@
|
||||||
#include <QOpenGLBuffer>
|
#include <QOpenGLBuffer>
|
||||||
#include <QOpenGLShaderProgram>
|
#include <QOpenGLShaderProgram>
|
||||||
#include <CGAL/Three/Viewer_interface.h>
|
#include <CGAL/Three/Viewer_interface.h>
|
||||||
|
#include <CGAL/Qt/debug.h>
|
||||||
|
|
||||||
using namespace CGAL::Three;
|
using namespace CGAL::Three;
|
||||||
|
|
||||||
#if !defined(NDEBUG)
|
#if !defined(NDEBUG)
|
||||||
inline
|
inline
|
||||||
void printGlError(unsigned int line) {
|
void printGlError(unsigned int line) {
|
||||||
GLenum error = glGetError();
|
CGAL::Qt::opengl_check_errors(line);
|
||||||
if(error != GL_NO_ERROR)
|
|
||||||
{
|
|
||||||
if(error == GL_INVALID_ENUM)
|
|
||||||
std::cerr << "An unacceptable value is specified for an enumerated argument." << "@" << line << std::endl;
|
|
||||||
if(error == GL_INVALID_VALUE)
|
|
||||||
std::cerr << "A numeric argument is out of range." << "@" << line << std::endl;
|
|
||||||
if(error == GL_INVALID_OPERATION)
|
|
||||||
std::cerr << "The specified operation is not allowed in the current state." << "@" << line << std::endl;
|
|
||||||
if(error == GL_INVALID_FRAMEBUFFER_OPERATION)
|
|
||||||
std::cerr << "The framebuffer object is not complete." << "@" << line << std::endl;
|
|
||||||
if(error == GL_OUT_OF_MEMORY)
|
|
||||||
std::cerr << "There is not enough memory left to execute the command." << "@" << line << std::endl;
|
|
||||||
if(error == GL_STACK_UNDERFLOW)
|
|
||||||
std::cerr << "An attempt has been made to perform an operation that would cause an internal stack to underflow." << "@" << line << std::endl;
|
|
||||||
if(error == GL_STACK_OVERFLOW)
|
|
||||||
std::cerr << "An attempt has been made to perform an operation that would cause an internal stack to overflow." << "@" << line << std::endl;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
inline
|
inline
|
||||||
|
|
|
||||||
|
|
@ -33,8 +33,8 @@
|
||||||
#include <CGAL/Surface_mesher/Implicit_surface_oracle_3.h>
|
#include <CGAL/Surface_mesher/Implicit_surface_oracle_3.h>
|
||||||
#include <CGAL/Surface_mesher/Vertices_on_the_same_psc_element_criterion.h>
|
#include <CGAL/Surface_mesher/Vertices_on_the_same_psc_element_criterion.h>
|
||||||
#include <CGAL/IO/Complex_2_in_triangulation_3_file_writer.h>
|
#include <CGAL/IO/Complex_2_in_triangulation_3_file_writer.h>
|
||||||
|
|
||||||
#include <CGAL/make_surface_mesh.h>
|
#include <CGAL/make_surface_mesh.h>
|
||||||
|
#include <CGAL/Qt/debug.h>
|
||||||
|
|
||||||
struct Threshold : public std::unary_function<FT, unsigned char> {
|
struct Threshold : public std::unary_function<FT, unsigned char> {
|
||||||
double isovalue;
|
double isovalue;
|
||||||
|
|
@ -1516,24 +1516,7 @@ void Volume::gl_draw_marchingcube()
|
||||||
}
|
}
|
||||||
if(!list_draw_marching_cube_is_valid)
|
if(!list_draw_marching_cube_is_valid)
|
||||||
{
|
{
|
||||||
GLenum error = ::glGetError();
|
CGAL::Qt::opengl_check_errors();
|
||||||
if(error != GL_NO_ERROR)
|
|
||||||
{
|
|
||||||
if(error == GL_INVALID_ENUM)
|
|
||||||
std::cerr << "An unacceptable value is specified for an enumerated argument." << "@" << line << std::endl;
|
|
||||||
if(error == GL_INVALID_VALUE)
|
|
||||||
std::cerr << "A numeric argument is out of range." << "@" << line << std::endl;
|
|
||||||
if(error == GL_INVALID_OPERATION)
|
|
||||||
std::cerr << "The specified operation is not allowed in the current state." << "@" << line << std::endl;
|
|
||||||
if(error == GL_INVALID_FRAMEBUFFER_OPERATION)
|
|
||||||
std::cerr << "The framebuffer object is not complete." << "@" << line << std::endl;
|
|
||||||
if(error == GL_OUT_OF_MEMORY)
|
|
||||||
std::cerr << "There is not enough memory left to execute the command." << "@" << line << std::endl;
|
|
||||||
if(error == GL_STACK_UNDERFLOW)
|
|
||||||
std::cerr << "An attempt has been made to perform an operation that would cause an internal stack to underflow." << "@" << line << std::endl;
|
|
||||||
if(error == GL_STACK_OVERFLOW)
|
|
||||||
std::cerr << "An attempt has been made to perform an operation that would cause an internal stack to overflow." << "@" << line << std::endl;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue