/* Id: api1.c,v 1.3 1999/02/26 08:52:30 martin Exp $ */ /* * Mesa 3-D graphics library * Version: 3.1 * * Copyright (C) 1999 Brian Paul All Rights Reserved. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included * in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /* * Log: api1.c,v $ * Revision 1.3 1999/02/26 08:52:30 martin * Updated Mesa to the official version checked into the Mesa cvs archive * Cleaned up the XMesa interface * Fixed support for standalone Mesa * Removed several unused files in the lib/GL/mesa/src subdirectory * Moved glcore.h back to include/GL/internal/glcore.h * * Revision 3.10 1999/02/24 22:48:04 jens * Added header file to get XMesa to compile standalone and inside XFree86 * * Revision 3.9 1999/02/14 03:46:34 brianp * new copyright * * Revision 3.8 1999/01/30 04:32:05 brianp * backed out vertex buffer change * * Revision 3.7 1999/01/03 03:28:39 brianp * now using GLAPIENTRY keyword (Ted Jump) * * Revision 3.6 1998/11/29 21:50:30 brianp * initial check-in of display list / transformation optimizations * * Revision 3.5 1998/10/29 04:08:20 brianp * changed glEdgeFlagPointer() pointer from GLboolean * to GLvoid * * * Revision 3.4 1998/03/27 03:30:36 brianp * fixed G++ warnings * * Revision 3.3 1998/02/20 04:49:19 brianp * move extension functions into apiext.c * * Revision 3.2 1998/02/08 20:23:49 brianp * lots of bitmap rendering changes * * Revision 3.1 1998/02/01 20:05:10 brianp * added glDrawRangeElements() * * Revision 3.0 1998/01/31 20:42:56 brianp * initial rev * */ /* $XFree86: xc/lib/GL/mesa/src/api1.c,v 1.3 1999/04/04 00:20:18 dawes Exp $ */ #ifdef PC_HEADER #include "all.h" #else #ifndef XFree86Server #include #include #else #include "GL/xf86glx.h" #endif #include "api.h" #include "bitmap.h" #include "context.h" #include "drawpix.h" #include "eval.h" #include "image.h" #include "macros.h" #include "matrix.h" #include "teximage.h" #include "types.h" #include "vb.h" #endif /* * Part 1 of API functions */ void GLAPIENTRY glAccum( GLenum op, GLfloat value ) { GET_CONTEXT; CHECK_CONTEXT; (*CC->API.Accum)(CC, op, value); } void GLAPIENTRY glAlphaFunc( GLenum func, GLclampf ref ) { GET_CONTEXT; CHECK_CONTEXT; (*CC->API.AlphaFunc)(CC, func, ref); } GLboolean GLAPIENTRY glAreTexturesResident( GLsizei n, const GLuint *textures, GLboolean *residences ) { GET_CONTEXT; CHECK_CONTEXT_RETURN(GL_FALSE); return (*CC->API.AreTexturesResident)(CC, n, textures, residences); } void GLAPIENTRY glArrayElement( GLint i ) { GET_CONTEXT; CHECK_CONTEXT; (*CC->API.ArrayElement)(CC, i); } void GLAPIENTRY glBegin( GLenum mode ) { GET_CONTEXT; CHECK_CONTEXT; (*CC->API.Begin)( CC, mode ); } void GLAPIENTRY glBindTexture( GLenum target, GLuint texture ) { GET_CONTEXT; CHECK_CONTEXT; (*CC->API.BindTexture)(CC, target, texture); } void GLAPIENTRY glBitmap( GLsizei width, GLsizei height, GLfloat xorig, GLfloat yorig, GLfloat xmove, GLfloat ymove, const GLubyte *bitmap ) { GET_CONTEXT; CHECK_CONTEXT; if (!CC->DirectContext || CC->CompileFlag || !gl_direct_bitmap( CC, width, height, xorig, yorig, xmove, ymove, bitmap)) { struct gl_image *image; image = gl_unpack_bitmap( CC, width, height, bitmap ); (*CC->API.Bitmap)( CC, width, height, xorig, yorig, xmove, ymove, image ); if (image && image->RefCount==0) { gl_free_image( image ); } } } void GLAPIENTRY glBlendFunc( GLenum sfactor, GLenum dfactor ) { GET_CONTEXT; CHECK_CONTEXT; (*CC->API.BlendFunc)(CC, sfactor, dfactor); } void GLAPIENTRY glCallList( GLuint list ) { GET_CONTEXT; CHECK_CONTEXT; (*CC->API.CallList)(CC, list); } void GLAPIENTRY glCallLists( GLsizei n, GLenum type, const GLvoid *lists ) { GET_CONTEXT; CHECK_CONTEXT; (*CC->API.CallLists)(CC, n, type, lists); } void GLAPIENTRY glClear( GLbitfield mask ) { GET_CONTEXT; CHECK_CONTEXT; (*CC->API.Clear)(CC, mask); } void GLAPIENTRY glClearAccum( GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha ) { GET_CONTEXT; CHECK_CONTEXT; (*CC->API.ClearAccum)(CC, red, green, blue, alpha); } void GLAPIENTRY glClearIndex( GLfloat c ) { GET_CONTEXT; CHECK_CONTEXT; (*CC->API.ClearIndex)(CC, c); } void GLAPIENTRY glClearColor( GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha ) { GET_CONTEXT; CHECK_CONTEXT; (*CC->API.ClearColor)(CC, red, green, blue, alpha); } void GLAPIENTRY glClearDepth( GLclampd depth ) { GET_CONTEXT; CHECK_CONTEXT; (*CC->API.ClearDepth)( CC, depth ); } void GLAPIENTRY glClearStencil( GLint s ) { GET_CONTEXT; CHECK_CONTEXT; (*CC->API.ClearStencil)(CC, s); } void GLAPIENTRY glClipPlane( GLenum plane, const GLdouble *equation ) { GLfloat eq[4]; GET_CONTEXT; CHECK_CONTEXT; eq[0] = (GLfloat) equation[0]; eq[1] = (GLfloat) equation[1]; eq[2] = (GLfloat) equation[2]; eq[3] = (GLfloat) equation[3]; (*CC->API.ClipPlane)(CC, plane, eq ); } void GLAPIENTRY glColor3b( GLbyte red, GLbyte green, GLbyte blue ) { GET_CONTEXT; (*CC->API.Color3f)( CC, BYTE_TO_FLOAT(red), BYTE_TO_FLOAT(green), BYTE_TO_FLOAT(blue) ); } void GLAPIENTRY glColor3d( GLdouble red, GLdouble green, GLdouble blue ) { GET_CONTEXT; (*CC->API.Color3f)( CC, (GLfloat) red, (GLfloat) green, (GLfloat) blue ); } void GLAPIENTRY glColor3f( GLfloat red, GLfloat green, GLfloat blue ) { GET_CONTEXT; (*CC->API.Color3f)( CC, red, green, blue ); } void GLAPIENTRY glColor3i( GLint red, GLint green, GLint blue ) { GET_CONTEXT; (*CC->API.Color3f)( CC, INT_TO_FLOAT(red), INT_TO_FLOAT(green), INT_TO_FLOAT(blue) ); } void GLAPIENTRY glColor3s( GLshort red, GLshort green, GLshort blue ) { GET_CONTEXT; (*CC->API.Color3f)( CC, SHORT_TO_FLOAT(red), SHORT_TO_FLOAT(green), SHORT_TO_FLOAT(blue) ); } void GLAPIENTRY glColor3ub( GLubyte red, GLubyte green, GLubyte blue ) { GET_CONTEXT; (*CC->API.Color4ub)( CC, red, green, blue, 255 ); } void GLAPIENTRY glColor3ui( GLuint red, GLuint green, GLuint blue ) { GET_CONTEXT; (*CC->API.Color3f)( CC, UINT_TO_FLOAT(red), UINT_TO_FLOAT(green), UINT_TO_FLOAT(blue) ); } void GLAPIENTRY glColor3us( GLushort red, GLushort green, GLushort blue ) { GET_CONTEXT; (*CC->API.Color3f)( CC, USHORT_TO_FLOAT(red), USHORT_TO_FLOAT(green), USHORT_TO_FLOAT(blue) ); } void GLAPIENTRY glColor4b( GLbyte red, GLbyte green, GLbyte blue, GLbyte alpha ) { GET_CONTEXT; (*CC->API.Color4f)( CC, BYTE_TO_FLOAT(red), BYTE_TO_FLOAT(green), BYTE_TO_FLOAT(blue), BYTE_TO_FLOAT(alpha) ); } void GLAPIENTRY glColor4d( GLdouble red, GLdouble green, GLdouble blue, GLdouble alpha ) { GET_CONTEXT; (*CC->API.Color4f)( CC, (GLfloat) red, (GLfloat) green, (GLfloat) blue, (GLfloat) alpha ); } void GLAPIENTRY glColor4f( GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha ) { GET_CONTEXT; (*CC->API.Color4f)( CC, red, green, blue, alpha ); } void GLAPIENTRY glColor4i( GLint red, GLint green, GLint blue, GLint alpha ) { GET_CONTEXT; (*CC->API.Color4f)( CC, INT_TO_FLOAT(red), INT_TO_FLOAT(green), INT_TO_FLOAT(blue), INT_TO_FLOAT(alpha) ); } void GLAPIENTRY glColor4s( GLshort red, GLshort green, GLshort blue, GLshort alpha ) { GET_CONTEXT; (*CC->API.Color4f)( CC, SHORT_TO_FLOAT(red), SHORT_TO_FLOAT(green), SHORT_TO_FLOAT(blue), SHORT_TO_FLOAT(alpha) ); } void GLAPIENTRY glColor4ub( GLubyte red, GLubyte green, GLubyte blue, GLubyte alpha ) { GET_CONTEXT; (*CC->API.Color4ub)( CC, red, green, blue, alpha ); } void GLAPIENTRY glColor4ui( GLuint red, GLuint green, GLuint blue, GLuint alpha ) { GET_CONTEXT; (*CC->API.Color4f)( CC, UINT_TO_FLOAT(red), UINT_TO_FLOAT(green), UINT_TO_FLOAT(blue), UINT_TO_FLOAT(alpha) ); } void GLAPIENTRY glColor4us( GLushort red, GLushort green, GLushort blue, GLushort alpha ) { GET_CONTEXT; (*CC->API.Color4f)( CC, USHORT_TO_FLOAT(red), USHORT_TO_FLOAT(green), USHORT_TO_FLOAT(blue), USHORT_TO_FLOAT(alpha) ); } void GLAPIENTRY glColor3bv( const GLbyte *v ) { GET_CONTEXT; (*CC->API.Color3f)( CC, BYTE_TO_FLOAT(v[0]), BYTE_TO_FLOAT(v[1]), BYTE_TO_FLOAT(v[2]) ); } void GLAPIENTRY glColor3dv( const GLdouble *v ) { GET_CONTEXT; (*CC->API.Color3f)( CC, (GLdouble) v[0], (GLdouble) v[1], (GLdouble) v[2] ); } void GLAPIENTRY glColor3fv( const GLfloat *v ) { GET_CONTEXT; (*CC->API.Color3fv)( CC, v ); } void GLAPIENTRY glColor3iv( const GLint *v ) { GET_CONTEXT; (*CC->API.Color3f)( CC, INT_TO_FLOAT(v[0]), INT_TO_FLOAT(v[1]), INT_TO_FLOAT(v[2]) ); } void GLAPIENTRY glColor3sv( const GLshort *v ) { GET_CONTEXT; (*CC->API.Color3f)( CC, SHORT_TO_FLOAT(v[0]), SHORT_TO_FLOAT(v[1]), SHORT_TO_FLOAT(v[2]) ); } void GLAPIENTRY glColor3ubv( const GLubyte *v ) { GET_CONTEXT; (*CC->API.Color4ub)( CC, v[0], v[1], v[2], 255 ); } void GLAPIENTRY glColor3uiv( const GLuint *v ) { GET_CONTEXT; (*CC->API.Color3f)( CC, UINT_TO_FLOAT(v[0]), UINT_TO_FLOAT(v[1]), UINT_TO_FLOAT(v[2]) ); } void GLAPIENTRY glColor3usv( const GLushort *v ) { GET_CONTEXT; (*CC->API.Color3f)( CC, USHORT_TO_FLOAT(v[0]), USHORT_TO_FLOAT(v[1]), USHORT_TO_FLOAT(v[2]) ); } void GLAPIENTRY glColor4bv( const GLbyte *v ) { GET_CONTEXT; (*CC->API.Color4f)( CC, BYTE_TO_FLOAT(v[0]), BYTE_TO_FLOAT(v[1]), BYTE_TO_FLOAT(v[2]), BYTE_TO_FLOAT(v[3]) ); } void GLAPIENTRY glColor4dv( const GLdouble *v ) { GET_CONTEXT; (*CC->API.Color4f)( CC, (GLdouble) v[0], (GLdouble) v[1], (GLdouble) v[2], (GLdouble) v[3] ); } void GLAPIENTRY glColor4fv( const GLfloat *v ) { GET_CONTEXT; (*CC->API.Color4f)( CC, v[0], v[1], v[2], v[3] ); } void GLAPIENTRY glColor4iv( const GLint *v ) { GET_CONTEXT; (*CC->API.Color4f)( CC, INT_TO_FLOAT(v[0]), INT_TO_FLOAT(v[1]), INT_TO_FLOAT(v[2]), INT_TO_FLOAT(v[3]) ); } void GLAPIENTRY glColor4sv( const GLshort *v ) { GET_CONTEXT; (*CC->API.Color4f)( CC, SHORT_TO_FLOAT(v[0]), SHORT_TO_FLOAT(v[1]), SHORT_TO_FLOAT(v[2]), SHORT_TO_FLOAT(v[3]) ); } void GLAPIENTRY glColor4ubv( const GLubyte *v ) { GET_CONTEXT; (*CC->API.Color4ubv)( CC, v ); } void GLAPIENTRY glColor4uiv( const GLuint *v ) { GET_CONTEXT; (*CC->API.Color4f)( CC, UINT_TO_FLOAT(v[0]), UINT_TO_FLOAT(v[1]), UINT_TO_FLOAT(v[2]), UINT_TO_FLOAT(v[3]) ); } void GLAPIENTRY glColor4usv( const GLushort *v ) { GET_CONTEXT; (*CC->API.Color4f)( CC, USHORT_TO_FLOAT(v[0]), USHORT_TO_FLOAT(v[1]), USHORT_TO_FLOAT(v[2]), USHORT_TO_FLOAT(v[3]) ); } void GLAPIENTRY glColorMask( GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha ) { GET_CONTEXT; CHECK_CONTEXT; (*CC->API.ColorMask)(CC, red, green, blue, alpha); } void GLAPIENTRY glColorMaterial( GLenum face, GLenum mode ) { GET_CONTEXT; CHECK_CONTEXT; (*CC->API.ColorMaterial)(CC, face, mode); } void GLAPIENTRY glColorPointer( GLint size, GLenum type, GLsizei stride, const GLvoid *ptr ) { GET_CONTEXT; CHECK_CONTEXT; (*CC->API.ColorPointer)(CC, size, type, stride, ptr); } void GLAPIENTRY glColorTableEXT( GLenum target, GLenum internalFormat, GLsizei width, GLenum format, GLenum type, const GLvoid *table ) { struct gl_image *image; GET_CONTEXT; CHECK_CONTEXT; image = gl_unpack_image( CC, width, 1, format, type, table ); (*CC->API.ColorTable)( CC, target, internalFormat, image ); if (image->RefCount == 0) gl_free_image(image); } void GLAPIENTRY glColorSubTableEXT( GLenum target, GLsizei start, GLsizei count, GLenum format, GLenum type, const GLvoid *data ) { struct gl_image *image; GET_CONTEXT; CHECK_CONTEXT; image = gl_unpack_image( CC, count, 1, format, type, data ); (*CC->API.ColorSubTable)( CC, target, start, image ); if (image->RefCount == 0) gl_free_image(image); } void GLAPIENTRY glCopyPixels( GLint x, GLint y, GLsizei width, GLsizei height, GLenum type ) { GET_CONTEXT; CHECK_CONTEXT; (*CC->API.CopyPixels)(CC, x, y, width, height, type); } void GLAPIENTRY glCopyTexImage1D( GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLint border ) { GET_CONTEXT; CHECK_CONTEXT; (*CC->API.CopyTexImage1D)( CC, target, level, internalformat, x, y, width, border ); } void GLAPIENTRY glCopyTexImage2D( GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border ) { GET_CONTEXT; CHECK_CONTEXT; (*CC->API.CopyTexImage2D)( CC, target, level, internalformat, x, y, width, height, border ); } void GLAPIENTRY glCopyTexSubImage1D( GLenum target, GLint level, GLint xoffset, GLint x, GLint y, GLsizei width ) { GET_CONTEXT; CHECK_CONTEXT; (*CC->API.CopyTexSubImage1D)( CC, target, level, xoffset, x, y, width ); } void GLAPIENTRY glCopyTexSubImage2D( GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height ) { GET_CONTEXT; CHECK_CONTEXT; (*CC->API.CopyTexSubImage2D)( CC, target, level, xoffset, yoffset, x, y, width, height ); } /* 1.2 */ void GLAPIENTRY glCopyTexSubImage3D( GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height ) { GET_CONTEXT; CHECK_CONTEXT; (*CC->API.CopyTexSubImage3DEXT)( CC, target, level, xoffset, yoffset, zoffset, x, y, width, height ); } void GLAPIENTRY glCullFace( GLenum mode ) { GET_CONTEXT; CHECK_CONTEXT; (*CC->API.CullFace)(CC, mode); } void GLAPIENTRY glDepthFunc( GLenum func ) { GET_CONTEXT; CHECK_CONTEXT; (*CC->API.DepthFunc)( CC, func ); } void GLAPIENTRY glDepthMask( GLboolean flag ) { GET_CONTEXT; CHECK_CONTEXT; (*CC->API.DepthMask)( CC, flag ); } void GLAPIENTRY glDepthRange( GLclampd near_val, GLclampd far_val ) { GET_CONTEXT; CHECK_CONTEXT; (*CC->API.DepthRange)( CC, near_val, far_val ); } void GLAPIENTRY glDeleteLists( GLuint list, GLsizei range ) { GET_CONTEXT; CHECK_CONTEXT; (*CC->API.DeleteLists)(CC, list, range); } void GLAPIENTRY glDeleteTextures( GLsizei n, const GLuint *textures) { GET_CONTEXT; CHECK_CONTEXT; (*CC->API.DeleteTextures)(CC, n, textures); } void GLAPIENTRY glDisable( GLenum cap ) { GET_CONTEXT; CHECK_CONTEXT; (*CC->API.Disable)( CC, cap ); } void GLAPIENTRY glDisableClientState( GLenum cap ) { GET_CONTEXT; CHECK_CONTEXT; (*CC->API.DisableClientState)( CC, cap ); } void GLAPIENTRY glDrawArrays( GLenum mode, GLint first, GLsizei count ) { GET_CONTEXT; CHECK_CONTEXT; (*CC->API.DrawArrays)(CC, mode, first, count); } void GLAPIENTRY glDrawBuffer( GLenum mode ) { GET_CONTEXT; CHECK_CONTEXT; (*CC->API.DrawBuffer)(CC, mode); } void GLAPIENTRY glDrawElements( GLenum mode, GLsizei count, GLenum type, const GLvoid *indices ) { GET_CONTEXT; CHECK_CONTEXT; (*CC->API.DrawElements)( CC, mode, count, type, indices ); } void GLAPIENTRY glDrawPixels( GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *pixels ) { GET_CONTEXT; CHECK_CONTEXT; if (!CC->DirectContext || CC->CompileFlag || !gl_direct_DrawPixels(CC, &CC->Unpack, width, height, format, type, pixels)) { struct gl_image *image; image = gl_unpack_image( CC, width, height, format, type, pixels ); (*CC->API.DrawPixels)( CC, image ); if (image->RefCount==0) { /* image not in display list */ gl_free_image( image ); } } } /* GL_VERSION_1_2 */ void GLAPIENTRY glDrawRangeElements( GLenum mode, GLuint start, GLuint end, GLsizei count, GLenum type, const GLvoid *indices ) { GET_CONTEXT; CHECK_CONTEXT; (*CC->API.DrawRangeElements)( CC, mode, start, end, count, type, indices ); } void GLAPIENTRY glEnable( GLenum cap ) { GET_CONTEXT; CHECK_CONTEXT; (*CC->API.Enable)( CC, cap ); } void GLAPIENTRY glEnableClientState( GLenum cap ) { GET_CONTEXT; CHECK_CONTEXT; (*CC->API.EnableClientState)( CC, cap ); } void GLAPIENTRY glEnd( void ) { GET_CONTEXT; CHECK_CONTEXT; (*CC->API.End)( CC ); } void GLAPIENTRY glEndList( void ) { GET_CONTEXT; CHECK_CONTEXT; (*CC->API.EndList)(CC); } void GLAPIENTRY glEvalCoord1d( GLdouble u ) { GET_CONTEXT; CHECK_CONTEXT; (*CC->API.EvalCoord1f)( CC, (GLfloat) u ); } void GLAPIENTRY glEvalCoord1f( GLfloat u ) { GET_CONTEXT; CHECK_CONTEXT; (*CC->API.EvalCoord1f)( CC, u ); } void GLAPIENTRY glEvalCoord1dv( const GLdouble *u ) { GET_CONTEXT; CHECK_CONTEXT; (*CC->API.EvalCoord1f)( CC, (GLfloat) *u ); } void GLAPIENTRY glEvalCoord1fv( const GLfloat *u ) { GET_CONTEXT; CHECK_CONTEXT; (*CC->API.EvalCoord1f)( CC, (GLfloat) *u ); } void GLAPIENTRY glEvalCoord2d( GLdouble u, GLdouble v ) { GET_CONTEXT; CHECK_CONTEXT; (*CC->API.EvalCoord2f)( CC, (GLfloat) u, (GLfloat) v ); } void GLAPIENTRY glEvalCoord2f( GLfloat u, GLfloat v ) { GET_CONTEXT; CHECK_CONTEXT; (*CC->API.EvalCoord2f)( CC, u, v ); } void GLAPIENTRY glEvalCoord2dv( const GLdouble *u ) { GET_CONTEXT; CHECK_CONTEXT; (*CC->API.EvalCoord2f)( CC, (GLfloat) u[0], (GLfloat) u[1] ); } void GLAPIENTRY glEvalCoord2fv( const GLfloat *u ) { GET_CONTEXT; CHECK_CONTEXT; (*CC->API.EvalCoord2f)( CC, u[0], u[1] ); } void GLAPIENTRY glEvalPoint1( GLint i ) { GET_CONTEXT; CHECK_CONTEXT; (*CC->API.EvalPoint1)( CC, i ); } void GLAPIENTRY glEvalPoint2( GLint i, GLint j ) { GET_CONTEXT; CHECK_CONTEXT; (*CC->API.EvalPoint2)( CC, i, j ); } void GLAPIENTRY glEvalMesh1( GLenum mode, GLint i1, GLint i2 ) { GET_CONTEXT; CHECK_CONTEXT; (*CC->API.EvalMesh1)( CC, mode, i1, i2 ); } void GLAPIENTRY glEdgeFlag( GLboolean flag ) { GET_CONTEXT; CHECK_CONTEXT; (*CC->API.EdgeFlag)(CC, flag); } void GLAPIENTRY glEdgeFlagv( const GLboolean *flag ) { GET_CONTEXT; CHECK_CONTEXT; (*CC->API.EdgeFlag)(CC, *flag); } void GLAPIENTRY glEdgeFlagPointer( GLsizei stride, const GLvoid *ptr ) { GET_CONTEXT; CHECK_CONTEXT; (*CC->API.EdgeFlagPointer)(CC, stride, (const GLboolean *) ptr); } void GLAPIENTRY glEvalMesh2( GLenum mode, GLint i1, GLint i2, GLint j1, GLint j2 ) { GET_CONTEXT; CHECK_CONTEXT; (*CC->API.EvalMesh2)( CC, mode, i1, i2, j1, j2 ); } void GLAPIENTRY glFeedbackBuffer( GLsizei size, GLenum type, GLfloat *buffer ) { GET_CONTEXT; CHECK_CONTEXT; (*CC->API.FeedbackBuffer)(CC, size, type, buffer); } void GLAPIENTRY glFinish( void ) { GET_CONTEXT; CHECK_CONTEXT; (*CC->API.Finish)(CC); } void GLAPIENTRY glFlush( void ) { GET_CONTEXT; CHECK_CONTEXT; (*CC->API.Flush)(CC); } void GLAPIENTRY glFogf( GLenum pname, GLfloat param ) { GET_CONTEXT; CHECK_CONTEXT; (*CC->API.Fogfv)(CC, pname, ¶m); } void GLAPIENTRY glFogi( GLenum pname, GLint param ) { GLfloat fparam = (GLfloat) param; GET_CONTEXT; CHECK_CONTEXT; (*CC->API.Fogfv)(CC, pname, &fparam); } void GLAPIENTRY glFogfv( GLenum pname, const GLfloat *params ) { GET_CONTEXT; CHECK_CONTEXT; (*CC->API.Fogfv)(CC, pname, params); } void GLAPIENTRY glFogiv( GLenum pname, const GLint *params ) { GLfloat p[4]; GET_CONTEXT; CHECK_CONTEXT; switch (pname) { case GL_FOG_MODE: case GL_FOG_DENSITY: case GL_FOG_START: case GL_FOG_END: case GL_FOG_INDEX: p[0] = (GLfloat) *params; break; case GL_FOG_COLOR: p[0] = INT_TO_FLOAT( params[0] ); p[1] = INT_TO_FLOAT( params[1] ); p[2] = INT_TO_FLOAT( params[2] ); p[3] = INT_TO_FLOAT( params[3] ); break; default: /* Error will be caught later in gl_Fogfv */ ; } (*CC->API.Fogfv)( CC, pname, p ); } void GLAPIENTRY glFrontFace( GLenum mode ) { GET_CONTEXT; CHECK_CONTEXT; (*CC->API.FrontFace)(CC, mode); } void GLAPIENTRY glFrustum( GLdouble left, GLdouble right, GLdouble bottom, GLdouble top, GLdouble nearval, GLdouble farval ) { GET_CONTEXT; CHECK_CONTEXT; (*CC->API.Frustum)(CC, left, right, bottom, top, nearval, farval); } GLuint GLAPIENTRY glGenLists( GLsizei range ) { GET_CONTEXT; CHECK_CONTEXT_RETURN(0); return (*CC->API.GenLists)(CC, range); } void GLAPIENTRY glGenTextures( GLsizei n, GLuint *textures ) { GET_CONTEXT; CHECK_CONTEXT; (*CC->API.GenTextures)(CC, n, textures); } void GLAPIENTRY glGetBooleanv( GLenum pname, GLboolean *params ) { GET_CONTEXT; CHECK_CONTEXT; (*CC->API.GetBooleanv)(CC, pname, params); } void GLAPIENTRY glGetClipPlane( GLenum plane, GLdouble *equation ) { GET_CONTEXT; CHECK_CONTEXT; (*CC->API.GetClipPlane)(CC, plane, equation); } void GLAPIENTRY glGetColorTableEXT( GLenum target, GLenum format, GLenum type, GLvoid *table ) { GET_CONTEXT; CHECK_CONTEXT; (*CC->API.GetColorTable)(CC, target, format, type, table); } void GLAPIENTRY glGetColorTableParameterivEXT( GLenum target, GLenum pname, GLint *params ) { GET_CONTEXT; CHECK_CONTEXT; (*CC->API.GetColorTableParameteriv)(CC, target, pname, params); } void GLAPIENTRY glGetColorTableParameterfvEXT( GLenum target, GLenum pname, GLfloat *params ) { GLint iparams; glGetColorTableParameterivEXT( target, pname, &iparams ); *params = (GLfloat) iparams; } void GLAPIENTRY glGetDoublev( GLenum pname, GLdouble *params ) { GET_CONTEXT; CHECK_CONTEXT; (*CC->API.GetDoublev)(CC, pname, params); } GLenum GLAPIENTRY glGetError( void ) { GET_CONTEXT; if (!CC) { /* No current context */ return (GLenum) GL_NO_ERROR; } return (*CC->API.GetError)(CC); } void GLAPIENTRY glGetFloatv( GLenum pname, GLfloat *params ) { GET_CONTEXT; CHECK_CONTEXT; (*CC->API.GetFloatv)(CC, pname, params); } void GLAPIENTRY glGetIntegerv( GLenum pname, GLint *params ) { GET_CONTEXT; CHECK_CONTEXT; (*CC->API.GetIntegerv)(CC, pname, params); } void GLAPIENTRY glGetLightfv( GLenum light, GLenum pname, GLfloat *params ) { GET_CONTEXT; CHECK_CONTEXT; (*CC->API.GetLightfv)(CC, light, pname, params); } void GLAPIENTRY glGetLightiv( GLenum light, GLenum pname, GLint *params ) { GET_CONTEXT; CHECK_CONTEXT; (*CC->API.GetLightiv)(CC, light, pname, params); } void GLAPIENTRY glGetMapdv( GLenum target, GLenum query, GLdouble *v ) { GET_CONTEXT; CHECK_CONTEXT; (*CC->API.GetMapdv)( CC, target, query, v ); } void GLAPIENTRY glGetMapfv( GLenum target, GLenum query, GLfloat *v ) { GET_CONTEXT; CHECK_CONTEXT; (*CC->API.GetMapfv)( CC, target, query, v ); } void GLAPIENTRY glGetMapiv( GLenum target, GLenum query, GLint *v ) { GET_CONTEXT; CHECK_CONTEXT; (*CC->API.GetMapiv)( CC, target, query, v ); } void GLAPIENTRY glGetMaterialfv( GLenum face, GLenum pname, GLfloat *params ) { GET_CONTEXT; CHECK_CONTEXT; (*CC->API.GetMaterialfv)(CC, face, pname, params); } void GLAPIENTRY glGetMaterialiv( GLenum face, GLenum pname, GLint *params ) { GET_CONTEXT; CHECK_CONTEXT; (*CC->API.GetMaterialiv)(CC, face, pname, params); } void GLAPIENTRY glGetPixelMapfv( GLenum map, GLfloat *values ) { GET_CONTEXT; CHECK_CONTEXT; (*CC->API.GetPixelMapfv)(CC, map, values); } void GLAPIENTRY glGetPixelMapuiv( GLenum map, GLuint *values ) { GET_CONTEXT; CHECK_CONTEXT; (*CC->API.GetPixelMapuiv)(CC, map, values); } void GLAPIENTRY glGetPixelMapusv( GLenum map, GLushort *values ) { GET_CONTEXT; CHECK_CONTEXT; (*CC->API.GetPixelMapusv)(CC, map, values); } void GLAPIENTRY glGetPointerv( GLenum pname, GLvoid **params ) { GET_CONTEXT; CHECK_CONTEXT; (*CC->API.GetPointerv)(CC, pname, params); } void GLAPIENTRY glGetPolygonStipple( GLubyte *mask ) { GET_CONTEXT; CHECK_CONTEXT; (*CC->API.GetPolygonStipple)(CC, mask); } const GLubyte * GLAPIENTRY glGetString( GLenum name ) { GET_CONTEXT; CHECK_CONTEXT_RETURN(NULL); return (*CC->API.GetString)(CC, name); } void GLAPIENTRY glGetTexEnvfv( GLenum target, GLenum pname, GLfloat *params ) { GET_CONTEXT; CHECK_CONTEXT; (*CC->API.GetTexEnvfv)(CC, target, pname, params); } void GLAPIENTRY glGetTexEnviv( GLenum target, GLenum pname, GLint *params ) { GET_CONTEXT; CHECK_CONTEXT; (*CC->API.GetTexEnviv)(CC, target, pname, params); } void GLAPIENTRY glGetTexGeniv( GLenum coord, GLenum pname, GLint *params ) { GET_CONTEXT; CHECK_CONTEXT; (*CC->API.GetTexGeniv)(CC, coord, pname, params); } void GLAPIENTRY glGetTexGendv( GLenum coord, GLenum pname, GLdouble *params ) { GET_CONTEXT; CHECK_CONTEXT; (*CC->API.GetTexGendv)(CC, coord, pname, params); } void GLAPIENTRY glGetTexGenfv( GLenum coord, GLenum pname, GLfloat *params ) { GET_CONTEXT; CHECK_CONTEXT; (*CC->API.GetTexGenfv)(CC, coord, pname, params); } void GLAPIENTRY glGetTexImage( GLenum target, GLint level, GLenum format, GLenum type, GLvoid *pixels ) { GET_CONTEXT; CHECK_CONTEXT; (*CC->API.GetTexImage)(CC, target, level, format, type, pixels); } void GLAPIENTRY glGetTexLevelParameterfv( GLenum target, GLint level, GLenum pname, GLfloat *params ) { GET_CONTEXT; CHECK_CONTEXT; (*CC->API.GetTexLevelParameterfv)(CC, target, level, pname, params); } void GLAPIENTRY glGetTexLevelParameteriv( GLenum target, GLint level, GLenum pname, GLint *params ) { GET_CONTEXT; CHECK_CONTEXT; (*CC->API.GetTexLevelParameteriv)(CC, target, level, pname, params); } void GLAPIENTRY glGetTexParameterfv( GLenum target, GLenum pname, GLfloat *params) { GET_CONTEXT; CHECK_CONTEXT; (*CC->API.GetTexParameterfv)(CC, target, pname, params); } void GLAPIENTRY glGetTexParameteriv( GLenum target, GLenum pname, GLint *params ) { GET_CONTEXT; CHECK_CONTEXT; (*CC->API.GetTexParameteriv)(CC, target, pname, params); } void GLAPIENTRY glHint( GLenum target, GLenum mode ) { GET_CONTEXT; CHECK_CONTEXT; (*CC->API.Hint)(CC, target, mode); } void GLAPIENTRY glIndexd( GLdouble c ) { GET_CONTEXT; (*CC->API.Indexf)( CC, (GLfloat) c ); } void GLAPIENTRY glIndexf( GLfloat c ) { GET_CONTEXT; (*CC->API.Indexf)( CC, c ); } void GLAPIENTRY glIndexi( GLint c ) { GET_CONTEXT; (*CC->API.Indexi)( CC, c ); } void GLAPIENTRY glIndexs( GLshort c ) { GET_CONTEXT; (*CC->API.Indexi)( CC, (GLint) c ); } /* GL_VERSION_1_1 */ void GLAPIENTRY glIndexub( GLubyte c ) { GET_CONTEXT; (*CC->API.Indexi)( CC, (GLint) c ); } void GLAPIENTRY glIndexdv( const GLdouble *c ) { GET_CONTEXT; (*CC->API.Indexf)( CC, (GLfloat) *c ); } void GLAPIENTRY glIndexfv( const GLfloat *c ) { GET_CONTEXT; (*CC->API.Indexf)( CC, *c ); } void GLAPIENTRY glIndexiv( const GLint *c ) { GET_CONTEXT; (*CC->API.Indexi)( CC, *c ); } void GLAPIENTRY glIndexsv( const GLshort *c ) { GET_CONTEXT; (*CC->API.Indexi)( CC, (GLint) *c ); } /* GL_VERSION_1_1 */ void GLAPIENTRY glIndexubv( const GLubyte *c ) { GET_CONTEXT; (*CC->API.Indexi)( CC, (GLint) *c ); } void GLAPIENTRY glIndexMask( GLuint mask ) { GET_CONTEXT; (*CC->API.IndexMask)(CC, mask); } void GLAPIENTRY glIndexPointer( GLenum type, GLsizei stride, const GLvoid *ptr ) { GET_CONTEXT; CHECK_CONTEXT; (*CC->API.IndexPointer)(CC, type, stride, ptr); } void GLAPIENTRY glInterleavedArrays( GLenum format, GLsizei stride, const GLvoid *pointer ) { GET_CONTEXT; CHECK_CONTEXT; (*CC->API.InterleavedArrays)( CC, format, stride, pointer ); } void GLAPIENTRY glInitNames( void ) { GET_CONTEXT; CHECK_CONTEXT; (*CC->API.InitNames)(CC); } GLboolean GLAPIENTRY glIsList( GLuint list ) { GET_CONTEXT; CHECK_CONTEXT_RETURN(GL_FALSE); return (*CC->API.IsList)(CC, list); } GLboolean GLAPIENTRY glIsTexture( GLuint texture ) { GET_CONTEXT; CHECK_CONTEXT_RETURN(GL_FALSE); return (*CC->API.IsTexture)(CC, texture); } void GLAPIENTRY glLightf( GLenum light, GLenum pname, GLfloat param ) { GET_CONTEXT; CHECK_CONTEXT; (*CC->API.Lightfv)( CC, light, pname, ¶m, 1 ); } void GLAPIENTRY glLighti( GLenum light, GLenum pname, GLint param ) { GLfloat fparam = (GLfloat) param; GET_CONTEXT; CHECK_CONTEXT; (*CC->API.Lightfv)( CC, light, pname, &fparam, 1 ); } void GLAPIENTRY glLightfv( GLenum light, GLenum pname, const GLfloat *params ) { GET_CONTEXT; CHECK_CONTEXT; (*CC->API.Lightfv)( CC, light, pname, params, 4 ); } void GLAPIENTRY glLightiv( GLenum light, GLenum pname, const GLint *params ) { GLfloat fparam[4]; GET_CONTEXT; CHECK_CONTEXT; switch (pname) { case GL_AMBIENT: case GL_DIFFUSE: case GL_SPECULAR: fparam[0] = INT_TO_FLOAT( params[0] ); fparam[1] = INT_TO_FLOAT( params[1] ); fparam[2] = INT_TO_FLOAT( params[2] ); fparam[3] = INT_TO_FLOAT( params[3] ); break; case GL_POSITION: fparam[0] = (GLfloat) params[0]; fparam[1] = (GLfloat) params[1]; fparam[2] = (GLfloat) params[2]; fparam[3] = (GLfloat) params[3]; break; case GL_SPOT_DIRECTION: fparam[0] = (GLfloat) params[0]; fparam[1] = (GLfloat) params[1]; fparam[2] = (GLfloat) params[2]; break; case GL_SPOT_EXPONENT: case GL_SPOT_CUTOFF: case GL_CONSTANT_ATTENUATION: case GL_LINEAR_ATTENUATION: case GL_QUADRATIC_ATTENUATION: fparam[0] = (GLfloat) params[0]; break; default: /* error will be caught later in gl_Lightfv */ ; } (*CC->API.Lightfv)( CC, light, pname, fparam, 4 ); } void GLAPIENTRY glLightModelf( GLenum pname, GLfloat param ) { GET_CONTEXT; CHECK_CONTEXT; (*CC->API.LightModelfv)( CC, pname, ¶m ); } void GLAPIENTRY glLightModeli( GLenum pname, GLint param ) { GLfloat fparam[4]; GET_CONTEXT; CHECK_CONTEXT; fparam[0] = (GLfloat) param; (*CC->API.LightModelfv)( CC, pname, fparam ); } void GLAPIENTRY glLightModelfv( GLenum pname, const GLfloat *params ) { GET_CONTEXT; CHECK_CONTEXT; (*CC->API.LightModelfv)( CC, pname, params ); } void GLAPIENTRY glLightModeliv( GLenum pname, const GLint *params ) { GLfloat fparam[4]; GET_CONTEXT; CHECK_CONTEXT; switch (pname) { case GL_LIGHT_MODEL_AMBIENT: fparam[0] = INT_TO_FLOAT( params[0] ); fparam[1] = INT_TO_FLOAT( params[1] ); fparam[2] = INT_TO_FLOAT( params[2] ); fparam[3] = INT_TO_FLOAT( params[3] ); break; case GL_LIGHT_MODEL_LOCAL_VIEWER: case GL_LIGHT_MODEL_TWO_SIDE: fparam[0] = (GLfloat) params[0]; break; default: /* Error will be caught later in gl_LightModelfv */ ; } (*CC->API.LightModelfv)( CC, pname, fparam ); } void GLAPIENTRY glLineWidth( GLfloat width ) { GET_CONTEXT; CHECK_CONTEXT; (*CC->API.LineWidth)(CC, width); } void GLAPIENTRY glLineStipple( GLint factor, GLushort pattern ) { GET_CONTEXT; CHECK_CONTEXT; (*CC->API.LineStipple)(CC, factor, pattern); } void GLAPIENTRY glListBase( GLuint base ) { GET_CONTEXT; CHECK_CONTEXT; (*CC->API.ListBase)(CC, base); } void GLAPIENTRY glLoadIdentity( void ) { GET_CONTEXT; CHECK_CONTEXT; (*CC->API.LoadIdentity)( CC ); } void GLAPIENTRY glLoadMatrixd( const GLdouble *m ) { GLfloat fm[16]; GLuint i; GET_CONTEXT; CHECK_CONTEXT; for (i=0;i<16;i++) { fm[i] = (GLfloat) m[i]; } (*CC->API.LoadMatrixf)( CC, fm ); } void GLAPIENTRY glLoadMatrixf( const GLfloat *m ) { GET_CONTEXT; CHECK_CONTEXT; (*CC->API.LoadMatrixf)( CC, m ); } void GLAPIENTRY glLoadName( GLuint name ) { GET_CONTEXT; CHECK_CONTEXT; (*CC->API.LoadName)(CC, name); } void GLAPIENTRY glLogicOp( GLenum opcode ) { GET_CONTEXT; CHECK_CONTEXT; (*CC->API.LogicOp)(CC, opcode); } void GLAPIENTRY glMap1d( GLenum target, GLdouble u1, GLdouble u2, GLint stride, GLint order, const GLdouble *points ) { GLfloat *pnts; GLboolean retain; GET_CONTEXT; CHECK_CONTEXT; pnts = gl_copy_map_points1d( target, stride, order, points ); retain = CC->CompileFlag; (*CC->API.Map1f)( CC, target, u1, u2, stride, order, pnts, retain ); } void GLAPIENTRY glMap1f( GLenum target, GLfloat u1, GLfloat u2, GLint stride, GLint order, const GLfloat *points ) { GLfloat *pnts; GLboolean retain; GET_CONTEXT; CHECK_CONTEXT; pnts = gl_copy_map_points1f( target, stride, order, points ); retain = CC->CompileFlag; (*CC->API.Map1f)( CC, target, u1, u2, stride, order, pnts, retain ); } void GLAPIENTRY glMap2d( GLenum target, GLdouble u1, GLdouble u2, GLint ustride, GLint uorder, GLdouble v1, GLdouble v2, GLint vstride, GLint vorder, const GLdouble *points ) { GLfloat *pnts; GLboolean retain; GET_CONTEXT; CHECK_CONTEXT; pnts = gl_copy_map_points2d( target, ustride, uorder, vstride, vorder, points ); retain = CC->CompileFlag; (*CC->API.Map2f)( CC, target, u1, u2, ustride, uorder, v1, v2, vstride, vorder, pnts, retain ); } void GLAPIENTRY glMap2f( GLenum target, GLfloat u1, GLfloat u2, GLint ustride, GLint uorder, GLfloat v1, GLfloat v2, GLint vstride, GLint vorder, const GLfloat *points ) { GLfloat *pnts; GLboolean retain; GET_CONTEXT; CHECK_CONTEXT; pnts = gl_copy_map_points2f( target, ustride, uorder, vstride, vorder, points ); retain = CC->CompileFlag; (*CC->API.Map2f)( CC, target, u1, u2, ustride, uorder, v1, v2, vstride, vorder, pnts, retain ); } void GLAPIENTRY glMapGrid1d( GLint un, GLdouble u1, GLdouble u2 ) { GET_CONTEXT; CHECK_CONTEXT; (*CC->API.MapGrid1f)( CC, un, (GLfloat) u1, (GLfloat) u2 ); } void GLAPIENTRY glMapGrid1f( GLint un, GLfloat u1, GLfloat u2 ) { GET_CONTEXT; CHECK_CONTEXT; (*CC->API.MapGrid1f)( CC, un, u1, u2 ); } void GLAPIENTRY glMapGrid2d( GLint un, GLdouble u1, GLdouble u2, GLint vn, GLdouble v1, GLdouble v2 ) { GET_CONTEXT; CHECK_CONTEXT; (*CC->API.MapGrid2f)( CC, un, (GLfloat) u1, (GLfloat) u2, vn, (GLfloat) v1, (GLfloat) v2 ); } void GLAPIENTRY glMapGrid2f( GLint un, GLfloat u1, GLfloat u2, GLint vn, GLfloat v1, GLfloat v2 ) { GET_CONTEXT; CHECK_CONTEXT; (*CC->API.MapGrid2f)( CC, un, u1, u2, vn, v1, v2 ); } void GLAPIENTRY glMaterialf( GLenum face, GLenum pname, GLfloat param ) { GET_CONTEXT; CHECK_CONTEXT; (*CC->API.Materialfv)( CC, face, pname, ¶m ); } void GLAPIENTRY glMateriali( GLenum face, GLenum pname, GLint param ) { GLfloat fparam[4]; GET_CONTEXT; CHECK_CONTEXT; fparam[0] = (GLfloat) param; (*CC->API.Materialfv)( CC, face, pname, fparam ); } void GLAPIENTRY glMaterialfv( GLenum face, GLenum pname, const GLfloat *params ) { GET_CONTEXT; CHECK_CONTEXT; (*CC->API.Materialfv)( CC, face, pname, params ); } void GLAPIENTRY glMaterialiv( GLenum face, GLenum pname, const GLint *params ) { GLfloat fparam[4]; GET_CONTEXT; CHECK_CONTEXT; switch (pname) { case GL_AMBIENT: case GL_DIFFUSE: case GL_SPECULAR: case GL_EMISSION: case GL_AMBIENT_AND_DIFFUSE: fparam[0] = INT_TO_FLOAT( params[0] ); fparam[1] = INT_TO_FLOAT( params[1] ); fparam[2] = INT_TO_FLOAT( params[2] ); fparam[3] = INT_TO_FLOAT( params[3] ); break; case GL_SHININESS: fparam[0] = (GLfloat) params[0]; break; case GL_COLOR_INDEXES: fparam[0] = (GLfloat) params[0]; fparam[1] = (GLfloat) params[1]; fparam[2] = (GLfloat) params[2]; break; default: /* Error will be caught later in gl_Materialfv */ ; } (*CC->API.Materialfv)( CC, face, pname, fparam ); } void GLAPIENTRY glMatrixMode( GLenum mode ) { GET_CONTEXT; CHECK_CONTEXT; (*CC->API.MatrixMode)( CC, mode ); } void GLAPIENTRY glMultMatrixd( const GLdouble *m ) { GLfloat fm[16]; GLuint i; GET_CONTEXT; CHECK_CONTEXT; for (i=0;i<16;i++) { fm[i] = (GLfloat) m[i]; } (*CC->API.MultMatrixf)( CC, fm ); } void GLAPIENTRY glMultMatrixf( const GLfloat *m ) { GET_CONTEXT; CHECK_CONTEXT; (*CC->API.MultMatrixf)( CC, m ); } void GLAPIENTRY glNewList( GLuint list, GLenum mode ) { GET_CONTEXT; CHECK_CONTEXT; (*CC->API.NewList)(CC, list, mode); } void GLAPIENTRY glNormal3b( GLbyte nx, GLbyte ny, GLbyte nz ) { GET_CONTEXT; (*CC->API.Normal3f)( CC, BYTE_TO_FLOAT(nx), BYTE_TO_FLOAT(ny), BYTE_TO_FLOAT(nz) ); } void GLAPIENTRY glNormal3d( GLdouble nx, GLdouble ny, GLdouble nz ) { GLfloat fx, fy, fz; GET_CONTEXT; if (ABSD(nx)<0.00001) fx = 0.0F; else fx = nx; if (ABSD(ny)<0.00001) fy = 0.0F; else fy = ny; if (ABSD(nz)<0.00001) fz = 0.0F; else fz = nz; (*CC->API.Normal3f)( CC, fx, fy, fz ); } void GLAPIENTRY glNormal3f( GLfloat nx, GLfloat ny, GLfloat nz ) { GET_CONTEXT; #ifdef SHORTCUT if (CC->CompileFlag) { (*CC->Save.Normal3f)( CC, nx, ny, nz ); } else { /* Execute */ CC->Current.Normal[0] = nx; CC->Current.Normal[1] = ny; CC->Current.Normal[2] = nz; CC->VB->MonoNormal = GL_FALSE; } #else (*CC->API.Normal3f)( CC, nx, ny, nz ); #endif } void GLAPIENTRY glNormal3i( GLint nx, GLint ny, GLint nz ) { GET_CONTEXT; (*CC->API.Normal3f)( CC, INT_TO_FLOAT(nx), INT_TO_FLOAT(ny), INT_TO_FLOAT(nz) ); } void GLAPIENTRY glNormal3s( GLshort nx, GLshort ny, GLshort nz ) { GET_CONTEXT; (*CC->API.Normal3f)( CC, SHORT_TO_FLOAT(nx), SHORT_TO_FLOAT(ny), SHORT_TO_FLOAT(nz) ); } void GLAPIENTRY glNormal3bv( const GLbyte *v ) { GET_CONTEXT; (*CC->API.Normal3f)( CC, BYTE_TO_FLOAT(v[0]), BYTE_TO_FLOAT(v[1]), BYTE_TO_FLOAT(v[2]) ); } void GLAPIENTRY glNormal3dv( const GLdouble *v ) { GLfloat fx, fy, fz; GET_CONTEXT; if (ABSD(v[0])<0.00001) fx = 0.0F; else fx = v[0]; if (ABSD(v[1])<0.00001) fy = 0.0F; else fy = v[1]; if (ABSD(v[2])<0.00001) fz = 0.0F; else fz = v[2]; (*CC->API.Normal3f)( CC, fx, fy, fz ); } void GLAPIENTRY glNormal3fv( const GLfloat *v ) { GET_CONTEXT; #ifdef SHORTCUT if (CC->CompileFlag) { (*CC->Save.Normal3fv)( CC, v ); } else { /* Execute */ GLfloat *n = CC->Current.Normal; n[0] = v[0]; n[1] = v[1]; n[2] = v[2]; CC->VB->MonoNormal = GL_FALSE; } #else (*CC->API.Normal3fv)( CC, v ); #endif } void GLAPIENTRY glNormal3iv( const GLint *v ) { GET_CONTEXT; (*CC->API.Normal3f)( CC, INT_TO_FLOAT(v[0]), INT_TO_FLOAT(v[1]), INT_TO_FLOAT(v[2]) ); } void GLAPIENTRY glNormal3sv( const GLshort *v ) { GET_CONTEXT; (*CC->API.Normal3f)( CC, SHORT_TO_FLOAT(v[0]), SHORT_TO_FLOAT(v[1]), SHORT_TO_FLOAT(v[2]) ); } void GLAPIENTRY glNormalPointer( GLenum type, GLsizei stride, const GLvoid *ptr ) { GET_CONTEXT; CHECK_CONTEXT; (*CC->API.NormalPointer)(CC, type, stride, ptr); }