| 1 | /* OGLDebug.h |
| 2 | Copyright (C) 2009 Richard Goedeken |
| 3 | |
| 4 | This program is free software; you can redistribute it and/or |
| 5 | modify it under the terms of the GNU General Public License |
| 6 | as published by the Free Software Foundation; either version 2 |
| 7 | of the License, or (at your option) any later version. |
| 8 | |
| 9 | This program is distributed in the hope that it will be useful, |
| 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 12 | GNU General Public License for more details. |
| 13 | |
| 14 | You should have received a copy of the GNU General Public License |
| 15 | along with this program; if not, write to the Free Software |
| 16 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
| 17 | */ |
| 18 | |
| 19 | #if !defined(OPENGL_DEBUG_H) |
| 20 | #define OPENGL_DEBUG_H |
| 21 | |
| 22 | #if defined(OPENGL_DEBUG) |
| 23 | #define OPENGL_CHECK_ERRORS { const GLenum errcode = glGetError(); if (errcode != GL_NO_ERROR) fprintf(stderr, "OpenGL Error code %i in '%s' line %i\n", errcode, __FILE__, __LINE__-1); } |
| 24 | #else |
| 25 | #define OPENGL_CHECK_ERRORS |
| 26 | #endif |
| 27 | |
| 28 | /* Dump client state (for informational purposes) |
| 29 | int rval = 0; |
| 30 | void *ptr; |
| 31 | glGetIntegerv(GL_ARRAY_BUFFER_BINDING, &rval); |
| 32 | printf("GL_ARRAY_BUFFER_BINDING: %i\n", rval); |
| 33 | glGetPointerv(GL_COLOR_ARRAY_POINTER, &ptr); |
| 34 | printf("GL_COLOR_ARRAY: %i (%lx)\n", (int) glIsEnabled(GL_COLOR_ARRAY), (int) ptr); |
| 35 | glGetPointerv(GL_FOG_COORD_ARRAY_POINTER, &ptr); |
| 36 | printf("GL_FOG_COORDINATE_ARRAY_EXT: %i (%lx)\n", (int) glIsEnabled(GL_FOG_COORDINATE_ARRAY_EXT), (int) ptr); |
| 37 | glGetPointerv(GL_INDEX_ARRAY_POINTER, &ptr); |
| 38 | printf("GL_INDEX_ARRAY: %i (%lx)\n", (int) glIsEnabled(GL_INDEX_ARRAY), (int) ptr); |
| 39 | glGetPointerv(GL_NORMAL_ARRAY_POINTER, &ptr); |
| 40 | printf("GL_NORMAL_ARRAY: %i (%lx)\n", (int) glIsEnabled(GL_NORMAL_ARRAY), (int) ptr); |
| 41 | glGetPointerv(GL_SECONDARY_COLOR_ARRAY_POINTER, &ptr); |
| 42 | printf("GL_SECONDARY_COLOR_ARRAY: %i (%lx)\n", (int) glIsEnabled(GL_SECONDARY_COLOR_ARRAY), (int) ptr); |
| 43 | glGetPointerv(GL_TEXTURE_COORD_ARRAY_POINTER, &ptr); |
| 44 | printf("GL_TEXTURE_COORD_ARRAY: %i (%lx)\n", (int) glIsEnabled(GL_TEXTURE_COORD_ARRAY), (int) ptr); |
| 45 | glGetPointerv(GL_VERTEX_ARRAY_POINTER, &ptr); |
| 46 | printf("GL_VERTEX_ARRAY: %i (%lx)\n", (int) glIsEnabled(GL_VERTEX_ARRAY), (int) ptr); |
| 47 | */ |
| 48 | |
| 49 | #endif /* OPENGL_DEBUG_H */ |