Main Page   Modules   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members   Related Pages  

GLContext.h

Go to the documentation of this file.
00001 // Copyright NVIDIA Corporation 2002-2004
00002 // TO THE MAXIMUM EXTENT PERMITTED BY APPLICABLE LAW, THIS SOFTWARE IS PROVIDED
00003 // *AS IS* AND NVIDIA AND ITS SUPPLIERS DISCLAIM ALL WARRANTIES, EITHER EXPRESS
00004 // OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY
00005 // AND FITNESS FOR A PARTICULAR PURPOSE.  IN NO EVENT SHALL NVIDIA OR ITS SUPPLIERS
00006 // BE LIABLE FOR ANY SPECIAL, INCIDENTAL, INDIRECT, OR CONSEQUENTIAL DAMAGES
00007 // WHATSOEVER (INCLUDING, WITHOUT LIMITATION, DAMAGES FOR LOSS OF BUSINESS PROFITS,
00008 // BUSINESS INTERRUPTION, LOSS OF BUSINESS INFORMATION, OR ANY OTHER PECUNIARY LOSS)
00009 // ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF NVIDIA HAS
00010 // BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES 
00011 
00012 #pragma once
00013 
00015 #include "nvsgcommon.h"
00016 
00017 #include "nvgl/nvgl.h"
00018 #include "nvutil/RCObject.h"
00019 #include "nvsg/Texture.h"
00020 #include <map>
00021 #include <string>
00022 #include <algorithm>
00023 #include <utility>
00024 
00025 namespace nvgl
00026 {
00027 class GLFunctions;
00028 class GLObjects;
00029 
00030 // common device context helper function for Windows and Linux
00031 #if defined(_WIN32)
00032 # define MAKE_CURRENT(DC,RC) WGLMakeCurrent(DC,RC)
00033 # define GET_CURRENT_DC()    WGLGetCurrentDC()
00034 # define GET_CURRENT_RC()    WGLGetCurrentContext()
00035 #elif defined(LINUX)
00036 # define MAKE_CURRENT(DC,RC) GLXMakeCurrent(glContext->getDisplay(),DC,RC)
00037 # define GET_CURRENT_RC()    GLXGetCurrentContext()
00038 # define GET_CURRENT_DC()    GLXGetCurrentDrawable()
00039 #else
00040 # error Undefined Operating System!  
00041 #endif
00042 
00044 class GLContext
00045 {
00046   friend NVSG_API void GLAccum( GLenum op, GLfloat value );
00047   friend NVSG_API void GLActiveTexture( GLenum texture );
00048   friend NVSG_API void GLAlphaFunc( GLenum func, GLclampf ref );
00049   friend NVSG_API GLboolean GLAreTexturesResident( GLsizei n, const GLuint *textures, GLboolean *residences );
00050   friend NVSG_API void GLArrayElement( GLint i );
00051   friend NVSG_API void GLBegin( GLenum mode );
00052   friend NVSG_API void GLBeginOcclusionQuery( GLuint id );
00053   friend NVSG_API void GLBindBufferARB(GLenum target, GLuint id);
00054   friend NVSG_API void GLBufferDataARB( GLenum target, GLsizeiptrARB size, const GLvoid *data, GLenum usage );
00055   friend NVSG_API void GLBufferSubDataARB( GLenum target, GLintptrARB offset, GLsizeiptrARB size, const GLvoid *data );
00056   friend NVSG_API void GLDeleteBuffersARB( GLsizei n, const GLuint *buffers );
00057   friend NVSG_API void GLGenBuffersARB( GLsizei n, GLuint *buffers );
00058   friend NVSG_API GLvoid* GLMapBufferARB( GLenum target, GLenum access );
00059   friend NVSG_API GLboolean GLUnmapBufferARB( GLenum target );
00060   friend NVSG_API GLboolean GLIsBufferARB( GLuint name );
00061   friend NVSG_API void GLBindProgram( GLenum target, GLuint id );
00062   friend NVSG_API void GLBitmap( GLsizei width, GLsizei height, GLfloat xorig, GLfloat yorig, GLfloat xmove, GLfloat ymove, const GLubyte *bitmap );
00063   friend NVSG_API void GLBlendFunc( GLenum sfactor, GLenum dfactor );
00064   friend NVSG_API void GLBindTexture( GLenum target, GLuint texture );
00065   friend NVSG_API void GLCallList( GLuint list );
00066   friend NVSG_API void GLCallLists( GLsizei n, GLenum type, const GLvoid *lists );
00067   friend NVSG_API void GLClear( GLbitfield mask );
00068   friend NVSG_API void GLClearAccum( GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha );
00069   friend NVSG_API void GLClearColor( GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha );
00070   friend NVSG_API void GLClearDepth( GLclampd depth );
00071   friend NVSG_API void GLClearIndex( GLfloat c );
00072   friend NVSG_API void GLClearStencil( GLint s );
00073   friend NVSG_API void GLClientActiveTexture( GLenum texture );
00074   friend NVSG_API void GLClipPlane( GLenum plane, const GLdouble *equation );
00075   friend NVSG_API void GLColor3b( GLbyte red, GLbyte green, GLbyte blue );
00076   friend NVSG_API void GLColor3d( GLdouble red, GLdouble green, GLdouble blue );
00077   friend NVSG_API void GLColor3f( GLfloat red, GLfloat green, GLfloat blue );
00078   friend NVSG_API void GLColor3fv( const GLfloat * v );
00079   friend NVSG_API void GLColor3i( GLint red, GLint green, GLint blue );
00080   friend NVSG_API void GLColor3s( GLshort red, GLshort green, GLshort blue );
00081   friend NVSG_API void GLColor3ub( GLubyte red, GLubyte green, GLubyte blue );
00082   friend NVSG_API void GLColor3ui( GLuint red, GLuint green, GLuint blue );
00083   friend NVSG_API void GLColor3us( GLushort red, GLushort green, GLushort blue );
00084   friend NVSG_API void GLColor4b( GLbyte red, GLbyte green, GLbyte blue, GLbyte alpha );
00085   friend NVSG_API void GLColor4d( GLdouble red, GLdouble green, GLdouble blue, GLdouble alpha );
00086   friend NVSG_API void GLColor4f( GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha );
00087   friend NVSG_API void GLColor4i( GLint red, GLint green, GLint blue, GLint alpha );
00088   friend NVSG_API void GLColor4s( GLshort red, GLshort green, GLshort blue, GLshort alpha );
00089   friend NVSG_API void GLColor4ub( GLubyte red, GLubyte green, GLubyte blue, GLubyte alpha );
00090   friend NVSG_API void GLColor4ui( GLuint red, GLuint green, GLuint blue, GLuint alpha );
00091   friend NVSG_API void GLColor4us( GLushort red, GLushort green, GLushort blue, GLushort alpha );
00092   friend NVSG_API void GLColorMask( GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha );
00093   friend NVSG_API void GLColorMaterial( GLenum face, GLenum mode );
00094   friend NVSG_API void GLColorPointer( GLint size, GLenum type, GLsizei stride, const GLvoid *pointer );
00095   friend NVSG_API void GLCompressedTexImage1D( GLenum target, int level, GLenum internalformat, GLsizei width, int border, GLsizei imageSize, const void *data );
00096   friend NVSG_API void GLCompressedTexImage2D( GLenum target, int level, GLenum internalformat, GLsizei width, GLsizei height, int border, GLsizei imageSize, const void *data );
00097   friend NVSG_API void GLCompressedTexImage3D( GLenum target, int level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, int border, GLsizei imageSize, const void *data );
00098   friend NVSG_API void GLCopyPixels( GLint x, GLint y, GLsizei width, GLsizei height, GLenum type );
00099   friend NVSG_API void GLCopyTexImage1D( GLenum target, GLint level, GLenum internalFormat, GLint x, GLint y, GLsizei width, GLint border );
00100   friend NVSG_API void GLCopyTexImage2D( GLenum target, GLint level, GLenum internalFormat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border );
00101   friend NVSG_API void GLCopyTexSubImage1D( GLenum target, GLint level, GLint xoffset, GLint x, GLint y, GLsizei width );
00102   friend NVSG_API void GLCopyTexSubImage2D( GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height );
00103   friend NVSG_API void GLCullFace( GLenum mode );
00104   friend NVSG_API void GLDeleteLists( GLuint list, GLsizei range );
00105   friend NVSG_API void GLDeleteOcclusionQueries( GLsizei n, const GLuint *ids );
00106   friend NVSG_API void GLDeletePrograms( GLsizei n, const GLuint *ids );
00107   friend NVSG_API void GLDeleteQueries( GLsizei n, const GLuint *ids );
00108   friend NVSG_API void GLDeleteTextures( GLsizei n, const GLuint *textures );
00109   friend NVSG_API void GLDepthFunc( GLenum func );
00110   friend NVSG_API void GLDepthMask( GLboolean flag );
00111   friend NVSG_API void GLDepthRange( GLclampd znear, GLclampd zfar );
00112   friend NVSG_API void GLDisable( GLenum cap );
00113   friend NVSG_API void GLDisableClientState( GLenum array );
00114   friend NVSG_API void GLDrawArrays( GLenum mode, GLint first, GLsizei count );
00115   friend NVSG_API void GLDrawBuffer( GLenum mode );
00116   friend NVSG_API void GLDrawElements( GLenum mode, GLsizei count, GLenum type, const GLvoid *indices );
00117   friend NVSG_API void GLMultiDrawElements( GLenum mode, const GLsizei *count, GLenum type, const GLvoid* *indices, GLsizei primcount );
00118   friend NVSG_API void GLDrawPixels( GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *pixels );
00119   friend NVSG_API void GLDrawRangeElements( GLenum mode, GLuint start, GLuint end, GLsizei count, GLenum type, const GLvoid *indices );
00120   friend NVSG_API void GLEdgeFlagPointer( GLsizei stride, const GLboolean *pointer );
00121   friend NVSG_API void GLEdgeFlag( GLboolean flag );
00122   friend NVSG_API void GLEdgeFlagv( const GLboolean *flag );
00123   friend NVSG_API void GLEnable( GLenum cap );
00124   friend NVSG_API void GLEnableClientState( GLenum array );
00125   friend NVSG_API void GLEnd( void );
00126   friend NVSG_API void GLEndList( void );
00127   friend NVSG_API void GLEndOcclusionQuery( void );
00128   friend NVSG_API void GLEvalCoord1d( GLdouble u );
00129   friend NVSG_API void GLEvalCoord1f( GLfloat u );
00130   friend NVSG_API void GLEvalCoord2d( GLdouble u, GLdouble v );
00131   friend NVSG_API void GLEvalCoord2f( GLfloat u, GLfloat v );
00132   friend NVSG_API void GLEvalMesh1( GLenum mode, GLint i1, GLint i2 );
00133   friend NVSG_API void GLEvalMesh2( GLenum mode, GLint i1, GLint i2, GLint j1, GLint j2 );
00134   friend NVSG_API void GLEvalPoint1( GLint i );
00135   friend NVSG_API void GLEvalPoint2( GLint i, GLint j );
00136   friend NVSG_API void GLFeedbackBuffer( GLsizei size, GLenum type, GLfloat *buffer );
00137   friend NVSG_API void GLFinish( void );
00138   friend NVSG_API void GLFlush( void );
00139   friend NVSG_API void GLFogCoordPointer( GLenum type, GLsizei stride, const GLvoid *pointer );
00140   friend NVSG_API void GLFogf( GLenum pname, GLfloat param );
00141   friend NVSG_API void GLFogfv( GLenum pname, const GLfloat *params );
00142   friend NVSG_API void GLFogi( GLenum pname, GLint param );
00143   friend NVSG_API void GLFogiv( GLenum pname, const GLint *params );
00144   friend NVSG_API void GLFrontFace( GLenum mode );
00145   friend NVSG_API void GLFrustum( GLdouble left, GLdouble right, GLdouble bottom, GLdouble top, GLdouble zNear, GLdouble zFar );
00146   friend NVSG_API GLuint GLGenLists( GLsizei range );
00147   friend NVSG_API void GLGenOcclusionQueries( GLsizei n, GLuint *ids );
00148   friend NVSG_API void GLGenPrograms( GLsizei n, GLuint *ids );
00149   friend NVSG_API void GLGenQueries( GLsizei n, GLuint *ids );
00150   friend NVSG_API void GLGenTextures( GLsizei n, GLuint *textures );
00151   friend NVSG_API void GLGetBooleanv( GLenum pname, GLboolean *params );
00152   friend NVSG_API void GLGetDoublev( GLenum pname, GLdouble *params );
00153   friend NVSG_API void GLGetFloatv( GLenum pname, GLfloat *params );
00154   friend NVSG_API void GLGetIntegerv( GLenum pname, GLint *params );
00155   friend NVSG_API void GLGetClipPlane( GLenum plane, GLdouble *equation );
00156   friend NVSG_API void GLGetLightfv( GLenum light, GLenum pname, GLfloat *params );
00157   friend NVSG_API void GLGetLightiv( GLenum light, GLenum pname, GLint *params );
00158   friend NVSG_API void GLGetMapdv( GLenum target, GLenum query, GLdouble *v );
00159   friend NVSG_API void GLGetMapfv( GLenum target, GLenum query, GLfloat *v );
00160   friend NVSG_API void GLGetMapiv( GLenum target, GLenum query, GLint *v );
00161   friend NVSG_API void GLGetMaterialfv( GLenum face, GLenum pname, GLfloat *params );
00162   friend NVSG_API void GLGetMaterialiv( GLenum face, GLenum pname, GLint *params );
00163   friend NVSG_API void GLGetOcclusionQueryuiv( GLuint id, GLenum pname, GLuint *params );
00164   friend NVSG_API void GLGetPixelMapfv( GLenum map, GLfloat *values );
00165   friend NVSG_API void GLGetPixelMapuiv( GLenum map, GLuint *values );
00166   friend NVSG_API void GLGetPixelMapusv( GLenum map, GLushort *values );
00167   friend NVSG_API void GLGetPointerv( GLenum pname, GLvoid* *params );
00168   friend NVSG_API void GLGetPolygonStipple( GLubyte *mask );
00169   friend NVSG_API const GLubyte * GLGetString( GLenum name );
00170   friend NVSG_API void GLGetTexEnvfv( GLenum target, GLenum pname, GLfloat *params );
00171   friend NVSG_API void GLGetTexEnviv( GLenum target, GLenum pname, GLint *params );
00172   friend NVSG_API void GLGetTexGendv( GLenum coord, GLenum pname, GLdouble *params );
00173   friend NVSG_API void GLGetTexGenfv( GLenum coord, GLenum pname, GLfloat *params );
00174   friend NVSG_API void GLGetTexGeniv( GLenum coord, GLenum pname, GLint *params );
00175   friend NVSG_API void GLGetTexImage( GLenum target, GLint level, GLenum format, GLenum type, GLvoid *pixels );
00176   friend NVSG_API void GLGetTexLevelParameterfv( GLenum target, GLint level, GLenum pname, GLfloat *params );
00177   friend NVSG_API void GLGetTexLevelParameteriv( GLenum target, GLint level, GLenum pname, GLint *params );
00178   friend NVSG_API void GLGetTexParameterfv( GLenum target, GLenum pname, GLfloat *params );
00179   friend NVSG_API void GLGetTexParameteriv( GLenum target, GLenum pname, GLint *params );
00180   friend NVSG_API void GLHint( GLenum target, GLenum mode );
00181   friend NVSG_API void GLIndexd( GLdouble c );
00182   friend NVSG_API void GLIndexf( GLfloat c );
00183   friend NVSG_API void GLIndexi( GLint c );
00184   friend NVSG_API void GLIndexMask( GLuint mask );
00185   friend NVSG_API void GLIndexPointer( GLenum type, GLsizei stride, const GLvoid *pointer );
00186   friend NVSG_API void GLIndexs( GLshort c );
00187   friend NVSG_API void GLIndexub( GLubyte c );
00188   friend NVSG_API void GLInitNames( void );
00189   friend NVSG_API void GLInterleavedArrays( GLenum format, GLsizei stride, const GLvoid *pointer );
00190   friend NVSG_API GLboolean GLIsEnabled( GLenum cap );
00191   friend NVSG_API GLboolean GLIsList( GLuint list );
00192   friend NVSG_API GLboolean GLIsOcclusionQuery( GLuint id );
00193   friend NVSG_API GLboolean GLIsProgram( GLuint id );
00194   friend NVSG_API GLboolean GLIsQuery( GLuint id );
00195   friend NVSG_API GLboolean GLIsTexture( GLuint texture );
00196   friend NVSG_API void GLLightf( GLenum light, GLenum pname, GLfloat param );
00197   friend NVSG_API void GLLightfv( GLenum light, GLenum pname, const GLfloat *params );
00198   friend NVSG_API void GLLighti( GLenum light, GLenum pname, GLint param );
00199   friend NVSG_API void GLLightiv( GLenum light, GLenum pname, GLint *params );
00200   friend NVSG_API void GLLightModelf( GLenum pname, GLfloat param );
00201   friend NVSG_API void GLLightModelfv( GLenum pname, const GLfloat *params );
00202   friend NVSG_API void GLLightModeli( GLenum pname, GLint param );
00203   friend NVSG_API void GLLightModeliv( GLenum pname, const GLint *params );
00204   friend NVSG_API void GLLineStipple( GLint factor, GLushort pattern );
00205   friend NVSG_API void GLLineWidth( GLfloat width );
00206   friend NVSG_API void GLListBase( GLuint base );
00207   friend NVSG_API void GLLoadIdentity( void );
00208   friend NVSG_API void GLLoadMatrixd( const GLdouble *m );
00209   friend NVSG_API void GLLoadMatrixf( const GLfloat *m );
00210   friend NVSG_API void GLLoadName( GLuint name );
00211   friend NVSG_API void GLLoadProgram( GLenum target, GLuint id, GLsizei len, const GLubyte *program );
00212   friend NVSG_API void GLLogicOp( GLenum opcode );
00213   friend NVSG_API void GLMap1d( GLenum target, GLdouble u1, GLdouble u2, GLint stride, GLint order, const GLdouble *points );
00214   friend NVSG_API void GLMap1f( GLenum target, GLfloat u1, GLfloat u2, GLint stride, GLint order, const GLfloat *points );
00215   friend NVSG_API void GLMap2d( GLenum target, GLdouble u1, GLdouble u2, GLint ustride, GLint uorder, GLdouble v1, GLdouble v2, GLint vstride, GLint vorder, const GLdouble *points );
00216   friend NVSG_API void GLMap2f( GLenum target, GLfloat u1, GLfloat u2, GLint ustride, GLint uorder, GLfloat v1, GLfloat v2, GLint vstride, GLint vorder, const GLfloat *points );
00217   friend NVSG_API void GLMapGrid1d( GLint un, GLdouble u1, GLdouble u2 );
00218   friend NVSG_API void GLMapGrid1f( GLint un, GLfloat u1, GLfloat u2 );
00219   friend NVSG_API void GLMapGrid2d( GLint un, GLdouble u1, GLdouble u2, GLint vn, GLdouble v1, GLdouble v2 );
00220   friend NVSG_API void GLMapGrid2f( GLint un, GLfloat u1, GLfloat u2, GLint vn, GLfloat v1, GLfloat v2 );
00221   friend NVSG_API void GLMaterialf( GLenum face, GLenum pname, const GLfloat param );
00222   friend NVSG_API void GLMaterialfv( GLenum face, GLenum pname, const GLfloat *params );
00223   friend NVSG_API void GLMateriali( GLenum face, GLenum pname, const GLint param );
00224   friend NVSG_API void GLMaterialiv( GLenum face, GLenum pname, const GLint *params );
00225   friend NVSG_API void GLMatrixMode( GLenum mode );
00226   friend NVSG_API void GLMultiTexCoord2f( GLenum texture, GLfloat tx, GLfloat ty );
00227   friend NVSG_API void GLMultMatrixd( const GLdouble *m );
00228   friend NVSG_API void GLMultMatrixf( const GLfloat *m );
00229   friend NVSG_API void GLNewList( GLuint list, GLenum mode );
00230   friend NVSG_API void GLNormal3b( GLbyte nx, GLbyte ny, GLbyte nz );
00231   friend NVSG_API void GLNormal3bv( const GLbyte *v );
00232   friend NVSG_API void GLNormal3d( GLdouble nx, GLdouble ny, GLdouble nz );
00233   friend NVSG_API void GLNormal3dv( const GLdouble *v );
00234   friend NVSG_API void GLNormal3f( GLfloat nx, GLfloat ny, GLfloat nz );
00235   friend NVSG_API void GLNormal3fv( const GLfloat *v );
00236   friend NVSG_API void GLNormal3i( GLint nx, GLint ny, GLint nz );
00237   friend NVSG_API void GLNormal3iv( const GLint *v );
00238   friend NVSG_API void GLNormal3s( GLshort nx, GLshort ny, GLshort nz );
00239   friend NVSG_API void GLNormal3sv( const GLshort *v );
00240   friend NVSG_API void GLNormalPointer( GLenum type, GLsizei stride, const GLvoid *pointer );
00241   friend NVSG_API void GLOrtho( GLdouble left, GLdouble right, GLdouble bottom, GLdouble top, GLdouble zNear, GLdouble zFar );
00242   friend NVSG_API void GLPassThrough( GLfloat token );
00243   friend NVSG_API void GLPixelMapfv( GLenum map, GLsizei mapsize, const GLfloat *values );
00244   friend NVSG_API void GLPixelMapuiv( GLenum map, GLsizei mapsize, const GLuint *values );
00245   friend NVSG_API void GLPixelMapusv( GLenum map, GLsizei mapsize, const GLushort *values );
00246   friend NVSG_API void GLPixelStoref( GLenum pname, GLfloat param );
00247   friend NVSG_API void GLPixelStorei( GLenum pname, GLint param );
00248   friend NVSG_API void GLPixelTransferf( GLenum pname, GLfloat param );
00249   friend NVSG_API void GLPixelTransferi( GLenum pname, GLint param );
00250   friend NVSG_API void GLPixelZoom( GLfloat xfactor, GLfloat yfactor );
00251   friend NVSG_API void GLPointSize( GLfloat size );
00252   friend NVSG_API void GLPolygonMode( GLenum face, GLenum mode );
00253   friend NVSG_API void GLPolygonOffset( GLfloat factor, GLfloat units );
00254   friend NVSG_API void GLPolygonStipple( const GLubyte *mask );
00255   friend NVSG_API void GLPopAttrib( void );
00256   friend NVSG_API void GLPopClientAttrib( void );
00257   friend NVSG_API void GLPopMatrix( void );
00258   friend NVSG_API void GLPopName( void );
00259   friend NVSG_API void GLPrioritizeTextures( GLsizei n, const GLuint *textures, const GLclampf *priorities );
00260   friend NVSG_API void GLProgramNamedParameter4f( GLuint id, GLsizei len, const GLubyte *name, GLfloat x, GLfloat y, GLfloat z, GLfloat w );
00261   friend NVSG_API void GLPushAttrib( GLbitfield mask );
00262   friend NVSG_API void GLPushClientAttrib( GLbitfield mask );
00263   friend NVSG_API void GLPushMatrix( void );
00264   friend NVSG_API void GLPushName( GLuint name );
00265   friend NVSG_API void GLRasterPos2d( GLdouble x, GLdouble y );
00266   friend NVSG_API void GLRasterPos2f( GLfloat x, GLfloat y );
00267   friend NVSG_API void GLRasterPos2i( GLint x, GLint y );
00268   friend NVSG_API void GLRasterPos2s( GLshort x, GLshort y );
00269   friend NVSG_API void GLRasterPos3d( GLdouble x, GLdouble y, GLdouble z );
00270   friend NVSG_API void GLRasterPos3f( GLfloat x, GLfloat y, GLfloat z );
00271   friend NVSG_API void GLRasterPos3i( GLint x, GLint y, GLint z );
00272   friend NVSG_API void GLRasterPos3s( GLshort x, GLshort y, GLshort z );
00273   friend NVSG_API void GLRasterPos4d( GLdouble x, GLdouble y, GLdouble z, GLdouble w );
00274   friend NVSG_API void GLRasterPos4f( GLfloat x, GLfloat y, GLfloat z, GLfloat w );
00275   friend NVSG_API void GLRasterPos4i( GLint x, GLint y, GLint z, GLint w );
00276   friend NVSG_API void GLRasterPos4s( GLshort x, GLshort y, GLshort z, GLshort w );
00277   friend NVSG_API void GLReadBuffer( GLenum mode );
00278   friend NVSG_API void GLReadPixels( GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLvoid *pixels );
00279   friend NVSG_API void GLRectd( GLdouble x1, GLdouble y1, GLdouble x2, GLdouble y2 );
00280   friend NVSG_API void GLRectf( GLfloat x1, GLfloat y1, GLfloat x2, GLfloat y2 );
00281   friend NVSG_API void GLRecti( GLint x1, GLint y1, GLint x2, GLint y2 );
00282   friend NVSG_API void GLRects( GLshort x1, GLshort y1, GLshort x2, GLshort y2 );
00283   friend NVSG_API void GLRenderMode( GLenum mode );
00284   friend NVSG_API void GLRotated( GLdouble angle, GLdouble x, GLdouble y, GLdouble z );
00285   friend NVSG_API void GLRotatef( GLfloat angle, GLfloat x, GLfloat y, GLfloat z );
00286   friend NVSG_API void GLScaled( GLdouble x, GLdouble y, GLdouble z );
00287   friend NVSG_API void GLScalef( GLfloat x, GLfloat y, GLfloat z );
00288   friend NVSG_API void GLScissor( GLint x, GLint y, GLsizei width, GLsizei height );
00289   friend NVSG_API void GLSecondaryColorPointer( GLint size, GLenum type, GLsizei stride, const GLvoid *pointer );
00290   friend NVSG_API void GLSelectBuffer( GLsizei size, GLuint *buffer );
00291   friend NVSG_API void GLSetWindowStereoMode( GLboolean displayMode );
00292   friend NVSG_API void GLShadeModel( GLenum mode );
00293   friend NVSG_API void GLStencilFunc( GLenum func, GLint ref, GLuint mask );
00294   friend NVSG_API void GLStencilMask( GLuint mask );
00295   friend NVSG_API void GLStencilOp( GLenum fail, GLenum zfail, GLenum zpass );
00296   friend NVSG_API void GLTexCoord1d( GLdouble s );
00297   friend NVSG_API void GLTexCoord1f( GLfloat s );
00298   friend NVSG_API void GLTexCoord1i( GLint s );
00299   friend NVSG_API void GLTexCoord1s( GLshort s );
00300   friend NVSG_API void GLTexCoord2d( GLdouble s, GLdouble t );
00301   friend NVSG_API void GLTexCoord2f( GLfloat s, GLfloat t );
00302   friend NVSG_API void GLTexCoord2fv( const GLfloat *v );
00303   friend NVSG_API void GLTexCoord2i( GLint s, GLint t );
00304   friend NVSG_API void GLTexCoord2s( GLshort s, GLshort t );
00305   friend NVSG_API void GLTexCoord3d( GLdouble s, GLdouble t, GLdouble r );
00306   friend NVSG_API void GLTexCoord3f( GLfloat s, GLfloat t, GLfloat r );
00307   friend NVSG_API void GLTexCoord3i( GLint s, GLint t, GLint r );
00308   friend NVSG_API void GLTexCoord3s( GLshort s, GLshort t, GLshort r );
00309   friend NVSG_API void GLTexCoord4d( GLdouble s, GLdouble t, GLdouble r, GLdouble q );
00310   friend NVSG_API void GLTexCoord4f( GLfloat s, GLfloat t, GLfloat r, GLfloat q );
00311   friend NVSG_API void GLTexCoord4i( GLint s, GLint t, GLint r, GLint q );
00312   friend NVSG_API void GLTexCoord4s( GLshort s, GLshort t, GLshort r, GLshort q );
00313   friend NVSG_API void GLTexCoordPointer( GLint size, GLenum type, GLsizei stride, const GLvoid *pointer );
00314   friend NVSG_API void GLTexEnvf( GLenum target, GLenum pname, GLfloat param );
00315   friend NVSG_API void GLTexEnvfv( GLenum target, GLenum pname, const GLfloat *params );
00316   friend NVSG_API void GLTexEnvi( GLenum target, GLenum pname, GLint param );
00317   friend NVSG_API void GLTexEnviv( GLenum target, GLenum pname, const GLint *params );
00318   friend NVSG_API void GLTexGend( GLenum coord, GLenum pname, GLdouble param );
00319   friend NVSG_API void GLTexGenf( GLenum coord, GLenum pname, GLfloat param );
00320   friend NVSG_API void GLTexGenfv( GLenum coord, GLenum pname, const GLfloat *param );
00321   friend NVSG_API void GLTexGeni( GLenum coord, GLenum pname, GLint param );
00322   friend NVSG_API void GLTexImage1D( GLenum target, GLint level, GLint internalformat, GLsizei width, GLint border, GLenum format, GLenum type, const GLvoid *pixels );
00323   friend NVSG_API void GLTexImage2D( GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const GLvoid *pixels );
00324   friend NVSG_API void GLTexImage3D( GLenum target, int level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, int border, GLenum format, GLenum type, const void* pixels);
00325   friend NVSG_API void GLTexParameterf( GLenum target, GLenum pname, GLfloat param );
00326   friend NVSG_API void GLTexParameteri( GLenum target, GLenum pname, GLint param );
00327   friend NVSG_API void GLTexParameterfv( GLenum target, GLenum pname, const GLfloat *params );
00328   friend NVSG_API void GLTexParameteriv( GLenum target, GLenum pname, const GLint *params );
00329   friend NVSG_API void GLTexSubImage1D( GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLenum type, const GLvoid *pixels );
00330   friend NVSG_API void GLTexSubImage2D( GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *pixels );
00331   friend NVSG_API void GLTranslated( GLdouble x, GLdouble y, GLdouble z );
00332   friend NVSG_API void GLTranslatef( GLfloat x, GLfloat y, GLfloat z );
00333   friend NVSG_API void GLVertex2d( GLdouble x, GLdouble y );
00334   friend NVSG_API void GLVertex2f( GLfloat x, GLfloat y );
00335   friend NVSG_API void GLVertex2i( GLint x, GLint y );
00336   friend NVSG_API void GLVertex2s( GLshort x, GLshort y );
00337   friend NVSG_API void GLVertex3d( GLdouble x, GLdouble y, GLdouble z );
00338   friend NVSG_API void GLVertex3f( GLfloat x, GLfloat y, GLfloat z );
00339   friend NVSG_API void GLVertex3fv( const GLfloat *v );
00340   friend NVSG_API void GLVertex3i( GLint x, GLint y, GLint z );
00341   friend NVSG_API void GLVertex3s( GLshort x, GLshort y, GLshort z );
00342   friend NVSG_API void GLVertex4d( GLdouble x, GLdouble y, GLdouble z, GLdouble w );
00343   friend NVSG_API void GLVertex4f( GLfloat x, GLfloat y, GLfloat z, GLfloat w );
00344   friend NVSG_API void GLVertex4i( GLint x, GLint y, GLint z, GLint w );
00345   friend NVSG_API void GLVertex4s( GLshort x, GLshort y, GLshort z, GLshort w );
00346   friend NVSG_API void GLVertexPointer( GLint size, GLenum type, GLsizei stride, const GLvoid *pointer );
00347   friend NVSG_API void GLViewport( GLint x, GLint y, GLsizei width, GLsizei height );
00348 #if defined(_WIN32)
00349   friend NVSG_API BOOL WGLBindTexImage( HPBUFFERARB hPbuffer, int iBuffer );
00350   friend NVSG_API BOOL WGLChoosePixelFormat( HDC hdc, const int *piAttribIList, const FLOAT *pfAttribFList, UINT nMaxFormats, int *piFormats, UINT *nNumFormats );
00351   friend NVSG_API HGLRC WGLCreateContext( HDC hdc );
00352   friend NVSG_API HPBUFFERARB WGLCreatePbuffer( HDC hdc, int pixelFormat, int width, int height, const int *attribList );
00353   friend NVSG_API BOOL WGLDeleteContext( HGLRC hglrc );
00354   friend NVSG_API BOOL WGLDestroyPbuffer( HPBUFFERARB hPbuffer );
00355   friend NVSG_API HGLRC WGLGetCurrentContext(void);
00356   friend NVSG_API HDC WGLGetCurrentDC(void);
00357   friend NVSG_API BOOL WGLMakeCurrent( HDC hdc, HGLRC hglrc );
00358   friend NVSG_API HDC WGLGetPbufferDC( HPBUFFERARB hPbuffer );
00359   friend NVSG_API BOOL WGLQueryPbuffer( HPBUFFERARB hPbuffer, int attribute, int *value );
00360   friend NVSG_API int WGLReleasePbufferDC( HPBUFFERARB hPbuffer, HDC hdc );
00361   friend NVSG_API BOOL WGLReleaseTexImage( HPBUFFERARB hPbuffer, int iBuffer );
00362   friend NVSG_API BOOL WGLShareLists( HGLRC hglrc1, HGLRC hglrc2 );
00363   friend NVSG_API BOOL WGLJoinSwapGroupNV(HDC hDC, GLuint group);
00364   friend NVSG_API BOOL WGLBindSwapBarrierNV(GLuint group, GLuint barrier);
00365   friend NVSG_API BOOL WGLQuerySwapGroupNV(HDC hDC, GLuint * group, GLuint * barrier);
00366   friend NVSG_API BOOL WGLQueryMaxSwapGroupsNV(HDC hDC, GLuint * maxGroups, GLuint * maxBarriers);
00367   friend NVSG_API BOOL WGLQueryFrameCountNV(HDC hDC, GLuint * count);
00368   friend NVSG_API BOOL WGLResetFrameCountNV(HDC hDC);
00369   // routines to handle bypassing of WGLCreateContext and WGLDeleteContext  
00370   friend NVSG_API void WGLAttachContext(HDC, HGLRC);
00371   friend NVSG_API void WGLDetachContext(HGLRC);
00372 #elif defined(LINUX)
00373   friend NVSG_API GLXContext GLXCreateContext(Display *dpy, XVisualInfo *vis, GLXContext shareList, Bool direct);
00374   friend NVSG_API void GLXDestroyContext(Display *dpy, GLXContext ctx);
00375   friend NVSG_API GLXContext GLXGetCurrentContext();
00376   friend NVSG_API GLXDrawable GLXGetCurrentDrawable();
00377   friend NVSG_API Bool GLXMakeCurrent(Display *dpy, GLXDrawable drawable, GLXContext ctx);
00378   // routines to handle bypassing of GLXCreateContext and GLXDestroyContext  
00379   friend NVSG_API void GLXAttachContext(Display*, GLXContext);
00380   friend NVSG_API void GLXDetachContext(GLXContext);
00381 #endif
00382   // some NVSG extensions
00383 
00384   // CgFXSetDevice extension
00385   friend NVSG_API GLboolean GLCgFXSetDevice();
00386   friend NVSG_API void GLCgFXFreeDevice();
00387 
00388   // Texture lookup extension
00389   friend NVSG_API void GLAddTextureFileForLookup(const std::string& file, const nvsg::Texture * tex);
00390   friend NVSG_API void GLRemoveTextureFileFromLookup(const std::string& file);
00391   friend NVSG_API const nvsg::Texture * GLLookupTexture(const std::string& file);
00392 
00393   // query hw capacity for texcoords arrays and texture image units
00394   friend NVSG_API GLint GLGetMaxTexCoords();
00395   friend NVSG_API GLint GLGetMaxTexUnits();
00396 
00397   // extension query
00399   /** \note Not all exported extensions might be available.
00400     * \returns  \c true, if all functions of \a extension are available, otherwise \c false  */
00401   friend NVSG_API GLboolean GLIsExtensionAvailable(const std::string& extension);
00403 
00405   friend NVSG_API GLboolean GLIsExtensionExported(const std::string& extension);
00406 
00407 public:  // public interface
00408 #if defined(LINUX)
00409   inline Display* getDisplay() { return m_dpy; }
00410 #endif
00411 
00412 private: // private interface
00413 
00414 #if defined(_WIN32)
00415   GLContext(HDC hdc, HGLRC hglrc);  
00416 #elif defined(LINUX)
00417   GLContext(Display *dpy, GLXContext ctx);  
00418 #endif
00419   ~GLContext();
00420 
00421 #if defined(_WIN32)
00422   void init(); // init function pointers and caches
00423 #elif defined(LINUX)
00424   void init(GLXDrawable drw);
00425 #endif
00426   void exit(); // GL objects cleanup
00427 
00428   // Share sharable GL objects with the GLContext referenced through \a source.
00429   void share(const GLContext& source);
00430 
00431   // helper
00432   bool isTexture(GLuint name) const;
00433   bool isVBO(GLuint name)     const;
00434   bool isProgram(GLuint name) const;
00435   bool isDisplayList(GLuint name) const;
00436   bool isOcclusionQuery(GLuint name) const;
00437   bool isQuery(GLuint name) const;
00438   void addTexture(const std::string& file, const nvsg::Texture* texture);
00439   void removeTexture(const std::string& file);
00440   const nvsg::Texture * lookupTexture(const std::string& file) const;
00441 
00442 
00443 public: // public data
00444   GLFunctions * m_glFunctions;    
00445 
00446   // glFrontFaceCache
00447   GLenum m_fontFaceMode;
00448 
00449 private: // private data
00450 
00451 #if defined(_WIN32)
00452   HDC           m_hdc;          
00453   HGLRC         m_hglrc;        
00454 #elif defined(LINUX)  
00455   static Display * m_dpy;       
00456   GLXContext       m_ctx;       
00457   GLXDrawable      m_drawable;  
00458 #endif
00459 
00460   GLObjects   * m_glObjects;    
00461   GLint         m_maxTexCoords; 
00462   GLint         m_maxTexUnits;  
00463 #if defined( _DEBUG )
00464   bool          m_inBeginEndLoop;  
00465 #endif
00466 
00467   nvutil::RCObject * m_CgFXDevice; 
00468 };
00469 
00470 } // namespace nvgl
00471 
00472 // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
00473 // inline implementations
00474 // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
00475 
00476 // need defines now with implementing
00477 #include "nvgl/GLFunctions.h"
00478 #include "nvgl/GLObjects.h"
00479 
00480 namespace nvgl 
00481 {
00482 
00484 
00485 inline void  GLAccum( GLenum op, GLfloat value )
00486 {
00487   glAccum( op, value );
00488   ASSERT_GL_NO_ERROR;
00489 }
00490 
00492 
00493 inline  void  GLActiveTexture( GLenum texture )
00494 {
00495   glContext->m_glFunctions->glActiveTexture(texture);
00496 }
00497 
00499 
00500 inline  void  GLAlphaFunc( GLenum func, GLclampf ref )
00501 {
00502   glAlphaFunc( func, ref );
00503   ASSERT_GL_NO_ERROR;
00504 }
00505 
00507 
00508 inline  GLboolean GLAreTexturesResident( GLsizei n, const GLuint *textures, GLboolean *residences )
00509 {
00510   GLboolean ok = glAreTexturesResident( n, textures, residences );
00511   ASSERT_GL_NO_ERROR;
00512   return( ok );
00513 }
00514 
00516 
00517 inline  void  GLArrayElement( GLint i )
00518 {
00519   glArrayElement( i );
00520   ASSERT_GL_NO_ERROR;
00521 }
00522 
00524 
00525 inline  void  GLBegin( GLenum mode )
00526 {
00527   glBegin( mode );
00528 #if defined( _DEBUG )
00529   glContext->m_inBeginEndLoop = true;
00530 #endif
00531 }
00532 
00534 
00535 inline  void  GLBeginOcclusionQuery( GLuint id )
00536 {
00537   __ASSERT( glContext->m_glFunctions && glContext->m_glFunctions->glBeginOcclusionQueryNV );
00538   glContext->m_glFunctions->glBeginOcclusionQueryNV( id );
00539   ASSERT_GL_NO_ERROR;
00540 }
00541 
00543 
00544 inline  void  GLBeginQuery( GLenum target, GLuint id )
00545 {
00546   __ASSERT( glContext->m_glFunctions && glContext->m_glFunctions->glBeginQueryARB );
00547   glContext->m_glFunctions->glBeginQueryARB( target, id );
00548   ASSERT_GL_NO_ERROR;
00549 }
00550 
00552 
00553 inline  void  GLBindBufferARB(GLenum target, GLuint id)
00554 {
00555   __ASSERT( glContext->m_glFunctions && glContext->m_glFunctions->glBindBufferARB );
00556   glContext->m_glFunctions->glBindBufferARB( target, id );
00557   ASSERT_GL_NO_ERROR;
00558 }
00559 
00561 
00562 inline  void  GLBufferDataARB( GLenum target, GLsizeiptrARB size, const GLvoid *data, GLenum usage )
00563 {
00564   __ASSERT( glContext->m_glFunctions && glContext->m_glFunctions->glBufferDataARB );
00565   glContext->m_glFunctions->glBufferDataARB( target, size, data, usage );
00566   ASSERT_GL_NO_ERROR;
00567 }
00568 
00570 
00571 inline  void  GLBufferSubDataARB( GLenum target, GLintptrARB offset, GLsizeiptrARB size, const GLvoid *data )
00572 {
00573   __ASSERT( glContext->m_glFunctions && glContext->m_glFunctions->glBufferSubDataARB );
00574   glContext->m_glFunctions->glBufferSubDataARB( target, offset, size, data );
00575   ASSERT_GL_NO_ERROR;
00576 }
00577 
00579 
00580 inline  void  GLDeleteBuffersARB(GLsizei n, const GLuint *buffers)
00581 {
00582   __ASSERT( glContext->m_glFunctions && glContext->m_glFunctions->glDeleteBuffersARB );
00583   glContext->m_glFunctions->glDeleteBuffersARB( n, buffers );
00584   glContext->m_glObjects->removeBuffers(n, buffers);
00585   ASSERT_GL_NO_ERROR;
00586 }
00587 
00589 
00590 inline  void  GLGenBuffersARB(GLsizei n, GLuint *buffers)
00591 {
00592   __ASSERT( glContext->m_glFunctions && glContext->m_glFunctions->glGenBuffersARB );
00593   glContext->m_glFunctions->glGenBuffersARB( n, buffers );
00594   glContext->m_glObjects->addBuffers(n, buffers);
00595   ASSERT_GL_NO_ERROR;
00596 }
00597 
00598 //void GLAPI glGetBufferParameterivARB (GLenum target, GLenum pname, GLint *params);
00599 //void GLAPI glGetBufferPointervARB (GLenum target, GLenum pname, GLvoid* *params);
00600 //void GLAPI glGetBufferSubDataARB (GLenum target, GLintptrARB offset, GLsizeiptrARB size, GLvoid *data);
00601 
00603 
00604 inline  GLvoid*  GLMapBufferARB( GLenum target, GLenum access )
00605 {
00606   __ASSERT( glContext->m_glFunctions && glContext->m_glFunctions->glMapBufferARB );
00607   GLvoid * p = glContext->m_glFunctions->glMapBufferARB( target, access );
00608   ASSERT_GL_NO_ERROR;
00609   return p;
00610 }
00611 
00613 
00614 inline  GLboolean  GLUnmapBufferARB( GLenum target )
00615 {
00616   __ASSERT( glContext->m_glFunctions && glContext->m_glFunctions->glUnmapBufferARB );
00617   GLboolean b = glContext->m_glFunctions->glUnmapBufferARB( target );
00618   ASSERT_GL_NO_ERROR;
00619   return b;
00620 }
00621 
00623 
00624 inline  GLboolean  GLIsBufferARB( GLuint name )
00625 {
00626   __ASSERT(glContext->m_glFunctions && glContext->m_glFunctions->glIsBufferARB);
00627   __ASSERT(!!glContext->isVBO(name)==!!glContext->m_glFunctions->glIsBufferARB(name));
00628   return glContext->isVBO(name);
00629 }
00630 
00632 
00633 inline  void  GLBindProgram( GLenum target, GLuint id )
00634 {
00635   __ASSERT( glContext->m_glFunctions && glContext->m_glFunctions->glBindProgramNV );
00636   glContext->m_glFunctions->glBindProgramNV( target, id );
00637   ASSERT_GL_NO_ERROR;
00638 }
00639 
00641 
00642 inline  void  GLBitmap( GLsizei width, GLsizei height, GLfloat xorig, GLfloat yorig, GLfloat xmove, GLfloat ymove, const GLubyte *bitmap )
00643 {
00644   glBitmap( width, height, xorig, yorig, xmove, ymove, bitmap );
00645   ASSERT_GL_NO_ERROR;
00646 }
00647 
00649 
00650 inline  void  GLBlendFunc( GLenum sfactor, GLenum dfactor )
00651 {
00652   glBlendFunc( sfactor, dfactor );
00653   ASSERT_GL_NO_ERROR;
00654 }
00655 
00657 
00658 inline  void  GLBindTexture( GLenum target, GLuint texture )
00659 {
00660   glBindTexture( target, texture );
00661   ASSERT_GL_NO_ERROR;
00662 }
00663 
00665 
00666 inline  void  GLCallList( GLuint list )
00667 {
00668   glCallList( list );
00669   ASSERT_GL_NO_ERROR;
00670 }
00671 
00673 
00674 inline  void  GLCallLists( GLsizei n, GLenum type, const GLvoid *lists )
00675 {
00676   glCallLists( n, type, lists );
00677   ASSERT_GL_NO_ERROR;
00678 }
00679 
00681 
00682 inline  void  GLClear( GLbitfield mask )
00683 {
00684   glClear( mask );
00685   ASSERT_GL_NO_ERROR;
00686 }
00687 
00689 
00690 inline  void  GLClearAccum( GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha )
00691 {
00692   glClearAccum( red, green, blue, alpha );
00693   ASSERT_GL_NO_ERROR;
00694 }
00695 
00697 
00698 inline  void  GLClearColor( GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha )
00699 {
00700   glClearColor(red, green, blue, alpha);
00701   ASSERT_GL_NO_ERROR;
00702 }
00703 
00705 
00706 inline  void  GLClearDepth( GLclampd depth )
00707 {
00708   glClearDepth( depth );
00709   ASSERT_GL_NO_ERROR;
00710 }
00711 
00713 
00714 inline  void  GLClearIndex( GLfloat c )
00715 {
00716   glClearIndex( c );
00717   ASSERT_GL_NO_ERROR;
00718 }
00719 
00721 
00722 inline  void  GLClearStencil( GLint s )
00723 {
00724   glClearStencil( s );
00725   ASSERT_GL_NO_ERROR;
00726 }
00727 
00729 
00730 inline  void  GLClientActiveTexture( GLenum texture )
00731 {
00732   glContext->m_glFunctions->glClientActiveTexture( texture );
00733   ASSERT_GL_NO_ERROR;
00734 }
00735 
00737 
00738 inline  void  GLClipPlane( GLenum plane, const GLdouble *equation )
00739 {
00740   glClipPlane(plane, equation);
00741   ASSERT_GL_NO_ERROR;
00742 }
00743 
00745 
00746 inline  void  GLColor3b( GLbyte red, GLbyte green, GLbyte blue )
00747 {
00748   glColor3b( red, green, blue );
00749   ASSERT_GL_NO_ERROR_IN_BEGIN_END;
00750 }
00751 
00753 
00754 inline  void  GLColor3d( GLdouble red, GLdouble green, GLdouble blue )
00755 {
00756   glColor3d( red, green, blue );
00757   ASSERT_GL_NO_ERROR_IN_BEGIN_END;
00758 }
00759 
00761 
00762 inline  void  GLColor3f( GLfloat red, GLfloat green, GLfloat blue )
00763 {
00764   glColor3f( red, green, blue );
00765   ASSERT_GL_NO_ERROR_IN_BEGIN_END;
00766 }
00767 
00769 
00770 inline  void  GLColor3fv( const GLfloat * v )
00771 {
00772   glColor3fv( v );
00773   ASSERT_GL_NO_ERROR_IN_BEGIN_END;
00774 }
00775 
00777 
00778 inline  void  GLColor3i( GLint red, GLint green, GLint blue )
00779 {
00780   glColor3i( red, green, blue );
00781   ASSERT_GL_NO_ERROR_IN_BEGIN_END;
00782 }
00783 
00785 
00786 inline  void  GLColor3s( GLshort red, GLshort green, GLshort blue )
00787 {
00788   glColor3s( red, green, blue );
00789   ASSERT_GL_NO_ERROR_IN_BEGIN_END;
00790 }
00791 
00793 
00794 inline  void  GLColor3ub( GLubyte red, GLubyte green, GLubyte blue )
00795 {
00796   glColor3ub( red, green, blue );
00797   ASSERT_GL_NO_ERROR_IN_BEGIN_END;
00798 }
00799 
00801 
00802 inline  void  GLColor3ui( GLuint red, GLuint green, GLuint blue )
00803 {
00804   glColor3ui( red, green, blue );
00805   ASSERT_GL_NO_ERROR_IN_BEGIN_END;
00806 }
00807 
00809 
00810 inline  void  GLColor3us( GLushort red, GLushort green, GLushort blue )
00811 {
00812   glColor3us( red, green, blue );
00813   ASSERT_GL_NO_ERROR_IN_BEGIN_END;
00814 }
00815 
00817 
00818 inline  void  GLColor4b( GLbyte red, GLbyte green, GLbyte blue, GLbyte alpha )
00819 {
00820   glColor4b( red, green, blue, alpha );
00821   ASSERT_GL_NO_ERROR_IN_BEGIN_END;
00822 }
00823 
00825 
00826 inline  void  GLColor4d( GLdouble red, GLdouble green, GLdouble blue, GLdouble alpha )
00827 {
00828   glColor4d( red, green, blue, alpha );
00829   ASSERT_GL_NO_ERROR_IN_BEGIN_END;
00830 }
00831 
00833 
00834 inline  void  GLColor4f( GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha )
00835 {
00836   glColor4f( red, green, blue, alpha );
00837   ASSERT_GL_NO_ERROR_IN_BEGIN_END;
00838 }
00839 
00841 
00842 inline  void  GLColor4i( GLint red, GLint green, GLint blue, GLint alpha )
00843 {
00844   glColor4i( red, green, blue, alpha );
00845   ASSERT_GL_NO_ERROR_IN_BEGIN_END;
00846 }
00847 
00849 
00850 inline  void  GLColor4s( GLshort red, GLshort green, GLshort blue, GLshort alpha )
00851 {
00852   glColor4s( red, green, blue, alpha );
00853   ASSERT_GL_NO_ERROR_IN_BEGIN_END;
00854 }
00855 
00857 
00858 inline  void  GLColor4ub( GLubyte red, GLubyte green, GLubyte blue, GLubyte alpha )
00859 {
00860   glColor4ub( red, green, blue, alpha );
00861   ASSERT_GL_NO_ERROR_IN_BEGIN_END;
00862 }
00863 
00865 
00866 inline  void  GLColor4ui( GLuint red, GLuint green, GLuint blue, GLuint alpha )
00867 {
00868   glColor4ui( red, green, blue, alpha );
00869   ASSERT_GL_NO_ERROR_IN_BEGIN_END;
00870 }
00871 
00873 
00874 inline  void  GLColor4us( GLushort red, GLushort green, GLushort blue, GLushort alpha )
00875 {
00876   glColor4us( red, green, blue, alpha );
00877   ASSERT_GL_NO_ERROR_IN_BEGIN_END;
00878 }
00879 
00881 
00882 inline  void  GLColorMask( GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha )
00883 {
00884   glColorMask( red, green, blue, alpha );
00885   ASSERT_GL_NO_ERROR;
00886 }
00887 
00889 
00890 inline  void  GLColorMaterial( GLenum face, GLenum mode )
00891 {
00892   glColorMaterial( face, mode );
00893   ASSERT_GL_NO_ERROR;
00894 }
00895 
00897 
00898 inline  void  GLColorPointer( GLint size, GLenum type, GLsizei stride, const GLvoid *pointer )
00899 {
00900   glColorPointer( size, type, stride, pointer );
00901   ASSERT_GL_NO_ERROR;
00902 }
00903 
00905 
00906 inline  void  GLCompressedTexImage1D( GLenum target, int level, GLenum internalformat, GLsizei width, int border, GLsizei imageSize, const void *data )
00907 {
00908   __ASSERT( glContext->m_glFunctions && glContext->m_glFunctions->glCompressedTexImage1D );
00909   glContext->m_glFunctions->glCompressedTexImage1D( target, level, internalformat, width, border, imageSize, data );
00910   ASSERT_GL_NO_ERROR;
00911 }
00912 
00914 
00915 inline  void  GLCompressedTexImage2D( GLenum target, int level, GLenum internalformat, GLsizei width, GLsizei height, int border, GLsizei imageSize, const void *data )
00916 {
00917   __ASSERT( glContext->m_glFunctions && glContext->m_glFunctions->glCompressedTexImage2D );
00918   glContext->m_glFunctions->glCompressedTexImage2D( target, level, internalformat, width, height, border, imageSize, data );
00919   ASSERT_GL_NO_ERROR;
00920 }
00921 
00923 
00924 inline  void  GLCompressedTexImage3D( GLenum target, int level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, int border, GLsizei imageSize, const void *data )
00925 {
00926   __ASSERT( glContext->m_glFunctions && glContext->m_glFunctions->glCompressedTexImage3D );
00927   glContext->m_glFunctions->glCompressedTexImage3D( target, level, internalformat, width, height, depth, border, imageSize, data );
00928   ASSERT_GL_NO_ERROR;
00929 }
00930 
00932 
00933 inline  void  GLCopyPixels( GLint x, GLint y, GLsizei width, GLsizei height, GLenum type )
00934 {
00935   glCopyPixels( x, y, width, height, type );
00936   ASSERT_GL_NO_ERROR;
00937 }
00938 
00940 
00941 inline  void  GLCopyTexImage1D( GLenum target, GLint level, GLenum internalFormat, GLint x, GLint y, GLsizei width, GLint border )
00942 {
00943   glCopyTexImage1D( target, level, internalFormat, x, y, width, border );
00944   ASSERT_GL_NO_ERROR;
00945 }
00946 
00948 
00949 inline  void  GLCopyTexImage2D( GLenum target, GLint level, GLenum internalFormat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border )
00950 {
00951   glCopyTexImage2D( target, level, internalFormat, x, y, width, height, border );
00952   ASSERT_GL_NO_ERROR;
00953 }
00954 
00956 
00957 inline  void  GLCopyTexSubImage1D( GLenum target, GLint level, GLint xoffset, GLint x, GLint y, GLsizei width )
00958 {
00959   glCopyTexSubImage1D( target,level, xoffset, x, y, width );
00960   ASSERT_GL_NO_ERROR;
00961 }
00962 
00964 
00965 inline  void  GLCopyTexSubImage2D( GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height )
00966 {
00967   glCopyTexSubImage2D( target,level, xoffset, yoffset, x, y, width, height );
00968   ASSERT_GL_NO_ERROR;
00969 }
00970 
00972 
00973 inline  void  GLCullFace( GLenum mode )
00974 {
00975   glCullFace( mode );
00976   ASSERT_GL_NO_ERROR;
00977 }
00978 
00980 
00981 inline  void  GLDeleteLists( GLuint list, GLsizei range )
00982 {
00983   glDeleteLists( list, range );
00984   glContext->m_glObjects->removeLists(range, list);
00985   ASSERT_GL_NO_ERROR;
00986 }
00987 
00989 
00990 inline  void  GLDeleteOcclusionQueries( GLsizei n, const GLuint *ids )
00991 {
00992   __ASSERT( glContext->m_glFunctions && glContext->m_glFunctions->glDeleteOcclusionQueriesNV );
00993   glContext->m_glFunctions->glDeleteOcclusionQueriesNV( n, ids );
00994   glContext->m_glObjects->removeOcclusionQueries(n, ids);
00995   ASSERT_GL_NO_ERROR;
00996 }
00997 
00999 
01000 inline  void  GLDeletePrograms( GLsizei n, const GLuint *ids )
01001 {
01002   __ASSERT( glContext->m_glFunctions && glContext->m_glFunctions->glDeleteProgramsNV );
01003   glContext->m_glFunctions->glDeleteProgramsNV( n, ids );
01004   glContext->m_glObjects->removePrograms(n, ids);
01005   ASSERT_GL_NO_ERROR;
01006 }
01007 
01009 
01010 inline  void  GLDeleteQueries( GLsizei n, const GLuint *ids )
01011 {
01012   __ASSERT( glContext->m_glFunctions && glContext->m_glFunctions->glDeleteQueriesARB );
01013   glContext->m_glFunctions->glDeleteQueriesARB( n, ids );
01014   glContext->m_glObjects->removeQueries( n, ids );
01015   ASSERT_GL_NO_ERROR;
01016 }
01017 
01019 
01020 inline  void  GLDeleteTextures( GLsizei n, const GLuint *textures )
01021 {
01022   glDeleteTextures( n, textures );
01023   glContext->m_glObjects->removeTextures(n, textures);
01024   ASSERT_GL_NO_ERROR;
01025 }
01026 
01028 
01029 inline  void  GLDepthFunc( GLenum func )
01030 {
01031   glDepthFunc( func );
01032   ASSERT_GL_NO_ERROR;
01033 }
01034 
01036 
01037 inline  void  GLDepthMask( GLboolean flag )
01038 {
01039   glDepthMask( flag );
01040   ASSERT_GL_NO_ERROR;
01041 }
01042 
01044 
01045 inline  void  GLDepthRange( GLclampd znear, GLclampd zfar )
01046 {
01047   glDepthRange( znear, zfar );
01048   ASSERT_GL_NO_ERROR;
01049 }
01050 
01052 
01053 inline  void  GLDisable( GLenum cap ) 
01054 {
01055   glDisable( cap );
01056   ASSERT_GL_NO_ERROR;
01057 }
01058 
01060 
01061 inline  void  GLDisableClientState( GLenum array ) 
01062 {
01063   glDisableClientState( array );
01064   ASSERT_GL_NO_ERROR;
01065 }
01066 
01068 
01069 inline  void  GLDrawArrays( GLenum mode, GLint first, GLsizei count )
01070 {
01071   glDrawArrays( mode, first, count );
01072   ASSERT_GL_NO_ERROR;
01073 }
01074 
01076 
01077 inline  void  GLDrawBuffer( GLenum mode ) 
01078 { 
01079   glDrawBuffer( mode );
01080   ASSERT_GL_NO_ERROR;
01081 }
01082 
01084 
01085 inline  void  GLDrawElements( GLenum mode, GLsizei count, GLenum type, const GLvoid *indices )
01086 {
01087   glDrawElements( mode, count, type, indices );
01088   ASSERT_GL_NO_ERROR;
01089 }
01090 
01092 
01093 inline  void  GLMultiDrawElements( GLenum mode, const GLsizei *count, GLenum type, const GLvoid* *indices, GLsizei primcount )
01094 {
01095   glContext->m_glFunctions->glMultiDrawElements( mode, count, type, indices, primcount );
01096   ASSERT_GL_NO_ERROR;
01097 }
01098 
01100 
01101 inline  void  GLDrawPixels( GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *pixels )
01102 {
01103   glDrawPixels( width, height, format, type, pixels );
01104   ASSERT_GL_NO_ERROR;
01105 }
01106 
01108 
01109 inline  void  GLDrawRangeElements( GLenum mode, GLuint start, GLuint end, GLsizei count, GLenum type, const GLvoid *indices )
01110 {
01111   glContext->m_glFunctions->glDrawRangeElements( mode, start, end, count, type, indices );
01112   ASSERT_GL_NO_ERROR;
01113 }
01114 
01116 
01117 inline  void  GLEdgeFlagPointer( GLsizei stride, const GLboolean *pointer )
01118 {
01119   glEdgeFlagPointer( stride, pointer );
01120   ASSERT_GL_NO_ERROR;
01121 }
01122 
01124 
01125 inline  void  GLEdgeFlag( GLboolean flag )
01126 {
01127   glEdgeFlag( flag );
01128   ASSERT_GL_NO_ERROR_IN_BEGIN_END;
01129 }
01130 
01132 
01133 inline  void  GLEdgeFlagv( const GLboolean *flag )
01134 {
01135   glEdgeFlagv( flag );
01136   ASSERT_GL_NO_ERROR_IN_BEGIN_END;
01137 }
01138 
01140 
01141 inline  void  GLEnable( GLenum cap ) 
01142 { 
01143   glEnable( cap );
01144   ASSERT_GL_NO_ERROR;
01145 }
01146 
01148 
01149 inline  void  GLEnableClientState( GLenum array ) 
01150 {
01151   glEnableClientState( array );
01152   ASSERT_GL_NO_ERROR;
01153 }
01154 
01156 
01157 inline  void  GLEnd( void )
01158 {
01159   glEnd();
01160 #if defined( _DEBUG )
01161   glContext->m_inBeginEndLoop = false;
01162 #endif
01163   ASSERT_GL_NO_ERROR;
01164 }
01165 
01167 
01168 inline  void  GLEndList( void )
01169 {
01170   glEndList();
01171   ASSERT_GL_NO_ERROR;
01172 }
01173 
01175 
01176 inline  void  GLEndOcclusionQuery( void )
01177 {
01178   __ASSERT( glContext->m_glFunctions && glContext->m_glFunctions->glEndOcclusionQueryNV );
01179   glContext->m_glFunctions->glEndOcclusionQueryNV();
01180   ASSERT_GL_NO_ERROR;
01181 }
01182 
01184 
01185 inline  void  GLEndQuery( GLenum target )
01186 {
01187   __ASSERT( glContext->m_glFunctions && glContext->m_glFunctions->glEndQueryARB );
01188   glContext->m_glFunctions->glEndQueryARB( target );
01189   ASSERT_GL_NO_ERROR;
01190 }
01191 
01193 
01194 inline  void  GLEvalCoord1d( GLdouble u )
01195 {
01196   glEvalCoord1d( u );
01197   ASSERT_GL_NO_ERROR_IN_BEGIN_END;
01198 }
01199 
01201 
01202 inline  void  GLEvalCoord1f( GLfloat u )
01203 {
01204   glEvalCoord1f( u );
01205   ASSERT_GL_NO_ERROR_IN_BEGIN_END;
01206 }
01207 
01209 
01210 inline  void  GLEvalCoord2d( GLdouble u, GLdouble v )
01211 {
01212   glEvalCoord2d( u, v );
01213   ASSERT_GL_NO_ERROR_IN_BEGIN_END;
01214 }
01215 
01217 
01218 inline  void  GLEvalCoord2f( GLfloat u, GLfloat v )
01219 {
01220   glEvalCoord2f( u, v );
01221   ASSERT_GL_NO_ERROR_IN_BEGIN_END;
01222 }
01223 
01225 
01226 inline  void  GLEvalMesh1( GLenum mode, GLint i1, GLint i2 )
01227 {
01228   glEvalMesh1( mode, i1, i2 );
01229   ASSERT_GL_NO_ERROR;
01230 }
01231 
01233 
01234 inline  void  GLEvalMesh2( GLenum mode, GLint i1, GLint i2, GLint j1, GLint j2 )
01235 {
01236   glEvalMesh2( mode, i1, i2, j1, j2 );
01237   ASSERT_GL_NO_ERROR;
01238 }
01239 
01241 
01242 inline  void  GLEvalPoint1( GLint i )
01243 {
01244   glEvalPoint1( i );
01245   ASSERT_GL_NO_ERROR_IN_BEGIN_END;
01246 }
01247 
01249 
01250 inline  void  GLEvalPoint2( GLint i, GLint j )
01251 {
01252   glEvalPoint2( i, j );
01253   ASSERT_GL_NO_ERROR_IN_BEGIN_END;
01254 }
01255 
01257 
01258 inline  void  GLFeedbackBuffer( GLsizei size, GLenum type, GLfloat *buffer )
01259 {
01260   glFeedbackBuffer( size, type, buffer );
01261   ASSERT_GL_NO_ERROR;
01262 }
01263 
01265 
01266 inline  void  GLFinish( void )
01267 {
01268   glFinish();
01269   ASSERT_GL_NO_ERROR;
01270 }
01271 
01273 
01274 inline  void  GLFlush( void )
01275 {
01276   glFlush();
01277   ASSERT_GL_NO_ERROR;
01278 }
01279 
01281 
01282 inline  void  GLFogCoordPointer( GLenum type, GLsizei stride, const GLvoid *pointer )
01283 {
01284   glContext->m_glFunctions->glFogCoordPointer( type, stride, pointer );
01285   ASSERT_GL_NO_ERROR;
01286 }
01287 
01289 
01290 inline  void  GLFogf( GLenum pname, GLfloat param ) 
01291 {
01292   glFogf( pname, param );
01293   ASSERT_GL_NO_ERROR;
01294 }
01295 
01297 
01298 inline  void  GLFogfv( GLenum pname, const GLfloat *params )  
01299 { 
01300   glFogfv( pname, params );
01301   ASSERT_GL_NO_ERROR;
01302 }
01303 
01305 
01306 inline  void  GLFogi( GLenum pname, GLint param ) 
01307 { 
01308   glFogi(pname, param);
01309   ASSERT_GL_NO_ERROR;
01310 }
01311 
01313 
01314 inline  void  GLFogiv( GLenum pname, const GLint *params ) 
01315 { 
01316   glFogiv(pname, params);
01317   ASSERT_GL_NO_ERROR;
01318 }
01319 
01321 
01322 inline  void  GLFrontFace( GLenum mode )
01323 {
01324   if (mode != glContext->m_fontFaceMode)
01325   {
01326     glFrontFace( mode );
01327     ASSERT_GL_NO_ERROR;
01328     
01329     glContext->m_fontFaceMode = mode;
01330   }
01331 }
01332 
01334 
01335 inline  void  GLFrustum( GLdouble left, GLdouble right, GLdouble bottom, GLdouble top, GLdouble zNear, GLdouble zFar )
01336 {
01337   glFrustum( left, right, bottom, top, zNear, zFar );
01338   ASSERT_GL_NO_ERROR;
01339 }
01340 
01342 
01343 inline  GLuint  GLGenLists( GLsizei range )
01344 {
01345   GLuint  firstList = glGenLists( range );
01346   glContext->m_glObjects->addLists(range, firstList);
01347   ASSERT_GL_NO_ERROR;
01348   return( firstList );
01349 }
01350 
01352 
01353 inline  void  GLGenOcclusionQueries( GLsizei n, GLuint *ids )
01354 {
01355   __ASSERT( glContext->m_glFunctions && glContext->m_glFunctions->glGenOcclusionQueriesNV );
01356   glContext->m_glFunctions->glGenOcclusionQueriesNV( n, ids );
01357   glContext->m_glObjects->addOcclusionQueries(n, ids);
01358   ASSERT_GL_NO_ERROR;
01359 }
01360 
01362 
01363 inline  void  GLGenPrograms( GLsizei n, GLuint *ids )
01364 {
01365   __ASSERT( glContext->m_glFunctions && glContext->m_glFunctions->glGenProgramsNV );
01366   glContext->m_glFunctions->glGenProgramsNV( n, ids );
01367   glContext->m_glObjects->addPrograms(n, ids);
01368   ASSERT_GL_NO_ERROR;
01369 }
01370 
01372 
01373 inline  void  GLGenQueries( GLsizei n, GLuint *ids )
01374 {
01375   __ASSERT( glContext->m_glFunctions && glContext->m_glFunctions->glGenQueriesARB );
01376   glContext->m_glFunctions->glGenQueriesARB( n, ids );
01377   glContext->m_glObjects->addQueries( n, ids );
01378   ASSERT_GL_NO_ERROR;
01379 }
01380 
01382 
01383 inline  void  GLGenTextures( GLsizei n, GLuint *textures )
01384 {
01385   glGenTextures( n, textures );
01386   glContext->m_glObjects->addTextures(n, textures);
01387   ASSERT_GL_NO_ERROR;
01388 }
01389 
01391 
01392 inline  void  GLGetBooleanv( GLenum pname, GLboolean *params )
01393 {
01394   glGetBooleanv( pname, params );
01395   ASSERT_GL_NO_ERROR;
01396 }
01397 
01399 
01400 inline  void  GLGetDoublev( GLenum pname, GLdouble *params )
01401 {
01402   glGetDoublev( pname, params );
01403   ASSERT_GL_NO_ERROR;
01404 }
01405 
01407 
01408 inline  void  GLGetFloatv( GLenum pname, GLfloat *params )
01409 {
01410   glGetFloatv( pname, params );
01411   ASSERT_GL_NO_ERROR;
01412 }
01413 
01415 
01416 inline  void  GLGetIntegerv( GLenum pname, GLint *params )
01417 {
01418   glGetIntegerv( pname, params );
01419   ASSERT_GL_NO_ERROR;
01420 }
01421 
01423 
01424 inline  void  GLGetClipPlane( GLenum plane, GLdouble *equation )
01425 {
01426   glGetClipPlane( plane, equation );
01427   ASSERT_GL_NO_ERROR;
01428 }
01429 
01431 
01432 inline  void  GLGetLightfv( GLenum light, GLenum pname, GLfloat *params )
01433 {
01434   glGetLightfv( light, pname, params );
01435   ASSERT_GL_NO_ERROR;
01436 }
01437 
01439 
01440 inline  void  GLGetLightiv( GLenum light, GLenum pname, GLint *params )
01441 {
01442   glGetLightiv( light, pname, params );
01443   ASSERT_GL_NO_ERROR;
01444 }
01445 
01447 
01448 inline  void  GLGetMapdv( GLenum target, GLenum query, GLdouble *v )
01449 {
01450   glGetMapdv( target, query, v );
01451   ASSERT_GL_NO_ERROR;
01452 }
01453 
01455 
01456 inline  void  GLGetMapfv( GLenum target, GLenum query, GLfloat *v )
01457 {
01458   glGetMapfv( target, query, v );
01459   ASSERT_GL_NO_ERROR;
01460 }
01461 
01463 
01464 inline  void  GLGetMapiv( GLenum target, GLenum query, GLint *v )
01465 {
01466   glGetMapiv( target, query, v );
01467   ASSERT_GL_NO_ERROR;
01468 }
01469 
01471 
01472 inline  void  GLGetMaterialfv( GLenum face, GLenum pname, GLfloat *params )
01473 {
01474   glGetMaterialfv( face, pname, params );
01475   ASSERT_GL_NO_ERROR;
01476 }
01477 
01479 
01480 inline  void  GLGetMaterialiv( GLenum face, GLenum pname, GLint *params )
01481 {
01482   glGetMaterialiv( face, pname, params );
01483   ASSERT_GL_NO_ERROR;
01484 }
01485 
01487 
01488 inline  void  GLGetOcclusionQueryuiv( GLuint id, GLenum pname, GLuint *params )
01489 {
01490   __ASSERT( glContext->m_glFunctions && glContext->m_glFunctions->glGetOcclusionQueryuivNV );
01491   glContext->m_glFunctions->glGetOcclusionQueryuivNV( id, pname, params );
01492   ASSERT_GL_NO_ERROR;
01493 }
01494 
01496 
01497 inline  void  GLGetPixelMapfv( GLenum map, GLfloat *values )
01498 {
01499   glGetPixelMapfv( map, values );
01500   ASSERT_GL_NO_ERROR;
01501 }
01502 
01504 
01505 inline  void  GLGetPixelMapuiv( GLenum map, GLuint *values )
01506 {
01507   glGetPixelMapuiv( map, values );
01508   ASSERT_GL_NO_ERROR;
01509 }
01510 
01512 
01513 inline  void  GLGetPixelMapusv( GLenum map, GLushort *values )
01514 {
01515   glGetPixelMapusv( map, values );
01516   ASSERT_GL_NO_ERROR;
01517 }
01518 
01520 
01521 inline  void  GLGetPointerv( GLenum pname, GLvoid* *params )
01522 {
01523   glGetPointerv( pname, params );
01524   ASSERT_GL_NO_ERROR;
01525 }
01526 
01528 
01529 inline  void  GLGetPolygonStipple( GLubyte *mask )
01530 {
01531   glGetPolygonStipple( mask );
01532   ASSERT_GL_NO_ERROR;
01533 }
01534 
01536 
01537 inline  void  GLGetQueryiv( GLenum target, GLenum pname, GLint *params )
01538 {
01539   __ASSERT( glContext->m_glFunctions && glContext->m_glFunctions->glGetQueryivARB );
01540   glContext->m_glFunctions->glGetQueryivARB( target, pname, params );
01541   ASSERT_GL_NO_ERROR;
01542 }
01543 
01545 
01546 inline  void  GLGetQueryObjectiv( GLuint id, GLenum pname, GLint *params )
01547 {
01548   __ASSERT( glContext->m_glFunctions && glContext->m_glFunctions->glGetQueryObjectivARB );
01549   glContext->m_glFunctions->glGetQueryObjectivARB( id, pname, params );
01550   ASSERT_GL_NO_ERROR;
01551 }
01552 
01554 
01555 inline  void  GLGetQueryObjectuiv( GLuint id, GLenum pname, GLuint *params )
01556 {
01557   __ASSERT( glContext->m_glFunctions && glContext->m_glFunctions->glGetQueryObjectuivARB );
01558   glContext->m_glFunctions->glGetQueryObjectuivARB( id, pname, params );
01559   ASSERT_GL_NO_ERROR;
01560 }
01561 
01563 
01564 inline  const GLubyte * GLGetString( GLenum name )
01565 {
01566   const GLubyte * ret = glGetString( name );
01567   ASSERT_GL_NO_ERROR;
01568   return( ret );
01569 }
01570 
01572 
01573 inline  void  GLGetTexEnvfv( GLenum target, GLenum pname, GLfloat *params )
01574 {
01575   glGetTexEnvfv( target,pname, params );
01576   ASSERT_GL_NO_ERROR;
01577 }
01578 
01580 
01581 inline  void  GLGetTexEnviv( GLenum target, GLenum pname, GLint *params )
01582 {
01583   glGetTexEnviv( target,pname, params );
01584   ASSERT_GL_NO_ERROR;
01585 }
01586 
01588 
01589 inline  void  GLGetTexGendv( GLenum coord, GLenum pname, GLdouble *params )
01590 {
01591   glGetTexGendv( coord, pname, params );
01592   ASSERT_GL_NO_ERROR;
01593 }
01594 
01596 
01597 inline  void  GLGetTexGenfv( GLenum coord, GLenum pname, GLfloat *params )
01598 {
01599   glGetTexGenfv( coord, pname, params );
01600   ASSERT_GL_NO_ERROR;
01601 }
01602 
01604 
01605 inline  void  GLGetTexGeniv( GLenum coord, GLenum pname, GLint *params )
01606 {
01607   glGetTexGeniv( coord, pname, params );
01608   ASSERT_GL_NO_ERROR;
01609 }
01610 
01612 
01613 inline  void  GLGetTexImage( GLenum target, GLint level, GLenum format, GLenum type, GLvoid *pixels )
01614 {
01615   glGetTexImage( target, level, format, type, pixels );
01616   ASSERT_GL_NO_ERROR;
01617 }
01618 
01620 
01621 inline  void  GLGetTexLevelParameterfv( GLenum target, GLint level, GLenum pname, GLfloat *params )
01622 {
01623   glGetTexLevelParameterfv( target, level, pname, params );
01624   ASSERT_GL_NO_ERROR;
01625 }
01626 
01628 
01629 inline  void  GLGetTexLevelParameteriv( GLenum target, GLint level, GLenum pname, GLint *params )
01630 {
01631   glGetTexLevelParameteriv( target, level, pname, params );
01632   ASSERT_GL_NO_ERROR;
01633 }
01634 
01636 
01637 inline  void  GLGetTexParameterfv( GLenum target, GLenum pname, GLfloat *params )
01638 {
01639   glGetTexParameterfv( target, pname, params );
01640   ASSERT_GL_NO_ERROR;
01641 }
01642 
01644 
01645 inline  void  GLGetTexParameteriv( GLenum target, GLenum pname, GLint *params )
01646 {
01647   glGetTexParameteriv( target, pname, params );
01648   ASSERT_GL_NO_ERROR;
01649 }
01650 
01652 
01653 inline  void  GLHint( GLenum target, GLenum mode )
01654 {
01655   glHint( target, mode );
01656   ASSERT_GL_NO_ERROR;
01657 }
01658 
01660 
01661 inline  void  GLIndexd( GLdouble c )
01662 {
01663   glIndexd( c );
01664   ASSERT_GL_NO_ERROR_IN_BEGIN_END;
01665 }
01666 
01668 
01669 inline  void  GLIndexf( GLfloat c )
01670 {
01671   glIndexf( c );
01672   ASSERT_GL_NO_ERROR_IN_BEGIN_END;
01673 }
01674 
01676 
01677 inline  void  GLIndexi( GLint c )
01678 {
01679   glIndexi( c );
01680   ASSERT_GL_NO_ERROR_IN_BEGIN_END;
01681 }
01682 
01684 
01685 inline  void  GLIndexMask( GLuint mask )
01686 {
01687   glIndexMask( mask );
01688   ASSERT_GL_NO_ERROR;
01689 }
01690 
01692 
01693 inline  void  GLIndexPointer( GLenum type, GLsizei stride, const GLvoid *pointer )
01694 {
01695   glIndexPointer( type, stride, pointer );
01696   ASSERT_GL_NO_ERROR;
01697 }
01698 
01700 
01701 inline  void  GLIndexs( GLshort c )
01702 {
01703   glIndexs( c );
01704   ASSERT_GL_NO_ERROR_IN_BEGIN_END;
01705 }
01706 
01708 
01709 inline  void  GLIndexub( GLubyte c )
01710 {
01711   glIndexub( c );
01712   ASSERT_GL_NO_ERROR_IN_BEGIN_END;
01713 }
01714 
01716 
01717 inline  void  GLInitNames( void )
01718 {
01719   glInitNames();
01720   ASSERT_GL_NO_ERROR;
01721 }
01722 
01724 
01725 inline  void  GLInterleavedArrays( GLenum format, GLsizei stride, const GLvoid *pointer )
01726 {
01727   glInterleavedArrays( format, stride, pointer );
01728   ASSERT_GL_NO_ERROR;
01729 }
01730 
01732 
01733 inline  GLboolean  GLIsEnabled( GLenum cap ) 
01734 {
01735   GLboolean isEnabled = glIsEnabled( cap );
01736   ASSERT_GL_NO_ERROR;
01737   return isEnabled;
01738 }
01739 
01741 
01742 inline  GLboolean GLIsList( GLuint list )
01743 {
01744   __ASSERT(glContext && glContext->m_glFunctions);
01745   __ASSERT(!!glContext->isDisplayList(list)==!!glIsList(list));
01746   return glContext->isDisplayList(list);
01747 }
01748 
01750 
01751 inline  GLboolean GLIsOcclusionQuery( GLuint id )
01752 {
01753   __ASSERT(glContext->m_glFunctions && glContext->m_glFunctions->glIsOcclusionQueryNV);
01754   __ASSERT(!!glContext->isOcclusionQuery(id)==!!glContext->m_glFunctions->glIsOcclusionQueryNV(id));
01755   return glContext->m_glFunctions->glIsOcclusionQueryNV(id);
01756 }
01757 
01759 
01760 inline  GLboolean GLIsProgram(GLuint id)
01761 {
01762   __ASSERT(glContext->m_glFunctions && glContext->m_glFunctions->glIsProgramNV);
01763   __ASSERT(!!glContext->isProgram(id)==!!glContext->m_glFunctions->glIsProgramNV(id));
01764   return glContext->isProgram(id);
01765 }
01766 
01768 
01769 inline  GLboolean GLIsQuery( GLuint id )
01770 {
01771   __ASSERT(glContext->m_glFunctions && glContext->m_glFunctions->glIsQueryARB);
01772   __ASSERT(!!glContext->isQuery(id)==!!glContext->m_glFunctions->glIsQueryARB(id));
01773   return glContext->isQuery(id);
01774 }
01775 
01777 
01778 inline  GLboolean GLIsTexture( GLuint texture )
01779 {
01780   __ASSERT(glContext && glContext->m_glFunctions);
01781   __ASSERT(!!glContext->isTexture(texture)==!!glIsTexture(texture));
01782   return(glContext->isTexture(texture));
01783 }
01784 
01786 
01787 inline  void  GLLightf( GLenum light, GLenum pname, GLfloat param ) 
01788 { 
01789   glLightf( light, pname, param );
01790   ASSERT_GL_NO_ERROR;
01791 }
01792 
01794 
01796 inline  void  GLLightfv( GLenum light, GLenum pname, const GLfloat *params ) 
01797 {
01798   glLightfv( light, pname, params );
01799   ASSERT_GL_NO_ERROR;
01800 }
01801 
01803 
01804 inline  void  GLLighti( GLenum light, GLenum pname, GLint param ) 
01805 { 
01806   glLighti( light, pname, param );
01807   ASSERT_GL_NO_ERROR;
01808 }
01809 
01811 
01812 inline  void  GLLightiv( GLenum light, GLenum pname, GLint *params ) 
01813 { 
01814   glLightiv( light, pname, params );
01815   ASSERT_GL_NO_ERROR;
01816 }
01817 
01819 
01820 inline  void  GLLightModelf( GLenum pname, GLfloat param )  
01821 {
01822   glLightModelf( pname, param );
01823   ASSERT_GL_NO_ERROR;
01824 }
01825 
01827 
01828 inline  void  GLLightModelfv( GLenum pname, const GLfloat *params ) 
01829 { 
01830   glLightModelfv( pname, params );
01831 }
01832 
01834 
01835 inline  void  GLLightModeli( GLenum pname, GLint param )  
01836 { 
01837   glLightModeli( pname, param );
01838   ASSERT_GL_NO_ERROR;
01839 }
01840 
01842 
01843 inline  void  GLLightModeliv( GLenum pname, const GLint *params ) 
01844 { 
01845   glLightModeliv( pname, params );
01846   ASSERT_GL_NO_ERROR;
01847 }
01848 
01850 
01851 inline  void  GLLineStipple( GLint factor, GLushort pattern )
01852 {
01853   glLineStipple( factor, pattern );
01854   ASSERT_GL_NO_ERROR;
01855 }
01856 
01858 
01859 inline  void  GLLineWidth( GLfloat width )
01860 {
01861   glLineWidth( width );
01862   ASSERT_GL_NO_ERROR;
01863 }
01864 
01866 
01867 inline  void  GLListBase( GLuint base )
01868 {
01869   glListBase( base );
01870   ASSERT_GL_NO_ERROR;
01871 }
01872 
01874 
01875 inline  void  GLLoadIdentity( void )
01876 {
01877   glLoadIdentity();
01878   ASSERT_GL_NO_ERROR;
01879 }
01880 
01882 
01883 inline  void  GLLoadMatrixd( const GLdouble *m )
01884 {
01885   glLoadMatrixd( m );
01886   ASSERT_GL_NO_ERROR;
01887 }
01888 
01890 
01891 inline  void  GLLoadMatrixf( const GLfloat *m )
01892 {
01893   glLoadMatrixf( m );
01894   ASSERT_GL_NO_ERROR;
01895 }
01896 
01898 
01899 inline  void  GLLoadName( GLuint name )
01900 {
01901   glLoadName( name );
01902   ASSERT_GL_NO_ERROR;
01903 }
01904 
01906 
01907 inline  void  GLLoadProgram( GLenum target, GLuint id, GLsizei len, const GLubyte *program )
01908 {
01909   __ASSERT( glContext->m_glFunctions && glContext->m_glFunctions->glLoadProgramNV );
01910   glContext->m_glFunctions->glLoadProgramNV( target, id, len, program );
01911 #if defined( _DEBUG )
01912   ASSERT_GL_NO_ERROR;
01913   GLint errorPos;
01914   glGetIntegerv( GL_PROGRAM_ERROR_POSITION_NV, &errorPos );
01915   __ASSERT( errorPos == -1 );
01916 #endif
01917 }
01918 
01920 
01921 inline  void  GLLogicOp( GLenum opcode )
01922 {
01923   glLogicOp( opcode );
01924   ASSERT_GL_NO_ERROR;
01925 }
01926 
01928 
01929 inline  void  GLMap1d( GLenum target, GLdouble u1, GLdouble u2, GLint stride, GLint order, const GLdouble *points )
01930 {
01931   glMap1d( target, u1, u2, stride, order, points );
01932   ASSERT_GL_NO_ERROR;
01933 }
01934 
01936 
01937 inline  void  GLMap1f( GLenum target, GLfloat u1, GLfloat u2, GLint stride, GLint order, const GLfloat *points )
01938 {
01939   glMap1f( target, u1, u2, stride, order, points );
01940   ASSERT_GL_NO_ERROR;
01941 }
01942 
01944 
01945 inline  void  GLMap2d( GLenum target, GLdouble u1, GLdouble u2, GLint ustride, GLint uorder, GLdouble v1, GLdouble v2, GLint vstride, GLint vorder, const GLdouble *points )
01946 {
01947   glMap2d( target, u1, u2, ustride, uorder, v1, v2, vstride, vorder, points );
01948   ASSERT_GL_NO_ERROR;
01949 }
01950 
01952 
01953 inline  void  GLMap2f( GLenum target, GLfloat u1, GLfloat u2, GLint ustride, GLint uorder, GLfloat v1, GLfloat v2, GLint vstride, GLint vorder, const GLfloat *points )
01954 {
01955   glMap2f( target, u1, u2, ustride, uorder, v1, v2, vstride, vorder, points );
01956   ASSERT_GL_NO_ERROR;
01957 }
01958 
01960 
01961 inline  void  GLMapGrid1d( GLint un, GLdouble u1, GLdouble u2 )
01962 {
01963   glMapGrid1d( un, u1, u2 );
01964   ASSERT_GL_NO_ERROR;
01965 }
01966 
01968 
01969 inline  void  GLMapGrid1f( GLint un, GLfloat u1, GLfloat u2 )
01970 {
01971   glMapGrid1f( un, u1, u2 );
01972   ASSERT_GL_NO_ERROR;
01973 }
01974 
01976 
01977 inline  void  GLMapGrid2d( GLint un, GLdouble u1, GLdouble u2, GLint vn, GLdouble v1, GLdouble v2 )
01978 {
01979   glMapGrid2d( un, u1, u2, vn, v1, v2 );
01980   ASSERT_GL_NO_ERROR;
01981 }
01982 
01984 
01985 inline  void  GLMapGrid2f( GLint un, GLfloat u1, GLfloat u2, GLint vn, GLfloat v1, GLfloat v2 )
01986 {
01987   glMapGrid2f( un, u1, u2, vn, v1, v2 );
01988   ASSERT_GL_NO_ERROR;
01989 }
01990 
01992 
01993 inline  void  GLMaterialf( GLenum face, GLenum pname, const GLfloat param ) 
01994 {
01995   glMaterialf( face, pname, param );
01996   ASSERT_GL_NO_ERROR;
01997 }
01998 
02000 
02001 inline  void  GLMaterialfv( GLenum face, GLenum pname, const GLfloat *params )  
02002 { 
02003   glMaterialfv( face, pname, params );
02004   ASSERT_GL_NO_ERROR;
02005 }
02006 
02008 
02009 inline  void  GLMateriali( GLenum face, GLenum pname, const GLint param ) 
02010 { 
02011   glMateriali( face, pname, param );
02012   ASSERT_GL_NO_ERROR;
02013 }
02014 
02016 
02017 inline  void  GLMaterialiv( GLenum face, GLenum pname, const GLint *params )
02018 {
02019   glMaterialiv( face, pname, params );
02020   ASSERT_GL_NO_ERROR;
02021 }
02022 
02024 
02025 inline  void  GLMatrixMode( GLenum mode )
02026 {
02027   glMatrixMode( mode );
02028   ASSERT_GL_NO_ERROR;
02029 }
02030 
02032 
02033 inline  void  GLMultiTexCoord2f( GLenum texture, GLfloat tx, GLfloat ty )
02034 {
02035   __ASSERT( glContext->m_glFunctions && glContext->m_glFunctions->glMultiTexCoord2f );
02036   glContext->m_glFunctions->glMultiTexCoord2f( texture, tx, ty );
02037   ASSERT_GL_NO_ERROR_IN_BEGIN_END;
02038 }
02039 
02041 
02042 inline  void  GLMultMatrixd( const GLdouble *m )
02043 {
02044   glMultMatrixd( m );
02045   ASSERT_GL_NO_ERROR;
02046 }
02047 
02049 
02050 inline  void  GLMultMatrixf( const GLfloat *m )
02051 {
02052   glMultMatrixf( m );
02053   ASSERT_GL_NO_ERROR;
02054 }
02055 
02057 
02058 inline  void  GLNewList( GLuint list, GLenum mode )
02059 {
02060   glNewList( list, mode );
02061   ASSERT_GL_NO_ERROR;
02062 }
02063 
02065 
02066 inline  void  GLNormal3b( GLbyte nx, GLbyte ny, GLbyte nz )
02067 {
02068   glNormal3b( nx, ny, nz );
02069   ASSERT_GL_NO_ERROR_IN_BEGIN_END;
02070 }
02071 
02073 
02074 inline  void  GLNormal3bv( const GLbyte *v )
02075 {
02076   glNormal3bv( v );
02077   ASSERT_GL_NO_ERROR_IN_BEGIN_END;
02078 }
02079 
02081 
02082 inline  void  GLNormal3d( GLdouble nx, GLdouble ny, GLdouble nz )
02083 {
02084   glNormal3d( nx, ny, nz );
02085   ASSERT_GL_NO_ERROR_IN_BEGIN_END;
02086 }
02087 
02089 
02090 inline  void  GLNormal3dv( const GLdouble *v )
02091 {
02092   glNormal3dv( v );
02093   ASSERT_GL_NO_ERROR_IN_BEGIN_END;
02094 }
02095 
02097 
02098 inline  void  GLNormal3f( GLfloat nx, GLfloat ny, GLfloat nz )
02099 {
02100   glNormal3f( nx, ny, nz );
02101   ASSERT_GL_NO_ERROR_IN_BEGIN_END;
02102 }
02103 
02105 
02106 inline  void  GLNormal3fv( const GLfloat *v )
02107 {
02108   glNormal3fv( v );
02109   ASSERT_GL_NO_ERROR_IN_BEGIN_END;
02110 }
02111 
02113 
02114 inline  void  GLNormal3i( GLint nx, GLint ny, GLint nz )
02115 {
02116   glNormal3i( nx, ny, nz );
02117   ASSERT_GL_NO_ERROR_IN_BEGIN_END;
02118 }
02119 
02121 
02122 inline  void  GLNormal3iv( const GLint *v )
02123 {
02124   glNormal3iv( v );
02125   ASSERT_GL_NO_ERROR_IN_BEGIN_END;
02126 }
02127 
02129 
02130 inline  void  GLNormal3s( GLshort nx, GLshort ny, GLshort nz )
02131 {
02132   glNormal3s( nx, ny, nz );
02133   ASSERT_GL_NO_ERROR_IN_BEGIN_END;
02134 }
02135 
02137 
02138 inline  void  GLNormal3sv( const GLshort *v )
02139 {
02140   glNormal3sv( v );
02141   ASSERT_GL_NO_ERROR_IN_BEGIN_END;
02142 }
02143 
02145 
02146 inline  void  GLNormalPointer( GLenum type, GLsizei stride, const GLvoid *pointer )
02147 {
02148   glNormalPointer( type, stride, pointer );
02149   ASSERT_GL_NO_ERROR;
02150 }
02151 
02153 
02154 inline  void  GLOrtho( GLdouble left, GLdouble right, GLdouble bottom, GLdouble top, GLdouble zNear, GLdouble zFar )
02155 {
02156   glOrtho( left, right, bottom, top, zNear, zFar );
02157   ASSERT_GL_NO_ERROR;
02158 }
02159 
02161 
02162 inline  void  GLPassThrough( GLfloat token )
02163 {
02164   glPassThrough( token );
02165   ASSERT_GL_NO_ERROR;
02166 }
02167 
02169 
02170 inline  void  GLPixelMapfv( GLenum map, GLsizei mapsize, const GLfloat *values )
02171 {
02172   glPixelMapfv( map, mapsize, values );
02173   ASSERT_GL_NO_ERROR;
02174 }
02175 
02177 
02178 inline  void  GLPixelMapuiv( GLenum map, GLsizei mapsize, const GLuint *values )
02179 {
02180   glPixelMapuiv( map, mapsize, values );
02181   ASSERT_GL_NO_ERROR;
02182 }
02183 
02185 
02186 inline  void  GLPixelMapusv( GLenum map, GLsizei mapsize, const GLushort *values )
02187 {
02188   glPixelMapusv( map, mapsize, values );
02189   ASSERT_GL_NO_ERROR;
02190 }
02191 
02193 
02194 inline  void  GLPixelStoref( GLenum pname, GLfloat param )
02195 {
02196   glPixelStoref( pname, param );
02197   ASSERT_GL_NO_ERROR;
02198 }
02199 
02201 
02202 inline  void  GLPixelStorei( GLenum pname, GLint param )
02203 {
02204   glPixelStorei( pname, param );
02205   ASSERT_GL_NO_ERROR;
02206 }
02207 
02209 
02210 inline  void  GLPixelTransferf( GLenum pname, GLfloat param )
02211 {
02212   glPixelTransferf( pname, param );
02213   ASSERT_GL_NO_ERROR;
02214 }
02215 
02217 
02218 inline  void  GLPixelTransferi( GLenum pname, GLint param )
02219 {
02220   glPixelTransferi( pname, param );
02221   ASSERT_GL_NO_ERROR;
02222 }
02223 
02225 
02226 inline  void  GLPixelZoom( GLfloat xfactor, GLfloat yfactor )
02227 {
02228   glPixelZoom( xfactor, yfactor );
02229   ASSERT_GL_NO_ERROR;
02230 }
02231 
02233 
02234 inline  void  GLPointSize( GLfloat size )
02235 {
02236   glPointSize( size );
02237   ASSERT_GL_NO_ERROR;
02238 }
02239 
02241 
02242 inline  void  GLPolygonMode( GLenum face, GLenum mode ) 
02243 {
02244   glPolygonMode( face, mode );
02245   ASSERT_GL_NO_ERROR;
02246 }
02247 
02249 
02250 inline  void  GLPolygonOffset( GLfloat factor, GLfloat units )
02251 {
02252   glPolygonOffset( factor, units );
02253   ASSERT_GL_NO_ERROR;
02254 }
02255 
02257 
02258 inline  void  GLPolygonStipple( const GLubyte *mask )
02259 {
02260   glPolygonStipple( mask );
02261   ASSERT_GL_NO_ERROR;
02262 }
02263 
02265 
02266 inline  void  GLPopAttrib( void )
02267 {
02268   glPopAttrib();
02269   ASSERT_GL_NO_ERROR;
02270 }
02271 
02273 
02274 inline  void  GLPopClientAttrib( void )
02275 {
02276   glPopClientAttrib();
02277   ASSERT_GL_NO_ERROR;
02278 }
02279 
02281 
02282 inline  void  GLPopMatrix( void )
02283 {
02284   glPopMatrix();
02285   ASSERT_GL_NO_ERROR;
02286 }
02287 
02289 
02290 inline  void  GLPopName( void )
02291 {
02292   glPopName();
02293   ASSERT_GL_NO_ERROR;
02294 }
02295 
02297 
02298 inline  void  GLPrioritizeTextures( GLsizei n, const GLuint *textures, const GLclampf *priorities )
02299 {
02300   glPrioritizeTextures( n, textures, priorities );
02301   ASSERT_GL_NO_ERROR;
02302 }
02303 
02305 
02306 inline  void  GLProgramNamedParameter4f( GLuint id, GLsizei len, const GLubyte *name, GLfloat x, GLfloat y, GLfloat z, GLfloat w )
02307 {
02308   __ASSERT( glContext->m_glFunctions && glContext->m_glFunctions->glProgramNamedParameter4fNV );
02309   glContext->m_glFunctions->glProgramNamedParameter4fNV( id, len, name, x, y, z, w );
02310   ASSERT_GL_NO_ERROR;
02311 }
02312 
02314 
02315 inline  void  GLPushAttrib( GLbitfield mask )
02316 {
02317   glPushAttrib( mask );
02318   ASSERT_GL_NO_ERROR;
02319 }
02320 
02322 
02323 inline  void  GLPushClientAttrib( GLbitfield mask )
02324 {
02325   glPushClientAttrib( mask );
02326   ASSERT_GL_NO_ERROR;
02327 }
02328 
02330 
02331 inline  void  GLPushMatrix( void )
02332 {
02333   glPushMatrix();
02334   ASSERT_GL_NO_ERROR;
02335 }
02336 
02338 
02339 inline  void  GLPushName( GLuint name )
02340 {
02341   glPushName( name );
02342   ASSERT_GL_NO_ERROR;
02343 }
02344 
02346 
02347 inline  void  GLRasterPos2d( GLdouble x, GLdouble y )
02348 {
02349   glRasterPos2d( x, y );
02350   ASSERT_GL_NO_ERROR;
02351 }
02352 
02354 
02355 inline  void  GLRasterPos2f( GLfloat x, GLfloat y )
02356 {
02357   glRasterPos2f( x, y );
02358   ASSERT_GL_NO_ERROR;
02359 }
02360 
02362 
02363 inline  void  GLRasterPos2i( GLint x, GLint y )
02364 {
02365   glRasterPos2i( x, y );
02366   ASSERT_GL_NO_ERROR;
02367 }
02368 
02370 
02371 inline  void  GLRasterPos2s( GLshort x, GLshort y )
02372 {
02373   glRasterPos2s( x, y );
02374   ASSERT_GL_NO_ERROR;
02375 }
02376 
02378 
02379 inline  void  GLRasterPos3d( GLdouble x, GLdouble y, GLdouble z )
02380 {
02381   glRasterPos3d( x, y, z );
02382   ASSERT_GL_NO_ERROR;
02383 }
02384 
02386 
02387 inline  void  GLRasterPos3f( GLfloat x, GLfloat y, GLfloat z )
02388 {
02389   glRasterPos3f( x, y, z );
02390   ASSERT_GL_NO_ERROR;
02391 }
02392 
02394 
02395 inline  void  GLRasterPos3i( GLint x, GLint y, GLint z )
02396 {
02397   glRasterPos3i( x, y, z );
02398   ASSERT_GL_NO_ERROR;
02399 }
02400 
02402 
02403 inline  void  GLRasterPos3s( GLshort x, GLshort y, GLshort z )
02404 {
02405   glRasterPos3s( x, y, z );
02406   ASSERT_GL_NO_ERROR;
02407 }
02408 
02410 
02411 inline  void  GLRasterPos4d( GLdouble x, GLdouble y, GLdouble z, GLdouble w )
02412 {
02413   glRasterPos4d( x, y, z, w );
02414   ASSERT_GL_NO_ERROR;
02415 }
02416 
02418 
02419 inline  void  GLRasterPos4f( GLfloat x, GLfloat y, GLfloat z, GLfloat w )
02420 {
02421   glRasterPos4f( x, y, z, w );
02422   ASSERT_GL_NO_ERROR;
02423 }
02424 
02426 
02427 inline  void  GLRasterPos4i( GLint x, GLint y, GLint z, GLint w )
02428 {
02429   glRasterPos4i( x, y, z, w );
02430   ASSERT_GL_NO_ERROR;
02431 }
02432 
02434 
02435 inline  void  GLRasterPos4s( GLshort x, GLshort y, GLshort z, GLshort w )
02436 {
02437   glRasterPos4s( x, y, z, w );
02438   ASSERT_GL_NO_ERROR;
02439 }
02440 
02442 
02443 inline  void  GLReadBuffer( GLenum mode ) 
02444 { 
02445   glReadBuffer( mode );
02446   ASSERT_GL_NO_ERROR;
02447 }
02448 
02450 
02451 inline  void  GLReadPixels( GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLvoid *pixels )
02452 {
02453   glReadPixels( x, y, width, height, format, type, pixels );
02454   ASSERT_GL_NO_ERROR;
02455 }
02456 
02458 
02459 inline  void  GLRectd( GLdouble x1, GLdouble y1, GLdouble x2, GLdouble y2 )
02460 {
02461   glRectd( x1, y1, x2, y2 );
02462   ASSERT_GL_NO_ERROR;
02463 }
02464 
02466 
02467 inline  void  GLRectf( GLfloat x1, GLfloat y1, GLfloat x2, GLfloat y2 )
02468 {
02469   glRectf( x1, y1, x2, y2 );
02470   ASSERT_GL_NO_ERROR;
02471 }
02472 
02474 
02475 inline  void  GLRecti( GLint x1, GLint y1, GLint x2, GLint y2 )
02476 {
02477   glRecti( x1, y1, x2, y2 );
02478   ASSERT_GL_NO_ERROR;
02479 }
02480 
02482 
02483 inline  void  GLRects( GLshort x1, GLshort y1, GLshort x2, GLshort y2 )
02484 {
02485   glRects( x1, y1, x2, y2 );
02486   ASSERT_GL_NO_ERROR;
02487 }
02488 
02490 
02491 inline  void  GLRenderMode( GLenum mode )
02492 {
02493   glRenderMode( mode );
02494   ASSERT_GL_NO_ERROR;
02495 }
02496 
02498 
02499 inline  void  GLRotated( GLdouble angle, GLdouble x, GLdouble y, GLdouble z )
02500 {
02501   glRotated( angle, x, y, z );
02502   ASSERT_GL_NO_ERROR;
02503 }
02504 
02506 
02507 inline  void  GLRotatef( GLfloat angle, GLfloat x, GLfloat y, GLfloat z )
02508 {
02509   glRotatef( angle, x, y, z );
02510   ASSERT_GL_NO_ERROR;
02511 }
02512 
02514 
02515 inline  void  GLScaled( GLdouble x, GLdouble y, GLdouble z )
02516 {
02517   glScaled( x, y, z );
02518   ASSERT_GL_NO_ERROR;
02519 }
02520 
02522 
02523 inline  void  GLScalef( GLfloat x, GLfloat y, GLfloat z )
02524 {
02525   glScalef( x, y, z );
02526   ASSERT_GL_NO_ERROR;
02527 }
02528 
02530 
02531 inline  void  GLScissor( GLint x, GLint y, GLsizei width, GLsizei height )
02532 {
02533   glScissor( x, y, width, height );
02534   ASSERT_GL_NO_ERROR;
02535 }
02536 
02538 
02539 inline  void  GLSecondaryColorPointer( GLint size, GLenum type, GLsizei stride, const GLvoid *pointer )
02540 {
02541   glContext->m_glFunctions->glSecondaryColorPointer( size, type, stride, pointer );
02542   ASSERT_GL_NO_ERROR;
02543 }
02544 
02546 
02547 inline  void  GLSelectBuffer( GLsizei size, GLuint *buffer )
02548 {
02549   glSelectBuffer( size, buffer );
02550   ASSERT_GL_NO_ERROR;
02551 }
02552 
02554 
02555 inline  void  GLSetWindowStereoMode( GLboolean displayMode )
02556 {
02557   __ASSERT( glContext->m_glFunctions );
02558   if ( glContext->m_glFunctions->glSetWindowStereoModeNV )
02559   {
02560     glContext->m_glFunctions->glSetWindowStereoModeNV( displayMode );
02561     ASSERT_GL_NO_ERROR;
02562   }
02563 }
02564 
02566 
02567 inline  void  GLShadeModel( GLenum mode )
02568 {
02569   glShadeModel( mode );
02570   ASSERT_GL_NO_ERROR;
02571 }
02572 
02574 
02575 inline  void  GLStencilFunc( GLenum func, GLint ref, GLuint mask )
02576 {
02577   glStencilFunc( func, ref, mask );
02578   ASSERT_GL_NO_ERROR;
02579 }
02580 
02582 
02583 inline  void  GLStencilMask( GLuint mask )
02584 {
02585   glStencilMask( mask );
02586   ASSERT_GL_NO_ERROR;
02587 }
02588 
02590 
02591 inline  void  GLStencilOp( GLenum fail, GLenum zfail, GLenum zpass )
02592 {
02593   glStencilOp( fail, zfail, zpass );
02594   ASSERT_GL_NO_ERROR;
02595 }
02596 
02598 
02599 inline  void  GLTexCoord1d( GLdouble s )
02600 {
02601   glTexCoord1d( s );
02602   ASSERT_GL_NO_ERROR_IN_BEGIN_END;
02603 }
02604 
02606 
02607 inline  void  GLTexCoord1f( GLfloat s )
02608 {
02609   glTexCoord1f( s );
02610   ASSERT_GL_NO_ERROR_IN_BEGIN_END;
02611 }
02612 
02614 
02615 inline  void  GLTexCoord1i( GLint s )
02616 {
02617   glTexCoord1i( s );
02618   ASSERT_GL_NO_ERROR_IN_BEGIN_END;
02619 }
02620 
02622 
02623 inline  void  GLTexCoord1s( GLshort s )
02624 {
02625   glTexCoord1s( s );
02626   ASSERT_GL_NO_ERROR_IN_BEGIN_END;
02627 }
02628 
02630 
02631 inline  void  GLTexCoord2d( GLdouble s, GLdouble t )
02632 {
02633   glTexCoord2d( s, t );
02634   ASSERT_GL_NO_ERROR_IN_BEGIN_END;
02635 }
02636 
02638 
02639 inline  void  GLTexCoord2f( GLfloat s, GLfloat t )
02640 {
02641   glTexCoord2f( s, t );
02642   ASSERT_GL_NO_ERROR_IN_BEGIN_END;
02643 }
02644 
02646 
02647 inline  void  GLTexCoord2fv( const GLfloat *v )
02648 {
02649   glTexCoord2fv( v );
02650   ASSERT_GL_NO_ERROR_IN_BEGIN_END;
02651 }
02652 
02654 
02655 inline  void  GLTexCoord2i( GLint s, GLint t )
02656 {
02657   glTexCoord2i( s, t );
02658   ASSERT_GL_NO_ERROR_IN_BEGIN_END;
02659 }
02660 
02662 
02663 inline  void  GLTexCoord2s( GLshort s, GLshort t )
02664 {
02665   glTexCoord2s( s, t );
02666   ASSERT_GL_NO_ERROR_IN_BEGIN_END;
02667 }
02668 
02670 
02671 inline  void  GLTexCoord3d( GLdouble s, GLdouble t, GLdouble r )
02672 {
02673   glTexCoord3d( s, t, r );
02674   ASSERT_GL_NO_ERROR_IN_BEGIN_END;
02675 }
02676 
02678 
02679 inline  void  GLTexCoord3f( GLfloat s, GLfloat t, GLfloat r )
02680 {
02681   glTexCoord3f( s, t, r );
02682   ASSERT_GL_NO_ERROR_IN_BEGIN_END;
02683 }
02684 
02686 
02687 inline  void  GLTexCoord3i( GLint s, GLint t, GLint r )
02688 {
02689   glTexCoord3i( s, t, r );
02690   ASSERT_GL_NO_ERROR_IN_BEGIN_END;
02691 }
02692 
02694 
02695 inline  void  GLTexCoord3s( GLshort s, GLshort t, GLshort r )
02696 {
02697   glTexCoord3s( s, t, r );
02698   ASSERT_GL_NO_ERROR_IN_BEGIN_END;
02699 }
02700 
02702 
02703 inline  void  GLTexCoord4d( GLdouble s, GLdouble t, GLdouble r, GLdouble q )
02704 {
02705   glTexCoord4d( s, t, r, q );
02706   ASSERT_GL_NO_ERROR_IN_BEGIN_END;
02707 }
02708 
02710 
02711 inline  void  GLTexCoord4f( GLfloat s, GLfloat t, GLfloat r, GLfloat q )
02712 {
02713   glTexCoord4f( s, t, r, q );
02714   ASSERT_GL_NO_ERROR_IN_BEGIN_END;
02715 }
02716 
02718 
02719 inline  void  GLTexCoord4i( GLint s, GLint t, GLint r, GLint q )
02720 {
02721   glTexCoord4i( s, t, r, q );
02722   ASSERT_GL_NO_ERROR_IN_BEGIN_END;
02723 }
02724 
02726 
02727 inline  void  GLTexCoord4s( GLshort s, GLshort t, GLshort r, GLshort q )
02728 {
02729   glTexCoord4s( s, t, r, q );
02730   ASSERT_GL_NO_ERROR_IN_BEGIN_END;
02731 }
02732 
02734 
02735 inline  void  GLTexCoordPointer( GLint size, GLenum type, GLsizei stride, const GLvoid *pointer )
02736 {
02737   glTexCoordPointer( size, type, stride, pointer );    
02738   ASSERT_GL_NO_ERROR;
02739 }
02740 
02742 
02743 inline  void  GLTexEnvf( GLenum target, GLenum pname, GLfloat param )
02744 {
02745   glTexEnvf( target, pname, param );
02746   ASSERT_GL_NO_ERROR;
02747 }
02748 
02750 
02751 inline  void  GLTexEnvfv( GLenum target, GLenum pname, const GLfloat *params )
02752 {
02753   glTexEnvfv( target, pname, params );
02754   ASSERT_GL_NO_ERROR;
02755 }
02756 
02758 
02759 inline  void  GLTexEnvi( GLenum target, GLenum pname, GLint param )
02760 {
02761   glTexEnvi( target, pname, param );
02762   ASSERT_GL_NO_ERROR;
02763 }
02764 
02766 
02767 inline  void  GLTexEnviv( GLenum target, GLenum pname, const GLint *params )
02768 {
02769   glTexEnviv( target, pname, params );
02770   ASSERT_GL_NO_ERROR;
02771 }
02772 
02774 
02775 inline  void  GLTexGend( GLenum coord, GLenum pname, GLdouble param )
02776 {
02777   glTexGend( coord, pname, param );
02778   ASSERT_GL_NO_ERROR;
02779 }
02780 
02782 
02783 inline  void  GLTexGenf( GLenum coord, GLenum pname, GLfloat param )
02784 {
02785   glTexGenf( coord, pname, param );
02786   ASSERT_GL_NO_ERROR;
02787 }
02788 
02790 
02791 inline  void  GLTexGenfv( GLenum coord, GLenum pname, const GLfloat *param )
02792 {
02793   glTexGenfv( coord, pname, param );
02794   ASSERT_GL_NO_ERROR;
02795 }
02796 
02798 
02799 inline  void  GLTexGeni( GLenum coord, GLenum pname, GLint param )
02800 {
02801   glTexGeni( coord, pname, param );
02802   ASSERT_GL_NO_ERROR;
02803 }
02804 
02806 
02807 inline  void  GLTexImage1D( GLenum target, GLint level, GLint internalformat, GLsizei width, GLint border, GLenum format, GLenum type, const GLvoid *pixels )
02808 {
02809   glTexImage1D( target, level, internalformat, width, border, format, type, pixels );
02810   ASSERT_GL_NO_ERROR;
02811 }
02812 
02814 
02815 inline  void  GLTexImage2D( GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const GLvoid *pixels )
02816 {
02817   glTexImage2D( target, level, internalformat, width, height, border, format, type, pixels );
02818   ASSERT_GL_NO_ERROR;
02819 }
02820 
02822 
02823 inline  void  GLTexImage3D( GLenum target, int level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, int border, GLenum format, GLenum type, const void* pixels)
02824 {
02825   __ASSERT( glContext->m_glFunctions && glContext->m_glFunctions->glTexImage3D );
02826   glContext->m_glFunctions->glTexImage3D( target, level, internalformat, width, height, depth, border, format, type, pixels );
02827   ASSERT_GL_NO_ERROR;
02828 }
02829 
02831 
02832 inline  void  GLTexParameterf( GLenum target, GLenum pname, GLfloat param )
02833 {
02834   glTexParameterf( target, pname, param );
02835   ASSERT_GL_NO_ERROR;
02836 }
02837 
02839 
02840 inline  void  GLTexParameteri( GLenum target, GLenum pname, GLint param )
02841 {
02842   glTexParameteri( target, pname, param );
02843   ASSERT_GL_NO_ERROR;
02844 }
02845 
02847 
02848 inline  void  GLTexParameterfv( GLenum target, GLenum pname, const GLfloat *params )
02849 {
02850   glTexParameterfv( target, pname, params );
02851   ASSERT_GL_NO_ERROR;
02852 }
02853 
02855 
02856 inline  void  GLTexParameteriv( GLenum target, GLenum pname, const GLint *params )
02857 {
02858   glTexParameteriv( target, pname, params );
02859   ASSERT_GL_NO_ERROR;
02860 }
02861 
02863 
02864 inline  void  GLTexSubImage1D( GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLenum type, const GLvoid *pixels )
02865 {
02866   glTexSubImage1D( target, level, xoffset, width, format, type, pixels );
02867   ASSERT_GL_NO_ERROR;
02868 }
02869 
02871 
02872 inline  void  GLTexSubImage2D( GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *pixels )
02873 {
02874   glTexSubImage2D( target, level, xoffset, yoffset, width, height, format, type, pixels );
02875   ASSERT_GL_NO_ERROR;
02876 }
02877 
02879 
02880 inline  void  GLTranslated( GLdouble x, GLdouble y, GLdouble z )
02881 {
02882   glTranslated( x, y, z );
02883   ASSERT_GL_NO_ERROR;
02884 }
02885 
02887 
02888 inline  void  GLTranslatef( GLfloat x, GLfloat y, GLfloat z )
02889 {
02890   glTranslatef( x, y, z );
02891   ASSERT_GL_NO_ERROR;
02892 }
02893 
02895 
02896 inline  void  GLVertex2d( GLdouble x, GLdouble y )
02897 {
02898   glVertex2d( x, y );
02899   ASSERT_GL_NO_ERROR_IN_BEGIN_END;
02900 }
02901 
02903 
02904 inline  void  GLVertex2f( GLfloat x, GLfloat y )
02905 {
02906   glVertex2f( x, y );
02907   ASSERT_GL_NO_ERROR_IN_BEGIN_END;
02908 }
02909 
02911 
02912 inline  void  GLVertex2i( GLint x, GLint y )
02913 {
02914   glVertex2i( x, y );
02915   ASSERT_GL_NO_ERROR_IN_BEGIN_END;
02916 }
02917 
02919 
02920 inline  void  GLVertex2s( GLshort x, GLshort y )
02921 {
02922   glVertex2s( x, y );
02923   ASSERT_GL_NO_ERROR_IN_BEGIN_END;
02924 }
02925 
02927 
02928 inline  void  GLVertex3d( GLdouble x, GLdouble y, GLdouble z )
02929 {
02930   glVertex3d( x, y, z );
02931   ASSERT_GL_NO_ERROR_IN_BEGIN_END;
02932 }
02933 
02935 
02936 inline  void  GLVertex3f( GLfloat x, GLfloat y, GLfloat z )
02937 {
02938   glVertex3f( x, y, z );
02939   ASSERT_GL_NO_ERROR_IN_BEGIN_END;
02940 }
02941 
02943 
02944 inline  void  GLVertex3fv( const GLfloat *v )
02945 {
02946   glVertex3fv( v );
02947   ASSERT_GL_NO_ERROR_IN_BEGIN_END;
02948 }
02949 
02951 
02952 inline  void  GLVertex3i( GLint x, GLint y, GLint z )
02953 {
02954   glVertex3i( x, y, z );
02955   ASSERT_GL_NO_ERROR_IN_BEGIN_END;
02956 }
02957 
02959 
02960 inline  void  GLVertex3s( GLshort x, GLshort y, GLshort z )
02961 {
02962   glVertex3s( x, y, z );
02963   ASSERT_GL_NO_ERROR_IN_BEGIN_END;
02964 }
02965 
02967 
02968 inline  void  GLVertex4d( GLdouble x, GLdouble y, GLdouble z, GLdouble w )
02969 {
02970   glVertex4d( x, y, z, w );
02971   ASSERT_GL_NO_ERROR_IN_BEGIN_END;
02972 }
02973 
02975 
02976 inline  void  GLVertex4f( GLfloat x, GLfloat y, GLfloat z, GLfloat w )
02977 {
02978   glVertex4f( x, y, z, w );
02979   ASSERT_GL_NO_ERROR_IN_BEGIN_END;
02980 }
02981 
02983 
02984 inline  void  GLVertex4i( GLint x, GLint y, GLint z, GLint w )
02985 {
02986   glVertex4i( x, y, z, w );
02987   ASSERT_GL_NO_ERROR_IN_BEGIN_END;
02988 }
02989 
02991 
02992 inline  void  GLVertex4s( GLshort x, GLshort y, GLshort z, GLshort w )
02993 {
02994   glVertex4s( x, y, z, w );
02995   ASSERT_GL_NO_ERROR_IN_BEGIN_END;
02996 }
02997 
02999 
03000 inline  void  GLVertexPointer( GLint size, GLenum type, GLsizei stride, const GLvoid *pointer )
03001 {
03002   glVertexPointer( size, type, stride, pointer );    
03003   ASSERT_GL_NO_ERROR;
03004 }
03005 
03007 
03008 inline  void  GLViewport( GLint x, GLint y, GLsizei width, GLsizei height )
03009 {
03010   glViewport( x, y, width, height );
03011   ASSERT_GL_NO_ERROR;
03012 }
03013 
03014 #if defined(_WIN32)
03015 
03016 
03017 inline  BOOL  WGLBindTexImage( HPBUFFERARB hPbuffer, int iBuffer )
03018 {
03019   __ASSERT( glContext->m_glFunctions->wglBindTexImageARB );
03020   return glContext->m_glFunctions->wglBindTexImageARB( hPbuffer, iBuffer );
03021 }
03022 
03024 
03025 inline  BOOL  WGLChoosePixelFormat( HDC hdc, const int *piAttribIList, const FLOAT *pfAttribFList, UINT nMaxFormats, int *piFormats, UINT *nNumFormats )
03026 {
03027   __ASSERT( glContext->m_glFunctions->wglChoosePixelFormatARB );
03028   return glContext->m_glFunctions->wglChoosePixelFormatARB( hdc, piAttribIList, pfAttribFList, nMaxFormats, piFormats, nNumFormats );
03029 }
03030 
03032 
03036 inline  HGLRC WGLCreateContext( HDC hdc )
03037 {
03038   HGLRC hglrc = wglCreateContext( hdc );
03039   WGLAttachContext(hdc, hglrc);
03040   return hglrc;
03041 }
03042 
03043 inline void WGLAttachContext(HDC hdc, HGLRC hglrc)
03044 {
03045   __ASSERT(hdc);
03046   __ASSERT(hglrc);
03047   // there should be no entry for the new hglrc right now
03048   __ASSERT(hglrcContextMap.end()==hglrcContextMap.find(hglrc));
03049   hglrcContextMap.insert(std::make_pair(hglrc, new GLContext(hdc, hglrc))); 
03050 }
03051 
03052 inline void WGLDetachContext(HGLRC hglrc)
03053 {
03054   std::map<HGLRC, GLContext*>::iterator it = hglrcContextMap.find( hglrc );
03055   if ( it != hglrcContextMap.end() )
03056   {
03057     __ASSERT( it->second );
03058     if ( glContext == it->second )
03059     {
03060       glContext = NULL;
03061     }
03062     it->second->exit();
03063     delete it->second;
03064     hglrcContextMap.erase( it );
03065   }
03066 }
03067 
03069 
03072 inline  HPBUFFERARB WGLCreatePbuffer( HDC hdc, int pixelFormat, int width, int height, const int *attribList )
03073 {
03074   __ASSERT( wglGetCurrentContext() != NULL );
03075   __ASSERT( glContext->m_glFunctions->wglCreatePbufferARB );
03076   HPBUFFERARB hPbuffer = glContext->m_glFunctions->wglCreatePbufferARB( hdc, pixelFormat, width, height, attribList );
03077   return( hPbuffer );
03078 }
03079 
03081 
03085 inline  BOOL  WGLDeleteContext( HGLRC hglrc )
03086 {
03087   WGLDetachContext(hglrc);
03088   return wglDeleteContext(hglrc);
03089 }
03090 
03092 
03093 inline  BOOL  WGLDestroyPbuffer( HPBUFFERARB hPbuffer )
03094 {
03095   __ASSERT(glContext->m_glFunctions->wglDestroyPbufferARB);
03096   return glContext->m_glFunctions->wglDestroyPbufferARB( hPbuffer );
03097 }
03098 
03100 
03104 inline  HGLRC  WGLGetCurrentContext(void)
03105 {
03106   return wglGetCurrentContext();
03107 }
03108 
03110 
03115 inline  HDC  WGLGetCurrentDC(void)
03116 {
03117   return wglGetCurrentDC();
03118 }
03119 
03121 
03125 inline BOOL WGLMakeCurrent( HDC hdc, HGLRC hglrc )
03126 {
03127   BOOL success = FALSE;
03128 
03129   if ( hglrc )
03130   {
03131     // lookup the context
03132     std::map<HGLRC, GLContext*>::iterator it = hglrcContextMap.find(hglrc);
03133     if ( it!=hglrcContextMap.end() )
03134     {
03135       if ( glContext == (*it).second )
03136       { // already current
03137         // should have been properly initialized if we get here!
03138         __ASSERT(glContext->m_glFunctions); 
03139         success = TRUE; // suceeded
03140       }
03141       else
03142       {
03143         success =  (hglrc==wglGetCurrentContext()) // bypassed?
03144                    // only necessary if not yet current
03145                    || wglMakeCurrent(hdc, hglrc);
03146 
03147         if ( success )
03148         { 
03149           glContext = (*it).second;
03150           if ( !glContext->m_glFunctions )
03151           { // was not initialized before
03152             glContext->init();
03153           }
03154         }
03155       }
03156     }
03157     else
03158     { // ERROR: hglrc was not attached yet 
03159       __ASSERT(!"ERROR: hglrc was not attached yet!");
03160       
03161       // Note: It is an error to call WGLMakeCurrent on a context hglrc!=NULL that has not been attached yet
03162       // either by a call to WGLCreateContext or WGLAttachContext. Hence, make the current context no longer
03163       // current (this is the same behaviour as with the original wglMakeCurrent).
03164       wglMakeCurrent(hdc, NULL);
03165       glContext = NULL;
03166     }
03167   }
03168   else 
03169   { // make the calling thread's current rendering context no longer current
03170     success = wglMakeCurrent(hdc, NULL);
03171     if ( success )
03172     { // hglrc was NULL, so the pointer to our context object should
03173       glContext = NULL;
03174     }
03175   }
03176   
03177   return success;
03178 }
03179 
03181 
03182 inline  HDC WGLGetPbufferDC( HPBUFFERARB hPbuffer )
03183 {
03184   __ASSERT( glContext->m_glFunctions->wglGetPbufferDCARB );
03185   return glContext->m_glFunctions->wglGetPbufferDCARB( hPbuffer );
03186 }
03187 
03189 
03190 inline  BOOL  WGLQueryPbuffer( HPBUFFERARB hPbuffer, int attribute, int *value )
03191 {
03192   __ASSERT( glContext->m_glFunctions->wglQueryPbufferARB );
03193   return glContext->m_glFunctions->wglQueryPbufferARB( hPbuffer, attribute, value );
03194 }
03195 
03197 
03198 inline  int WGLReleasePbufferDC( HPBUFFERARB hPbuffer, HDC hdc )
03199 {
03200   __ASSERT( glContext->m_glFunctions->wglReleasePbufferDCARB );
03201   int i = glContext->m_glFunctions->wglReleasePbufferDCARB( hPbuffer, hdc );
03202   __ASSERT( i == 1 );
03203   return( i );
03204 }
03205 
03207 
03208 inline  BOOL  WGLReleaseTexImage( HPBUFFERARB hPbuffer, int iBuffer )
03209 {
03210   __ASSERT( glContext->m_glFunctions->wglReleaseTexImageARB );
03211   return glContext->m_glFunctions->wglReleaseTexImageARB( hPbuffer, iBuffer );
03212 }
03213 
03215 
03216 inline  BOOL  WGLShareLists( HGLRC hglrc1, HGLRC hglrc2 )
03217 {
03218   if ( hglrc1 == hglrc2 )
03219   { // do nothing in case of identical contexts
03220     return TRUE;
03221   }
03222 
03223   std::map<HGLRC, GLContext*>::iterator it1 = hglrcContextMap.find(hglrc1);
03224   if ( it1 != hglrcContextMap.end() )
03225   {
03226     std::map<HGLRC, GLContext*>::iterator it2 = hglrcContextMap.find(hglrc2);
03227     if ( it2 != hglrcContextMap.end() )
03228     {
03229       (*it2).second->share(*(*it1).second);
03230     }
03231 #ifdef _DEBUG
03232     else
03233     { // hglrc probably was created by bypassing the WGLCreateContext routine
03234       __ASSERT(!"hglrc2 probably was created by bypassing the WGLCreateContext routine!");
03235     }
03236 #endif
03237   }
03238 #ifdef _DEBUG
03239   else
03240   { // hglrc probably was created by bypassing the WGLCreateContext routine
03241     __ASSERT(!"hglrc1 probably was created by bypassing the WGLCreateContext routine!");
03242   }
03243 #endif
03244 
03245   return wglShareLists( hglrc1, hglrc2 );
03246 }
03247 
03249 inline BOOL WGLJoinSwapGroupNV(HDC hDC, GLuint group)
03250 {
03251   return glContext->m_glFunctions->wglJoinSwapGroupNV(hDC, group);
03252 }
03253 
03255 inline BOOL WGLBindSwapBarrierNV(GLuint group, GLuint barrier)
03256 {
03257   return glContext->m_glFunctions->wglBindSwapBarrierNV(group, barrier);
03258 }
03259 
03261 inline BOOL WGLQuerySwapGroupNV(HDC hDC, GLuint * group, GLuint * barrier)
03262 {
03263   return glContext->m_glFunctions->wglQuerySwapGroupNV(hDC, group, barrier);
03264 }
03265 
03267 inline BOOL WGLQueryMaxSwapGroupsNV(HDC hDC, GLuint * maxGroups, GLuint * maxBarriers)
03268 {
03269   return glContext->m_glFunctions->wglQueryMaxSwapGroupsNV(hDC, maxGroups, maxBarriers);
03270 }
03271 
03273 inline BOOL WGLQueryFrameCountNV(HDC hDC, GLuint * count)
03274 {
03275   return glContext->m_glFunctions->wglQueryFrameCountNV(hDC, count);
03276 }
03277 
03279 inline BOOL WGLResetFrameCountNV(HDC hDC)
03280 {
03281   return glContext->m_glFunctions->wglResetFrameCountNV(hDC);
03282 }
03283 
03284 #elif defined(LINUX)
03285 
03286 inline GLXContext GLXCreateContext(Display *dpy, XVisualInfo *vis, GLXContext shareList, Bool direct)
03287 {
03288   GLXContext ctx = glXCreateContext(dpy, vis, shareList, direct);
03289   GLXAttachContext(dpy, ctx);
03290   return ctx;
03291 }
03292 
03294 inline void GLXDestroyContext(Display *dpy, GLXContext ctx)
03295 {
03296   GLXDetachContext(ctx);
03297   return glXDestroyContext(dpy, ctx);
03298 }
03299 
03300 inline void GLXAttachContext(Display * dpy, GLXContext ctx)
03301 {
03302   __ASSERT(dpy);
03303   __ASSERT(ctx);
03304   // there should be no entry for the new hglrc right now
03305   __ASSERT(hglrcContextMap.end()==hglrcContextMap.find(ctx));
03306   hglrcContextMap.insert(std::make_pair(ctx, new GLContext(dpy, ctx))); 
03307 }
03308 
03309 inline void GLXDetachContext(GLXContext ctx)
03310 {
03311   std::map<GLXContext, GLContext*>::iterator it = hglrcContextMap.find(ctx);
03312   if ( it != hglrcContextMap.end() )
03313   {
03314     __ASSERT((*it).second);
03315     (*it).second->exit();
03316     delete (*it).second;
03317     hglrcContextMap.erase(it);
03318   }
03319 }
03320 
03322 inline GLXContext GLXGetCurrentContext()
03323 {
03324   return glXGetCurrentContext();
03325 }
03326 
03328 inline GLXDrawable GLXGetCurrentDrawable()
03329 {
03330   return glXGetCurrentDrawable();
03331 }
03332 
03334 inline Bool GLXMakeCurrent(Display *dpy, GLXDrawable drawable, GLXContext ctx)
03335 {
03336   Bool success = False;
03337 
03338   if ( ctx )
03339   {
03340     // lookup the context
03341     std::map<GLXContext, GLContext*>::iterator it = hglrcContextMap.find(ctx);
03342     if ( it!=hglrcContextMap.end() )
03343     {
03344       if ( glContext == (*it).second )
03345       { // already current
03346         // should have been properly initialized if we get here!
03347         __ASSERT(glContext->m_glFunctions); 
03348         success = True; // suceeded
03349       }
03350       else
03351       {
03352         success =  (ctx==GLXGetCurrentContext()) // bypassed?
03353                    // only necessary if not yet current
03354                    || glXMakeCurrent(dpy, drawable, ctx);
03355 
03356         if ( success )
03357         { 
03358           glContext = (*it).second;
03359           if ( !glContext->m_glFunctions )
03360           { // was not initialized before
03361             glContext->init(drawable);
03362           }
03363         }
03364       }
03365     }
03366     else
03367     { // ERROR: ctx was not attached yet 
03368       __ASSERT(!"ERROR: ctx was not attached yet!");
03369       
03370       // Note: It is an error to call GLXMakeCurrent on a context ctx!=NULL that has not been attached yet
03371       // either by a call to GLXCreateContext or GLXAttachContext. Hence, make the current context no longer
03372       // current (this is the same behaviour as with the original glxMakeCurrent).
03373       glXMakeCurrent(dpy, None, NULL);
03374       glContext = NULL;
03375     }
03376   }
03377   else 
03378   { // make the calling thread's current rendering context no longer current
03379     success = glXMakeCurrent(dpy, None, NULL);
03380     if ( success )
03381     { // hglrc was NULL, so the pointer to our context object should
03382       glContext = NULL;
03383     }
03384   }
03385  
03386   return success;
03387 }
03388 
03389 #endif // LINUX
03390 
03391 } // namespace nvgl

Generated on Tue Mar 1 13:19:17 2005 for NVSGSDK by NVIDIA