2 * Copyright 1993-2006 NVIDIA Corporation. All rights reserved.
6 * This source code is subject to NVIDIA ownership rights under U.S. and
7 * international Copyright laws.
9 * NVIDIA MAKES NO REPRESENTATION ABOUT THE SUITABILITY OF THIS SOURCE
10 * CODE FOR ANY PURPOSE. IT IS PROVIDED "AS IS" WITHOUT EXPRESS OR
11 * IMPLIED WARRANTY OF ANY KIND. NVIDIA DISCLAIMS ALL WARRANTIES WITH
12 * REGARD TO THIS SOURCE CODE, INCLUDING ALL IMPLIED WARRANTIES OF
13 * MERCHANTABILITY, NONINFRINGEMENT, AND FITNESS FOR A PARTICULAR PURPOSE.
14 * IN NO EVENT SHALL NVIDIA BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL,
15 * OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
16 * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
17 * OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE
18 * OR PERFORMANCE OF THIS SOURCE CODE.
20 * U.S. Government End Users. This source code is a "commercial item" as
21 * that term is defined at 48 C.F.R. 2.101 (OCT 1995), consisting of
22 * "commercial computer software" and "commercial computer software
23 * documentation" as such terms are used in 48 C.F.R. 12.212 (SEPT 1995)
24 * and is provided to the U.S. Government only as a commercial end item.
25 * Consistent with 48 C.F.R.12.212 and 48 C.F.R. 227.7202-1 through
26 * 227.7202-4 (JUNE 1995), all U.S. Government End Users acquire the
27 * source code with only those rights set forth herein.
30 #ifndef CUTIL_GL_ERROR
31 #define CUTIL_GL_ERROR
33 /* CUda UTility Library */
37 # define WINDOWS_LEAN_AND_MEAN
45 #if defined (__APPLE__) || defined(MACOSX)
46 #include <OpenGL/gl.h>
47 #include <OpenGL/glu.h>
53 ////////////////////////////////////////////////////////////////////////////
54 //! Check for OpenGL error
55 //! @return CUTTrue if no GL error has been encountered, otherwise 0
56 //! @param file __FILE__ macro
57 //! @param line __LINE__ macro
58 //! @note The GL error is listed on stderr
59 //! @note This function should be used via the CHECK_ERROR_GL() macro
60 ////////////////////////////////////////////////////////////////////////////
62 cutCheckErrorGL( const char* file, const int line)
64 CUTBoolean ret_val = CUTTrue;
67 GLenum gl_error = glGetError();
68 if (gl_error != GL_NO_ERROR)
70 fprintf(stderr, "GL Error in file '%s' in line %d :\n", file, line);
71 fprintf(stderr, "%s\n", gluErrorString(gl_error));
79 #define CUT_CHECK_ERROR_GL() \
80 if( CUTFalse == cutCheckErrorGL( __FILE__, __LINE__)) { \
86 #endif // CUTIL_GL_ERROR