StelOpenGL.cpp   StelOpenGL.cpp 
skipping to change at line 19 skipping to change at line 19
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software * along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Suite 500, Boston, MA 02110-1335, USA. * Foundation, Inc., 51 Franklin Street, Suite 500, Boston, MA 02110-1335, USA.
*/ */
#include <cstdio>
#include "StelOpenGL.hpp" #include "StelOpenGL.hpp"
#include <QDebug>
const char* getGLErrorText(int code) { QOpenGLContext* StelOpenGL::mainContext = NULL;
const char* StelOpenGL::getGLErrorText(GLenum code) {
switch (code) { switch (code) {
case GL_INVALID_ENUM: case GL_INVALID_ENUM:
return "GL_INVALID_ENUM"; return "GL_INVALID_ENUM";
case GL_INVALID_FRAMEBUFFER_OPERATION: case GL_INVALID_FRAMEBUFFER_OPERATION:
return "GL_INVALID_FRAMEBUFFER_OPERATION"; return "GL_INVALID_FRAMEBUFFER_OPERATION";
case GL_INVALID_VALUE: case GL_INVALID_VALUE:
return "GL_INVALID_VALUE"; return "GL_INVALID_VALUE";
case GL_INVALID_OPERATION: case GL_INVALID_OPERATION:
return "GL_INVALID_OPERATION"; return "GL_INVALID_OPERATION";
case GL_OUT_OF_MEMORY: case GL_OUT_OF_MEMORY:
return "GL_OUT_OF_MEMORY"; return "GL_OUT_OF_MEMORY";
default: default:
return "undefined error"; return "unknown GL error type";
} }
} }
int checkGLErrors(const char *file, int line) int StelOpenGL::checkGLErrors(const char *file, int line)
{ {
int errors = 0; int errors = 0;
while (true) for(GLenum x; (x=mainContext->functions()->glGetError())!=GL_NO_ERRO R; )
{ {
GLenum x = glGetError(); ++errors;
if (x == GL_NO_ERROR) qCritical("%s:%d: OpenGL error: %d (%s)\n",
return errors; file, line, x, getGLErrorText(x));
printf("%s:%d: OpenGL error: %d (%s)\n",
file, line, x, getGLErrorText(x));
errors++;
} }
return errors;
}
void StelOpenGL::clearGLErrors()
{
while(mainContext->functions()->glGetError()!=GL_NO_ERROR)
{ }
} }
 End of changes. 8 change blocks. 
11 lines changed or deleted 17 lines changed or added

This html diff was produced by rfcdiff 1.41. The latest version is available from http://tools.ietf.org/tools/rfcdiff/