checkGLError.h
Go to the documentation of this file.
00001 /****************************************************************************
00002 * MeshLab                                                           o o     *
00003 * An extendible mesh processor                                    o     o   *
00004 *                                                                _   O  _   *
00005 * Copyright(C) 2005, 2009                                          \/)\/    *
00006 * Visual Computing Lab                                            /\/|      *
00007 * ISTI - Italian National Research Council                           |      *
00008 *                                                                    \      *
00009 * All rights reserved.                                                      *
00010 *                                                                           *
00011 * This program is free software; you can redistribute it and/or modify      *
00012 * it under the terms of the GNU General Public License as published by      *
00013 * the Free Software Foundation; either version 2 of the License, or         *
00014 * (at your option) any later version.                                       *
00015 *                                                                           *
00016 * This program is distributed in the hope that it will be useful,           *
00017 * but WITHOUT ANY WARRANTY; without even the implied warranty of            *
00018 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the             *
00019 * GNU General Public License (http://www.gnu.org/licenses/gpl.txt)          *
00020 * for more details.                                                         *
00021 *                                                                           *
00022 ****************************************************************************/
00023 
00024 #pragma once
00025 #include <QMessageBox>
00026 class checkGLError
00027 {
00028 public:
00029   static QString makeString(const char* m)
00030   {
00031     QString message(m);
00032 
00033     switch(glGetError()) {
00034     case GL_NO_ERROR: return QString();
00035 
00036     case GL_INVALID_ENUM:                     message+=("invalid enum");                  break;
00037     case GL_INVALID_VALUE:                    message+=("invalid value");                 break;
00038     case GL_INVALID_OPERATION:                message+=("invalid operation");             break;
00039     case GL_STACK_OVERFLOW:                   message+=("stack overflow");                break;
00040     case GL_STACK_UNDERFLOW:                  message+=("stack underflow");               break;
00041     case GL_OUT_OF_MEMORY:                    message+=("out of memory");                 break;
00042     case GL_INVALID_FRAMEBUFFER_OPERATION:    message+=("invalid framebuffer operation"); break;
00043     }
00044     return message;
00045   }
00046 
00047   static void debugInfo(const char* m) {
00048     QString message=makeString(m);
00049     if(message.isEmpty()) return;
00050     ::qDebug("%s",qPrintable(message));
00051   }
00052 
00053   static void QMessageBox(const char* m, const char* title) {
00054     QString message=makeString(m);
00055     QMessageBox::warning(0, title,message);
00056   }
00057   static void QMessageBox(const char* m) {QMessageBox(m,"GL error");}
00058 };
00059 


shape_reconstruction
Author(s): Roberto Martín-Martín
autogenerated on Sat Jun 8 2019 18:29:21