home *** CD-ROM | disk | FTP | other *** search
/ Amiga MA Magazine 1998 #6 / amigamamagazinepolishissue1998.iso / coders / mesa-1.2.8 / src / vertex.c < prev    next >
C/C++ Source or Header  |  1996-05-27  |  33KB  |  1,579 lines

  1. /* $Id: vertex.c,v 1.13 1996/02/26 15:08:40 brianp Exp $ */
  2.  
  3. /*
  4.  * Mesa 3-D graphics library
  5.  * Version:  1.2
  6.  * Copyright (C) 1995-1996  Brian Paul  (brianp@ssec.wisc.edu)
  7.  *
  8.  * This library is free software; you can redistribute it and/or
  9.  * modify it under the terms of the GNU Library General Public
  10.  * License as published by the Free Software Foundation; either
  11.  * version 2 of the License, or (at your option) any later version.
  12.  *
  13.  * This library is distributed in the hope that it will be useful,
  14.  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  15.  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  16.  * Library General Public License for more details.
  17.  *
  18.  * You should have received a copy of the GNU Library General Public
  19.  * License along with this library; if not, write to the Free
  20.  * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  21.  */
  22.  
  23.  
  24. /*
  25. $Log: vertex.c,v $
  26.  * Revision 1.13  1996/02/26  15:08:40  brianp
  27.  * new implementation of glColor*() for CC.Current.IntColor
  28.  *
  29.  * Revision 1.12  1996/02/23  22:34:33  brianp
  30.  * changed logic for testing CC.Compile and CC.Execute per Jean-Luc Daems
  31.  *
  32.  * Revision 1.11  1996/02/14  15:40:03  brianp
  33.  * replaced ABS with ABSD
  34.  *
  35.  * Revision 1.10  1996/01/16  17:07:28  brianp
  36.  * fixed color shift bug in glColor[34]ub[v] functions
  37.  *
  38.  * Revision 1.9  1995/12/30  01:02:42  brianp
  39.  * compute CC.Current.IntColor inside all glColor* calls
  40.  *
  41.  * Revision 1.8  1995/12/20  17:31:11  brianp
  42.  * removed gl_color and gl_index calls, now inlined their operations
  43.  *
  44.  * Revision 1.7  1995/12/19  17:07:29  brianp
  45.  * call gl_save_edgeflag instead of gl_save_set_boolean
  46.  *
  47.  * Revision 1.6  1995/10/19  15:49:41  brianp
  48.  * check for argument underflow in glNormal3d[v] functions
  49.  *
  50.  * Revision 1.5  1995/10/04  19:35:37  brianp
  51.  * fixed bugs and optimized glNormal calls
  52.  *
  53.  * Revision 1.4  1995/07/25  16:41:54  brianp
  54.  * made changes for using CC.VertexFunc pointer
  55.  *
  56.  * Revision 1.3  1995/05/22  21:02:41  brianp
  57.  * Release 1.2
  58.  *
  59.  * Revision 1.2  1995/03/04  19:29:44  brianp
  60.  * 1.1 beta revision
  61.  *
  62.  * Revision 1.1  1995/02/24  14:28:31  brianp
  63.  * Initial revision
  64.  *
  65.  */
  66.  
  67.  
  68. /*
  69.  * glVertex*, glNormal*, glIndex*, and glColor* functions.
  70.  */
  71.  
  72.  
  73.  
  74. #include "context.h"
  75. #include "draw.h"
  76. #include "light.h"
  77. #include "list.h"
  78. #include "macros.h"
  79. #include "vb.h"
  80.  
  81.  
  82.  
  83. /*
  84.  * Vertex
  85.  */
  86.  
  87.  
  88. /*** 2 arguments ***/
  89.  
  90. void glVertex2d( GLdouble x, GLdouble y )
  91. {
  92.    (*CC.VertexFunc)( (GLfloat) x, (GLfloat) y, 0.0F, 1.0F );
  93. }
  94.  
  95.  
  96. void glVertex2f( GLfloat x, GLfloat y )
  97. {
  98.    (*CC.VertexFunc)( x, y, 0.0F, 1.0F );
  99. }
  100.  
  101.  
  102. void glVertex2i( GLint x, GLint y )
  103. {
  104.    (*CC.VertexFunc)( (GLfloat) x, (GLfloat) y, 0.0F, 1.0F );
  105. }
  106.  
  107.  
  108. void glVertex2s( GLshort x, GLshort y )
  109. {
  110.    (*CC.VertexFunc)( (GLfloat) x, (GLfloat) y, 0.0F, 1.0F );
  111. }
  112.  
  113.  
  114. /*** 3 arguments ***/
  115.  
  116. void glVertex3d( GLdouble x, GLdouble y, GLdouble z )
  117. {
  118.    (*CC.VertexFunc)( (GLfloat) x, (GLfloat) y, (GLfloat) z, 1.0F );
  119. }
  120.  
  121.  
  122. void glVertex3f( GLfloat x, GLfloat y, GLfloat z )
  123. {
  124.    (*CC.VertexFunc)( x, y, z, 1.0F );
  125. }
  126.  
  127.  
  128. void glVertex3i( GLint x, GLint y, GLint z )
  129. {
  130.    (*CC.VertexFunc)( (GLfloat) x, (GLfloat) y, (GLfloat) z, 1.0F );
  131. }
  132.  
  133.  
  134. void glVertex3s( GLshort x, GLshort y, GLshort z )
  135. {
  136.    (*CC.VertexFunc)( (GLfloat) x, (GLfloat) y, (GLfloat) z, 1.0F );
  137. }
  138.  
  139.  
  140. /*** 4 arguments ***/
  141.  
  142. void glVertex4d( GLdouble x, GLdouble y, GLdouble z, GLdouble w )
  143. {
  144.    (*CC.VertexFunc)( (GLfloat) x, (GLfloat) y, (GLfloat) z, (GLfloat) w );
  145. }
  146.  
  147.  
  148. void glVertex4f( GLfloat x, GLfloat y, GLfloat z, GLfloat w )
  149. {
  150.    (*CC.VertexFunc)( x, y, z, w );
  151. }
  152.  
  153.  
  154. void glVertex4i( GLint x, GLint y, GLint z, GLint w )
  155. {
  156.    (*CC.VertexFunc)( (GLfloat) x, (GLfloat) y, (GLfloat) z, (GLfloat) w );
  157. }
  158.  
  159.  
  160. void glVertex4s( GLshort x, GLshort y, GLshort z, GLshort w )
  161. {
  162.    (*CC.VertexFunc)( (GLfloat) x, (GLfloat) y, (GLfloat) z, (GLfloat) w );
  163. }
  164.  
  165.  
  166. /*** 2 element vector ***/
  167.  
  168. void glVertex2dv( const GLdouble *v )
  169. {
  170.    (*CC.VertexFunc)( (GLfloat) v[0], (GLfloat) v[1], 0.0F, 1.0F );
  171. }
  172.  
  173.  
  174. void glVertex2fv( const GLfloat *v )
  175. {
  176.    (*CC.VertexFunc)( v[0], v[1], 0.0F, 1.0F );
  177. }
  178.  
  179.  
  180. void glVertex2iv( const GLint *v )
  181. {
  182.    (*CC.VertexFunc)( (GLfloat) v[0], (GLfloat) v[1], 0.0F, 1.0F );
  183. }
  184.  
  185.  
  186. void glVertex2sv( const GLshort *v )
  187. {
  188.    (*CC.VertexFunc)( (GLfloat) v[0], (GLfloat) v[1], 0.0F, 1.0F );
  189. }
  190.  
  191.  
  192.  
  193. /*** 3 element vector ***/
  194.  
  195. void glVertex3dv( const GLdouble *v )
  196. {
  197.    (*CC.VertexFunc)( (GLfloat) v[0], (GLfloat) v[1], (GLfloat) v[2], 1.0F );
  198. }
  199.  
  200.  
  201. void glVertex3fv( const GLfloat *v )
  202. {
  203.    (*CC.VertexFunc)( v[0], v[1], v[2], 1.0F );
  204. }
  205.  
  206.  
  207. void glVertex3iv( const GLint *v )
  208. {
  209.    (*CC.VertexFunc)( (GLfloat) v[0], (GLfloat) v[1], (GLfloat) v[2], 1.0F );
  210. }
  211.  
  212.  
  213. void glVertex3sv( const GLshort *v )
  214. {
  215.    (*CC.VertexFunc)( (GLfloat) v[0], (GLfloat) v[1], (GLfloat) v[2], 1.0F );
  216. }
  217.  
  218.  
  219. /*** 4 element vector ***/
  220.  
  221. void glVertex4dv( const GLdouble *v )
  222. {
  223.    (*CC.VertexFunc)( (GLfloat) v[0], (GLfloat) v[1],
  224.              (GLfloat) v[2], (GLfloat) v[3] );
  225. }
  226.  
  227.  
  228. void glVertex4fv( const GLfloat *v )
  229. {
  230.    (*CC.VertexFunc)( v[0], v[1], v[2], v[3] );
  231. }
  232.  
  233.  
  234. void glVertex4iv( const GLint *v )
  235. {
  236.    (*CC.VertexFunc)( (GLfloat) v[0], (GLfloat) v[1],
  237.              (GLfloat) v[2], (GLfloat) v[3] );
  238. }
  239.  
  240.  
  241. void glVertex4sv( const GLshort *v )
  242. {
  243.    (*CC.VertexFunc)( (GLfloat) v[0], (GLfloat) v[1],
  244.              (GLfloat) v[2], (GLfloat) v[3] );
  245. }
  246.  
  247.  
  248.  
  249. /*
  250.  * Normal vectors
  251.  */
  252.  
  253.  
  254. /*** 3 arguments ***/
  255.  
  256. void glNormal3b( GLbyte nx, GLbyte ny, GLbyte nz )
  257. {
  258.    if (CC.CompileFlag) {
  259.       GLfloat x, y, z;
  260.       x = BYTE_TO_FLOAT(nx);
  261.       y = BYTE_TO_FLOAT(ny);
  262.       z = BYTE_TO_FLOAT(nz);
  263.       gl_save_normal3f( x, y, z );
  264.       if (!CC.ExecuteFlag) return;
  265.    }
  266.    CC.Current.Normal[0] = BYTE_TO_FLOAT(nz);
  267.    CC.Current.Normal[1] = BYTE_TO_FLOAT(ny);
  268.    CC.Current.Normal[2] = BYTE_TO_FLOAT(nz);
  269. }
  270.  
  271.  
  272. void glNormal3d( GLdouble nx, GLdouble ny, GLdouble nz )
  273. {
  274.    GLfloat fx, fy, fz;
  275.    if (ABSD(nx)<0.00001)   fx = 0.0F;   else  fx = nx;
  276.    if (ABSD(ny)<0.00001)   fy = 0.0F;   else  fy = ny;
  277.    if (ABSD(nz)<0.00001)   fz = 0.0F;   else  fz = nz;
  278.    if (CC.CompileFlag) {
  279.       gl_save_normal3f( fx, fy, fz );
  280.       if (!CC.ExecuteFlag) return;
  281.    }
  282.    CC.Current.Normal[0] = fx;
  283.    CC.Current.Normal[1] = fy;
  284.    CC.Current.Normal[2] = fz;
  285. }
  286.  
  287.  
  288. void glNormal3f( GLfloat nx, GLfloat ny, GLfloat nz )
  289. {
  290.    if (CC.CompileFlag) {
  291.       gl_save_normal3f( nx, ny, nz );
  292.       if (!CC.ExecuteFlag) return;
  293.    }
  294.    CC.Current.Normal[0] = nx;
  295.    CC.Current.Normal[1] = ny;
  296.    CC.Current.Normal[2] = nz;
  297. }
  298.  
  299.  
  300. void glNormal3i( GLint nx, GLint ny, GLint nz )
  301. {
  302.    if (CC.CompileFlag) {
  303.       GLfloat x, y, z;
  304.       x = INT_TO_FLOAT(nx);
  305.       y = INT_TO_FLOAT(ny);
  306.       z = INT_TO_FLOAT(nz);
  307.       gl_save_normal3f( x, y, z );
  308.       if (!CC.ExecuteFlag) return;
  309.    }
  310.    CC.Current.Normal[0] = INT_TO_FLOAT(nx);
  311.    CC.Current.Normal[1] = INT_TO_FLOAT(ny);
  312.    CC.Current.Normal[2] = INT_TO_FLOAT(nz);
  313. }
  314.  
  315.  
  316. void glNormal3s( GLshort nx, GLshort ny, GLshort nz )
  317. {
  318.    if (CC.CompileFlag) {
  319.       GLfloat x, y, z;
  320.       x = SHORT_TO_FLOAT(nx);
  321.       y = SHORT_TO_FLOAT(ny);
  322.       z = SHORT_TO_FLOAT(nz);
  323.       gl_save_normal3f( x, y, z );
  324.       if (!CC.ExecuteFlag) return;
  325.    }
  326.    CC.Current.Normal[0] = SHORT_TO_FLOAT(nx);
  327.    CC.Current.Normal[1] = SHORT_TO_FLOAT(ny);
  328.    CC.Current.Normal[2] = SHORT_TO_FLOAT(nz);
  329. }
  330.  
  331.  
  332. /*** vector argument ***/
  333.  
  334. void glNormal3bv( const GLbyte *v )
  335. {
  336.    if (CC.CompileFlag) {
  337.       GLfloat x, y, z;
  338.       x = BYTE_TO_FLOAT(v[0]);
  339.       y = BYTE_TO_FLOAT(v[1]);
  340.       z = BYTE_TO_FLOAT(v[2]);
  341.       gl_save_normal3f( x, y, z );
  342.       if (!CC.ExecuteFlag) return;
  343.    }
  344.    CC.Current.Normal[0] = BYTE_TO_FLOAT(v[0]);
  345.    CC.Current.Normal[1] = BYTE_TO_FLOAT(v[1]);
  346.    CC.Current.Normal[2] = BYTE_TO_FLOAT(v[2]);
  347. }
  348.  
  349.  
  350. void glNormal3dv( const GLdouble *v )
  351. {
  352.    GLfloat fx, fy, fz;
  353.    if (ABSD(v[0])<0.00001)   fx = 0.0F;   else  fx = v[0];
  354.    if (ABSD(v[1])<0.00001)   fy = 0.0F;   else  fy = v[1];
  355.    if (ABSD(v[2])<0.00001)   fz = 0.0F;   else  fz = v[2];
  356.    if (CC.CompileFlag) {
  357.       gl_save_normal3f( fx, fy, fz );
  358.       if (!CC.ExecuteFlag) return;
  359.    }
  360.    CC.Current.Normal[0] = fx;
  361.    CC.Current.Normal[1] = fy;
  362.    CC.Current.Normal[2] = fz;
  363. }
  364.  
  365.  
  366. void glNormal3fv( const GLfloat *v )
  367. {
  368.    if (CC.CompileFlag) {
  369.       gl_save_normal3fv( v );
  370.       if (!CC.ExecuteFlag) return;
  371.    }
  372.    CC.Current.Normal[0] = v[0];
  373.    CC.Current.Normal[1] = v[1];
  374.    CC.Current.Normal[2] = v[2];
  375. }
  376.  
  377.  
  378. void glNormal3iv( const GLint *v )
  379. {
  380.    if (CC.CompileFlag) {
  381.       GLfloat x, y, z;
  382.       x = INT_TO_FLOAT(v[0]);
  383.       y = INT_TO_FLOAT(v[1]);
  384.       z = INT_TO_FLOAT(v[2]);
  385.       gl_save_normal3f( x, y, z );
  386.       if (!CC.ExecuteFlag) return;
  387.    }
  388.    CC.Current.Normal[0] = INT_TO_FLOAT(v[0]);
  389.    CC.Current.Normal[1] = INT_TO_FLOAT(v[1]);
  390.    CC.Current.Normal[2] = INT_TO_FLOAT(v[2]);
  391. }
  392.  
  393.  
  394. void glNormal3sv( const GLshort *v )
  395. {
  396.    if (CC.CompileFlag) {
  397.       GLfloat x, y, z;
  398.       x = SHORT_TO_FLOAT(v[0]);
  399.       y = SHORT_TO_FLOAT(v[1]);
  400.       z = SHORT_TO_FLOAT(v[2]);
  401.       gl_save_normal3f( x, y, z );
  402.       if (!CC.ExecuteFlag) return;
  403.    }
  404.    CC.Current.Normal[0] = SHORT_TO_FLOAT(v[0]);
  405.    CC.Current.Normal[1] = SHORT_TO_FLOAT(v[1]);
  406.    CC.Current.Normal[2] = SHORT_TO_FLOAT(v[2]);
  407. }
  408.  
  409.  
  410.  
  411. /*
  412.  * Color Index
  413.  */
  414.  
  415.  
  416. void glIndexd( GLdouble c )
  417. {
  418.    if (CC.CompileFlag) {
  419.       gl_save_index( (GLuint) (GLint) c );
  420.       if (!CC.ExecuteFlag) return;
  421.    }
  422.    CC.Current.Index = (GLuint) (GLint) c;
  423.    VB.MonoColor = GL_FALSE;
  424. }
  425.  
  426.  
  427. void glIndexf( GLfloat c )
  428. {
  429.    if (CC.CompileFlag) {
  430.       gl_save_index( (GLuint) (GLint) c );
  431.       if (!CC.ExecuteFlag) return;
  432.    }
  433.    CC.Current.Index = (GLuint) (GLint) c;
  434.    VB.MonoColor = GL_FALSE;
  435. }
  436.  
  437.  
  438. void glIndexi( GLint c )
  439. {
  440.    if (CC.CompileFlag) {
  441.       gl_save_index( (GLuint) c );
  442.       if (!CC.ExecuteFlag) return;
  443.    }
  444.    CC.Current.Index = (GLuint) c;
  445.    VB.MonoColor = GL_FALSE;
  446. }
  447.  
  448.  
  449. void glIndexs( GLshort c )
  450. {
  451.    if (CC.CompileFlag) {
  452.       gl_save_index( (GLuint) c );
  453.       if (!CC.ExecuteFlag) return;
  454.    }
  455.    CC.Current.Index = (GLuint) c;
  456.    VB.MonoColor = GL_FALSE;
  457. }
  458.  
  459.  
  460. void glIndexdv( const GLdouble *c )
  461. {
  462.    if (CC.CompileFlag) {
  463.       gl_save_index( (GLuint) (GLint) *c );
  464.       if (!CC.ExecuteFlag) return;
  465.    }
  466.    CC.Current.Index = (GLuint) (GLint) *c;
  467.    VB.MonoColor = GL_FALSE;
  468. }
  469.  
  470.  
  471. void glIndexfv( const GLfloat *c )
  472. {
  473.    if (CC.CompileFlag) {
  474.       gl_save_index( (GLuint) (GLint) *c );
  475.       if (!CC.ExecuteFlag) return;
  476.    }
  477.    CC.Current.Index = (GLuint) (GLint) *c;
  478.    VB.MonoColor = GL_FALSE;
  479. }
  480.  
  481.  
  482. void glIndexiv( const GLint *c )
  483. {
  484.    if (CC.CompileFlag) {
  485.       gl_save_index( (GLuint) *c );
  486.       if (!CC.ExecuteFlag) return;
  487.    }
  488.    CC.Current.Index = (GLuint) *c;
  489.    VB.MonoColor = GL_FALSE;
  490. }
  491.  
  492.  
  493. void glIndexsv( const GLshort *c )
  494. {
  495.    if (CC.CompileFlag) {
  496.       gl_save_index( (GLuint) *c );
  497.       if (!CC.ExecuteFlag) return;
  498.    }
  499.    CC.Current.Index = (GLuint) *c;
  500.    VB.MonoColor = GL_FALSE;
  501. }
  502.  
  503.  
  504.  
  505. /*
  506.  * Color
  507.  */
  508.  
  509.  
  510. void glColor3b( GLbyte red, GLbyte green, GLbyte blue )
  511. {
  512.    glColor3f( BYTE_TO_FLOAT(red), BYTE_TO_FLOAT(green), BYTE_TO_FLOAT(blue) );
  513. }
  514.  
  515.  
  516. void glColor3d( GLdouble red, GLdouble green, GLdouble blue )
  517. {
  518.    glColor3f( red, green, blue );
  519. }
  520.  
  521.  
  522. void glColor3f( GLfloat red, GLfloat green, GLfloat blue )
  523. {
  524.    if (CC.CompileFlag) {
  525.       GLint c[4];
  526.       c[0] = red * CC.RedScale;
  527.       c[1] = green * CC.GreenScale;
  528.       c[2] = blue * CC.BlueScale;
  529.       c[3] = CC.AlphaScale;
  530.       gl_save_color( c );
  531.       if (!CC.ExecuteFlag) return;
  532.    }
  533.    CC.Current.IntColor[0] = red * CC.RedScale;
  534.    CC.Current.IntColor[1] = green * CC.GreenScale;
  535.    CC.Current.IntColor[2] = blue * CC.BlueScale;
  536.    CC.Current.IntColor[3] = CC.AlphaScale;
  537.    if (CC.Light.ColorMaterialEnabled) {
  538.       /* Translate this glColor() call into a glMaterial() call */
  539.       GLfloat color[4];
  540.       ASSIGN_4V( color, red, green, blue, 1.0F );
  541.       gl_material( CC.Light.ColorMaterialFace,
  542.                    CC.Light.ColorMaterialMode, color );
  543.    }
  544.    VB.MonoColor = GL_FALSE;
  545. }
  546.  
  547.  
  548. void glColor3i( GLint red, GLint green, GLint blue )
  549. {
  550.    glColor3f( INT_TO_FLOAT(red), INT_TO_FLOAT(green), INT_TO_FLOAT(blue) );
  551. }
  552.  
  553.  
  554. void glColor3s( GLshort red, GLshort green, GLshort blue )
  555. {
  556.    glColor3f( SHORT_TO_FLOAT(red), SHORT_TO_FLOAT(green),
  557.               SHORT_TO_FLOAT(blue) );
  558. }
  559.  
  560.  
  561. void glColor3ub( GLubyte red, GLubyte green, GLubyte blue )
  562. {
  563.    if (CC.CompileFlag) {
  564.       GLint c[4];
  565.       if (CC.EightBitColor) {
  566.          ASSIGN_4V( c, red, green, blue, (GLint) CC.AlphaScale );
  567.       }
  568.       else {
  569.          c[0] = red * CC.RedScale * (1.0F/255.0F);
  570.          c[1] = green * CC.GreenScale * (1.0F/255.0F);
  571.          c[2] = blue * CC.BlueScale * (1.0F/255.0F);
  572.          c[3] = CC.AlphaScale;
  573.       }
  574.       gl_save_color( c );
  575.       if (!CC.ExecuteFlag) return;
  576.    }
  577.    if (CC.EightBitColor) {
  578.       ASSIGN_4V( CC.Current.IntColor, red, green, blue, (GLint) CC.AlphaScale);
  579.    }
  580.    else {
  581.       CC.Current.IntColor[0] = red * CC.RedScale * (1.0F/255.0F);
  582.       CC.Current.IntColor[1] = green * CC.GreenScale * (1.0F/255.0F);
  583.       CC.Current.IntColor[2] = blue * CC.BlueScale * (1.0F/255.0F);
  584.       CC.Current.IntColor[3] = CC.AlphaScale;
  585.    }
  586.    if (CC.Light.ColorMaterialEnabled) {
  587.       /* Translate this glColor() call into a glMaterial() call */
  588.       GLfloat color[4];
  589.       color[0] = red * (1.0F/255.0F);
  590.       color[1] = green * (1.0F/255.0F);
  591.       color[2] = blue * (1.0F/255.0F);
  592.       color[3] = 1.0F;
  593.       gl_material( CC.Light.ColorMaterialFace,
  594.                    CC.Light.ColorMaterialMode, color );
  595.    }
  596.    VB.MonoColor = GL_FALSE;
  597. }
  598.  
  599.  
  600. void glColor3ui( GLuint red, GLuint green, GLuint blue )
  601. {
  602.    glColor3f( UINT_TO_FLOAT(red), UINT_TO_FLOAT(green), UINT_TO_FLOAT(blue) );
  603. }
  604.  
  605.  
  606. void glColor3us( GLushort red, GLushort green, GLushort blue )
  607. {
  608.    glColor3f( USHORT_TO_FLOAT(red), USHORT_TO_FLOAT(green),
  609.               USHORT_TO_FLOAT(blue) );
  610. }
  611.  
  612.  
  613. void glColor4b( GLbyte red, GLbyte green, GLbyte blue, GLbyte alpha )
  614. {
  615.    glColor4f( BYTE_TO_FLOAT(red), BYTE_TO_FLOAT(green),
  616.               BYTE_TO_FLOAT(blue), BYTE_TO_FLOAT(alpha) );
  617. }
  618.  
  619.  
  620. void glColor4d( GLdouble red, GLdouble green, GLdouble blue, GLdouble alpha )
  621. {
  622.    glColor4f( red, green, blue, alpha );
  623. }
  624.  
  625.  
  626. void glColor4f( GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha )
  627. {
  628.    if (CC.CompileFlag) {
  629.       GLint c[4];
  630.       c[0] = red * CC.RedScale;
  631.       c[1] = green * CC.GreenScale;
  632.       c[2] = blue * CC.BlueScale;
  633.       c[3] = alpha * CC.AlphaScale;
  634.       gl_save_color( c );
  635.       if (!CC.ExecuteFlag) return;
  636.    }
  637.    CC.Current.IntColor[0] = red * CC.RedScale;
  638.    CC.Current.IntColor[1] = green * CC.GreenScale;
  639.    CC.Current.IntColor[2] = blue * CC.BlueScale;
  640.    CC.Current.IntColor[3] = alpha * CC.AlphaScale;
  641.    if (CC.Light.ColorMaterialEnabled) {
  642.       /* Translate this glColor() call into a glMaterial() call */
  643.       GLfloat color[4];
  644.       ASSIGN_4V( color, red, green, blue, alpha );
  645.       gl_material( CC.Light.ColorMaterialFace,
  646.                    CC.Light.ColorMaterialMode, color );
  647.    }
  648.    VB.MonoColor = GL_FALSE;
  649. }
  650.  
  651.  
  652. void glColor4i( GLint red, GLint green, GLint blue, GLint alpha )
  653. {
  654.    glColor4f( INT_TO_FLOAT(red), INT_TO_FLOAT(green),
  655.               INT_TO_FLOAT(blue), INT_TO_FLOAT(alpha) );
  656. }
  657.  
  658.  
  659. void glColor4s( GLshort red, GLshort green, GLshort blue, GLshort alpha )
  660. {
  661.    glColor4f( SHORT_TO_FLOAT(red), SHORT_TO_FLOAT(green),
  662.               SHORT_TO_FLOAT(blue), SHORT_TO_FLOAT(alpha) );
  663. }
  664.  
  665.  
  666. void glColor4ub( GLubyte red, GLubyte green, GLubyte blue, GLubyte alpha )
  667. {
  668.    if (CC.CompileFlag) {
  669.       GLint c[4];
  670.       if (CC.EightBitColor) {
  671.          ASSIGN_4V( c, red, green, blue, alpha );
  672.       }
  673.       else {
  674.          c[0] = red * CC.RedScale * (1.0F/255.0F);
  675.          c[1] = green * CC.GreenScale * (1.0F/255.0F);
  676.          c[2] = blue * CC.BlueScale * (1.0F/255.0F);
  677.          c[3] = alpha * CC.AlphaScale * (1.0F/255.0F);
  678.       }
  679.       gl_save_color( c );
  680.       if (!CC.ExecuteFlag) return;
  681.    }
  682.    if (CC.EightBitColor) {
  683.       ASSIGN_4V( CC.Current.IntColor, red, green, blue, alpha );
  684.    }
  685.    else {
  686.       CC.Current.IntColor[0] = red * CC.RedScale * (1.0F/255.0F);
  687.       CC.Current.IntColor[1] = green * CC.GreenScale * (1.0F/255.0F);
  688.       CC.Current.IntColor[2] = blue * CC.BlueScale * (1.0F/255.0F);
  689.       CC.Current.IntColor[3] = alpha * CC.AlphaScale * (1.0F/255.0F);
  690.    }
  691.    if (CC.Light.ColorMaterialEnabled) {
  692.       /* Translate this glColor() call into a glMaterial() call */
  693.       GLfloat color[4];
  694.       color[0] = red * (1.0F/255.0F);
  695.       color[1] = green * (1.0F/255.0F);
  696.       color[2] = blue * (1.0F/255.0F);
  697.       color[3] = alpha * (1.0F/255.0F);
  698.       gl_material( CC.Light.ColorMaterialFace,
  699.                    CC.Light.ColorMaterialMode, color );
  700.    }
  701.    VB.MonoColor = GL_FALSE;
  702. }
  703.  
  704.  
  705. void glColor4ui( GLuint red, GLuint green, GLuint blue, GLuint alpha )
  706. {
  707.    glColor4f( UINT_TO_FLOAT(red), UINT_TO_FLOAT(green),
  708.               UINT_TO_FLOAT(blue), UINT_TO_FLOAT(alpha) );
  709. }
  710.  
  711.  
  712. void glColor4us( GLushort red, GLushort green, GLushort blue, GLushort alpha )
  713. {
  714.    glColor4f( USHORT_TO_FLOAT(red), USHORT_TO_FLOAT(green),
  715.               USHORT_TO_FLOAT(blue), USHORT_TO_FLOAT(alpha) );
  716. }
  717.  
  718.  
  719. void glColor3bv( const GLbyte *v )
  720. {
  721.    glColor3f( BYTE_TO_FLOAT(v[0]), BYTE_TO_FLOAT(v[1]), BYTE_TO_FLOAT(v[2]) );
  722. }
  723.  
  724.  
  725. void glColor3dv( const GLdouble *v )
  726. {
  727.    glColor3f( v[0], v[1], v[2] );
  728. }
  729.  
  730.  
  731. void glColor3fv( const GLfloat *v )
  732. {
  733.    if (CC.CompileFlag) {
  734.       GLint c[4];
  735.       c[0] = v[0] * CC.RedScale;
  736.       c[1] = v[1] * CC.GreenScale;
  737.       c[2] = v[2] * CC.BlueScale;
  738.       c[3] = CC.AlphaScale;
  739.       gl_save_color( c );
  740.       if (!CC.ExecuteFlag) return;
  741.    }
  742.    CC.Current.IntColor[0] = v[0] * CC.RedScale;
  743.    CC.Current.IntColor[1] = v[1] * CC.GreenScale;
  744.    CC.Current.IntColor[2] = v[2] * CC.BlueScale;
  745.    CC.Current.IntColor[3] = CC.AlphaScale;
  746.    if (CC.Light.ColorMaterialEnabled) {
  747.       /* Translate this glColor() call into a glMaterial() call */
  748.       GLfloat color[4];
  749.       ASSIGN_4V( color, v[0], v[1], v[2], 1.0F );
  750.       gl_material( CC.Light.ColorMaterialFace,
  751.                    CC.Light.ColorMaterialMode, color );
  752.    }
  753.    VB.MonoColor = GL_FALSE;
  754. }
  755.  
  756.  
  757. void glColor3iv( const GLint *v )
  758. {
  759.    glColor3f( INT_TO_FLOAT(v[0]), INT_TO_FLOAT(v[1]), INT_TO_FLOAT(v[2]) );
  760. }
  761.  
  762.  
  763. void glColor3sv( const GLshort *v )
  764. {
  765.    glColor3f( SHORT_TO_FLOAT(v[0]), SHORT_TO_FLOAT(v[1]),
  766.               SHORT_TO_FLOAT(v[2]) );
  767. }
  768.  
  769.  
  770. void glColor3ubv( const GLubyte *v )
  771. {
  772.    if (CC.CompileFlag) {
  773.       GLint c[4];
  774.       if (CC.EightBitColor) {
  775.          ASSIGN_4V( c, v[0], v[1], v[2], (GLint) CC.AlphaScale );
  776.       }
  777.       else {
  778.          c[0] = v[0] * CC.RedScale * (1.0F/255.0F);
  779.          c[1] = v[1] * CC.GreenScale * (1.0F/255.0F);
  780.          c[2] = v[2] * CC.BlueScale * (1.0F/255.0F);
  781.          c[3] = CC.AlphaScale;
  782.       }
  783.       gl_save_color( c );
  784.       if (!CC.ExecuteFlag) return;
  785.    }
  786.    if (CC.EightBitColor) {
  787.       ASSIGN_4V( CC.Current.IntColor, v[0], v[1], v[2], (GLint) CC.AlphaScale);
  788.    }
  789.    else {
  790.       CC.Current.IntColor[0] = v[0] * CC.RedScale * (1.0F/255.0F);
  791.       CC.Current.IntColor[1] = v[1] * CC.GreenScale * (1.0F/255.0F);
  792.       CC.Current.IntColor[2] = v[2] * CC.BlueScale * (1.0F/255.0F);
  793.       CC.Current.IntColor[3] = CC.AlphaScale;
  794.    }
  795.    if (CC.Light.ColorMaterialEnabled) {
  796.       /* Translate this glColor() call into a glMaterial() call */
  797.       GLfloat color[4];
  798.       color[0] = v[0] * (1.0F/255.0F);
  799.       color[1] = v[1] * (1.0F/255.0F);
  800.       color[2] = v[2] * (1.0F/255.0F);
  801.       color[3] = 1.0F;
  802.       gl_material( CC.Light.ColorMaterialFace,
  803.                    CC.Light.ColorMaterialMode, color );
  804.    }
  805.    VB.MonoColor = GL_FALSE;
  806. }
  807.  
  808.  
  809. void glColor3uiv( const GLuint *v )
  810. {
  811.    glColor3f( UINT_TO_FLOAT(v[0]), UINT_TO_FLOAT(v[1]), UINT_TO_FLOAT(v[2]) );
  812. }
  813.  
  814.  
  815. void glColor3usv( const GLushort *v )
  816. {
  817.    glColor3f( USHORT_TO_FLOAT(v[0]), USHORT_TO_FLOAT(v[1]),
  818.               USHORT_TO_FLOAT(v[2]) );
  819. }
  820.  
  821.  
  822. void glColor4bv( const GLbyte *v )
  823. {
  824.    glColor4f( BYTE_TO_FLOAT(v[0]), BYTE_TO_FLOAT(v[1]),
  825.               BYTE_TO_FLOAT(v[2]), BYTE_TO_FLOAT(v[3]) );
  826. }
  827.  
  828.  
  829. void glColor4dv( const GLdouble *v )
  830. {
  831.    glColor4f( v[0], v[1], v[2], v[3] );
  832. }
  833.  
  834.  
  835. void glColor4fv( const GLfloat *v )
  836. {
  837.    if (CC.CompileFlag) {
  838.       GLint c[4];
  839.       c[0] = v[0] * CC.RedScale;
  840.       c[1] = v[1] * CC.GreenScale;
  841.       c[2] = v[2] * CC.BlueScale;
  842.       c[3] = v[3] * CC.AlphaScale;
  843.       gl_save_color( c );
  844.       if (!CC.ExecuteFlag) return;
  845.    }
  846.    CC.Current.IntColor[0] = v[0] * CC.RedScale;
  847.    CC.Current.IntColor[1] = v[1] * CC.GreenScale;
  848.    CC.Current.IntColor[2] = v[2] * CC.BlueScale;
  849.    CC.Current.IntColor[3] = v[3] * CC.AlphaScale;
  850.    if (CC.Light.ColorMaterialEnabled) {
  851.       /* Translate this glColor() call into a glMaterial() call */
  852.       gl_material( CC.Light.ColorMaterialFace,
  853.                    CC.Light.ColorMaterialMode, v );
  854.    }
  855.    VB.MonoColor = GL_FALSE;
  856. }
  857.  
  858.  
  859. void glColor4iv( const GLint *v )
  860. {
  861.    glColor4f( INT_TO_FLOAT(v[0]), INT_TO_FLOAT(v[1]),
  862.               INT_TO_FLOAT(v[2]), INT_TO_FLOAT(v[3]) );
  863. }
  864.  
  865.  
  866. void glColor4sv( const GLshort *v )
  867. {
  868.    glColor4f( SHORT_TO_FLOAT(v[0]), SHORT_TO_FLOAT(v[1]),
  869.               SHORT_TO_FLOAT(v[2]), SHORT_TO_FLOAT(v[3]) );
  870. }
  871.  
  872.  
  873. void glColor4ubv( const GLubyte *v )
  874. {
  875.    if (CC.CompileFlag) {
  876.       GLint c[4];
  877.       if (CC.EightBitColor) {
  878.          COPY_4V( c, v );
  879.       }
  880.       else {
  881.          c[0] = v[0] * CC.RedScale * (1.0F/255.0F);
  882.          c[1] = v[1] * CC.GreenScale * (1.0F/255.0F);
  883.          c[2] = v[2] * CC.BlueScale * (1.0F/255.0F);
  884.          c[3] = v[3] * CC.AlphaScale * (1.0F/255.0F);
  885.       }
  886.       gl_save_color( c );
  887.       if (!CC.ExecuteFlag) return;
  888.    }
  889.    if (CC.EightBitColor) {
  890.       COPY_4V( CC.Current.IntColor, v );
  891.    }
  892.    else {
  893.       CC.Current.IntColor[0] = v[0] * CC.RedScale * (1.0F/255.0F);
  894.       CC.Current.IntColor[1] = v[1] * CC.GreenScale * (1.0F/255.0F);
  895.       CC.Current.IntColor[2] = v[2] * CC.BlueScale * (1.0F/255.0F);
  896.       CC.Current.IntColor[3] = v[3] * CC.AlphaScale * (1.0F/255.0F);
  897.    }
  898.    if (CC.Light.ColorMaterialEnabled) {
  899.       /* Translate this glColor() call into a glMaterial() call */
  900.       GLfloat color[4];
  901.       color[0] = v[0] * (1.0F/255.0F);
  902.       color[1] = v[1] * (1.0F/255.0F);
  903.       color[2] = v[2] * (1.0F/255.0F);
  904.       color[3] = v[3] * (1.0F/255.0F);
  905.       gl_material( CC.Light.ColorMaterialFace,
  906.                    CC.Light.ColorMaterialMode, color );
  907.    }
  908.    VB.MonoColor = GL_FALSE;
  909. }
  910.  
  911.  
  912. void glColor4uiv( const GLuint *v )
  913. {
  914.    glColor4f(  UINT_TO_FLOAT(v[0]), UINT_TO_FLOAT(v[1]),
  915.                UINT_TO_FLOAT(v[2]), UINT_TO_FLOAT(v[3]) );
  916. }
  917.  
  918.  
  919. void glColor4usv( const GLushort *v )
  920. {
  921.    glColor4f( USHORT_TO_FLOAT(v[0]), USHORT_TO_FLOAT(v[1]),
  922.               USHORT_TO_FLOAT(v[2]), USHORT_TO_FLOAT(v[3]) );
  923. }
  924.  
  925.  
  926.  
  927. /*
  928.  * glRasterPos* functions
  929.  */
  930.  
  931.  
  932. void glRasterPos2d( GLdouble x, GLdouble y )
  933. {
  934.    GLfloat v[4];
  935.  
  936.    v[0] = (GLfloat) x;
  937.    v[1] = (GLfloat) y;
  938.    v[2] = 0.0F;
  939.    v[3] = 1.0F;
  940.  
  941.    if (CC.CompileFlag) {
  942.       gl_save_rasterpos( v );
  943.    }
  944.    if (CC.ExecuteFlag) {
  945.       gl_rasterpos( v );
  946.    }
  947. }
  948.  
  949.  
  950. void glRasterPos2f( GLfloat x, GLfloat y )
  951. {
  952.    GLfloat v[4];
  953.  
  954.    v[0] = x;
  955.    v[1] = y;
  956.    v[2] = 0.0F;
  957.    v[3] = 1.0F;
  958.  
  959.    if (CC.CompileFlag) {
  960.       gl_save_rasterpos( v );
  961.    }
  962.    if (CC.ExecuteFlag) {
  963.       gl_rasterpos( v );
  964.    }
  965. }
  966.  
  967.  
  968. void glRasterPos2i( GLint x, GLint y )
  969. {
  970.    GLfloat v[4];
  971.  
  972.    v[0] = (GLfloat) x;
  973.    v[1] = (GLfloat) y;
  974.    v[2] = 0.0F;
  975.    v[3] = 1.0F;
  976.  
  977.    if (CC.CompileFlag) {
  978.       gl_save_rasterpos( v );
  979.    }
  980.    if (CC.ExecuteFlag) {
  981.       gl_rasterpos( v );
  982.    }
  983. }
  984.  
  985.  
  986. void glRasterPos2s( GLshort x, GLshort y )
  987. {
  988.    GLfloat v[4];
  989.  
  990.    v[0] = (GLfloat) x;
  991.    v[1] = (GLfloat) y;
  992.    v[2] = 0.0F;
  993.    v[3] = 1.0F;
  994.  
  995.    if (CC.CompileFlag) {
  996.       gl_save_rasterpos( v );
  997.    }
  998.    if (CC.ExecuteFlag) {
  999.       gl_rasterpos( v );
  1000.    }
  1001. }
  1002.  
  1003.  
  1004. /*** 3 arguments ***/
  1005.  
  1006. void glRasterPos3d( GLdouble x, GLdouble y, GLdouble z )
  1007. {
  1008.    GLfloat v[4];
  1009.  
  1010.    v[0] = (GLfloat) x;
  1011.    v[1] = (GLfloat) y;
  1012.    v[2] = (GLfloat) z;
  1013.    v[3] = 1.0F;
  1014.  
  1015.    if (CC.CompileFlag) {
  1016.       gl_save_rasterpos( v );
  1017.    }
  1018.    if (CC.ExecuteFlag) {
  1019.       gl_rasterpos( v );
  1020.    }
  1021. }
  1022.  
  1023.  
  1024. void glRasterPos3f( GLfloat x, GLfloat y, GLfloat z )
  1025. {
  1026.    GLfloat v[4];
  1027.  
  1028.    v[0] = x;
  1029.    v[1] = y;
  1030.    v[2] = z;
  1031.    v[3] = 1.0F;
  1032.  
  1033.    if (CC.CompileFlag) {
  1034.       gl_save_rasterpos( v );
  1035.    }
  1036.    if (CC.ExecuteFlag) {
  1037.       gl_rasterpos( v );
  1038.    }
  1039. }
  1040.  
  1041.  
  1042. void glRasterPos3i( GLint x, GLint y, GLint z )
  1043. {
  1044.    GLfloat v[4];
  1045.  
  1046.    v[0] = (GLfloat) x;
  1047.    v[1] = (GLfloat) y;
  1048.    v[2] = (GLfloat) z;
  1049.    v[3] = 1.0F;
  1050.  
  1051.    if (CC.CompileFlag) {
  1052.       gl_save_rasterpos( v );
  1053.    }
  1054.    if (CC.ExecuteFlag) {
  1055.       gl_rasterpos( v );
  1056.    }
  1057. }
  1058.  
  1059.  
  1060. void glRasterPos3s( GLshort x, GLshort y, GLshort z )
  1061. {
  1062.    GLfloat v[4];
  1063.  
  1064.    v[0] = (GLfloat) x;
  1065.    v[1] = (GLfloat) y;
  1066.    v[2] = (GLfloat) z;
  1067.    v[3] = 1.0F;
  1068.  
  1069.    if (CC.CompileFlag) {
  1070.       gl_save_rasterpos( v );
  1071.    }
  1072.    if (CC.ExecuteFlag) {
  1073.       gl_rasterpos( v );
  1074.    }
  1075. }
  1076.  
  1077.  
  1078. /*** 4 arguments ***/
  1079.  
  1080. void glRasterPos4d( GLdouble x, GLdouble y, GLdouble z, GLdouble w )
  1081. {
  1082.    GLfloat v[4];
  1083.  
  1084.    v[0] = (GLfloat) x;
  1085.    v[1] = (GLfloat) y;
  1086.    v[2] = (GLfloat) z;
  1087.    v[3] = (GLfloat) w;
  1088.  
  1089.    if (CC.CompileFlag) {
  1090.       gl_save_rasterpos( v );
  1091.    }
  1092.    if (CC.ExecuteFlag) {
  1093.       gl_rasterpos( v );
  1094.    }
  1095. }
  1096.  
  1097.  
  1098. void glRasterPos4f( GLfloat x, GLfloat y, GLfloat z, GLfloat w )
  1099. {
  1100.    GLfloat v[4];
  1101.  
  1102.    /* maybe:  GLfloat *v = &x ??? */
  1103.    v[0] = x;
  1104.    v[1] = y;
  1105.    v[2] = z;
  1106.    v[3] = w;
  1107.  
  1108.    if (CC.CompileFlag) {
  1109.       gl_save_rasterpos( v );
  1110.    }
  1111.    if (CC.ExecuteFlag) {
  1112.       gl_rasterpos( v );
  1113.    }
  1114. }
  1115.  
  1116.  
  1117. void glRasterPos4i( GLint x, GLint y, GLint z, GLint w )
  1118. {
  1119.    GLfloat v[4];
  1120.  
  1121.    v[0] = (GLfloat) x;
  1122.    v[1] = (GLfloat) y;
  1123.    v[2] = (GLfloat) z;
  1124.    v[3] = (GLfloat) w;
  1125.  
  1126.    if (CC.CompileFlag) {
  1127.       gl_save_rasterpos( v );
  1128.    }
  1129.    if (CC.ExecuteFlag) {
  1130.       gl_rasterpos( v );
  1131.    }
  1132. }
  1133.  
  1134.  
  1135. void glRasterPos4s( GLshort x, GLshort y, GLshort z, GLshort w )
  1136. {
  1137.    GLfloat v[4];
  1138.  
  1139.    v[0] = (GLfloat) x;
  1140.    v[1] = (GLfloat) y;
  1141.    v[2] = (GLfloat) z;
  1142.    v[3] = (GLfloat) w;
  1143.  
  1144.    if (CC.CompileFlag) {
  1145.       gl_save_rasterpos( v );
  1146.    }
  1147.    if (CC.ExecuteFlag) {
  1148.       gl_rasterpos( v );
  1149.    }
  1150. }
  1151.  
  1152.  
  1153. /*** 2 element vector ***/
  1154.  
  1155. void glRasterPos2dv( const GLdouble *v )
  1156. {
  1157.    GLfloat vv[4];
  1158.  
  1159.    vv[0] = (GLfloat) v[0];
  1160.    vv[1] = (GLfloat) v[1];
  1161.    vv[2] = 0.0F;
  1162.    vv[3] = 1.0F;
  1163.  
  1164.    if (CC.CompileFlag) {
  1165.       gl_save_rasterpos( vv );
  1166.    }
  1167.    if (CC.ExecuteFlag) {
  1168.       gl_rasterpos( vv );
  1169.    }
  1170. }
  1171.  
  1172.  
  1173. void glRasterPos2fv( const GLfloat *v )
  1174. {
  1175.    GLfloat vv[4];
  1176.  
  1177.    vv[0] = v[0];
  1178.    vv[1] = v[1];
  1179.    vv[2] = 0.0F;
  1180.    vv[3] = 1.0F;
  1181.  
  1182.    if (CC.CompileFlag) {
  1183.       gl_save_rasterpos( vv );
  1184.    }
  1185.    if (CC.ExecuteFlag) {
  1186.       gl_rasterpos( vv );
  1187.    }
  1188. }
  1189.  
  1190.  
  1191. void glRasterPos2iv( const GLint *v )
  1192. {
  1193.    GLfloat vv[4];
  1194.  
  1195.    vv[0] = (GLfloat) v[0];
  1196.    vv[1] = (GLfloat) v[1];
  1197.    vv[2] = 0.0F;
  1198.    vv[3] = 1.0F;
  1199.  
  1200.    if (CC.CompileFlag) {
  1201.       gl_save_rasterpos( vv );
  1202.    }
  1203.    if (CC.ExecuteFlag) {
  1204.       gl_rasterpos( vv );
  1205.    }
  1206. }
  1207.  
  1208.  
  1209. void glRasterPos2sv( const GLshort *v )
  1210. {
  1211.    GLfloat vv[4];
  1212.  
  1213.    vv[0] = (GLfloat) v[0];
  1214.    vv[1] = (GLfloat) v[1];
  1215.    vv[2] = 0.0F;
  1216.    vv[3] = 1.0F;
  1217.  
  1218.    if (CC.CompileFlag) {
  1219.       gl_save_rasterpos( vv );
  1220.    }
  1221.    if (CC.ExecuteFlag) {
  1222.       gl_rasterpos( vv );
  1223.    }
  1224. }
  1225.  
  1226.  
  1227. /*** 3 element vector ***/
  1228.  
  1229. void glRasterPos3dv( const GLdouble *v )
  1230. {
  1231.    GLfloat vv[4];
  1232.  
  1233.    vv[0] = (GLfloat) v[0];
  1234.    vv[1] = (GLfloat) v[1];
  1235.    vv[2] = (GLfloat) v[2];
  1236.    vv[3] = 1.0F;
  1237.  
  1238.    if (CC.CompileFlag) {
  1239.       gl_save_rasterpos( vv );
  1240.    }
  1241.    if (CC.ExecuteFlag) {
  1242.       gl_rasterpos( vv );
  1243.    }
  1244. }
  1245.  
  1246.  
  1247. void glRasterPos3fv( const GLfloat *v )
  1248. {
  1249.    GLfloat vv[4];
  1250.  
  1251.    vv[0] = (GLfloat) v[0];
  1252.    vv[1] = (GLfloat) v[1];
  1253.    vv[2] = (GLfloat) v[2];
  1254.    vv[3] = 1.0F;
  1255.  
  1256.    if (CC.CompileFlag) {
  1257.       gl_save_rasterpos( vv );
  1258.    }
  1259.    if (CC.ExecuteFlag) {
  1260.       gl_rasterpos( vv );
  1261.    }
  1262. }
  1263.  
  1264.  
  1265. void glRasterPos3iv( const GLint *v )
  1266. {
  1267.    GLfloat vv[4];
  1268.  
  1269.    vv[0] = (GLfloat) v[0];
  1270.    vv[1] = (GLfloat) v[1];
  1271.    vv[2] = (GLfloat) v[2];
  1272.    vv[3] = 1.0F;
  1273.  
  1274.    if (CC.CompileFlag) {
  1275.       gl_save_rasterpos( vv );
  1276.    }
  1277.    if (CC.ExecuteFlag) {
  1278.       gl_rasterpos( vv );
  1279.    }
  1280. }
  1281.  
  1282.  
  1283. void glRasterPos3sv( const GLshort *v )
  1284. {
  1285.    GLfloat vv[4];
  1286.  
  1287.    vv[0] = (GLfloat) v[0];
  1288.    vv[1] = (GLfloat) v[1];
  1289.    vv[2] = (GLfloat) v[2];
  1290.    vv[3] = 1.0F;
  1291.  
  1292.    if (CC.CompileFlag) {
  1293.       gl_save_rasterpos( vv );
  1294.    }
  1295.    if (CC.ExecuteFlag) {
  1296.       gl_rasterpos( vv );
  1297.    }
  1298. }
  1299.  
  1300.  
  1301. /*** 4 element vector ***/
  1302.  
  1303. void glRasterPos4dv( const GLdouble *v )
  1304. {
  1305.    GLfloat vv[4];
  1306.  
  1307.    vv[0] = (GLfloat) v[0];
  1308.    vv[1] = (GLfloat) v[1];
  1309.    vv[2] = (GLfloat) v[2];
  1310.    vv[3] = (GLfloat) v[3];
  1311.  
  1312.    if (CC.CompileFlag) {
  1313.       gl_save_rasterpos( vv );
  1314.    }
  1315.    if (CC.ExecuteFlag) {
  1316.       gl_rasterpos( vv );
  1317.    }
  1318. }
  1319.  
  1320.  
  1321. void glRasterPos4fv( const GLfloat *v )
  1322. {
  1323.    if (CC.CompileFlag) {
  1324.       gl_save_rasterpos( v );
  1325.    }
  1326.    if (CC.ExecuteFlag) {
  1327.       gl_rasterpos( v );
  1328.    }
  1329. }
  1330.  
  1331.  
  1332. void glRasterPos4iv( const GLint *v )
  1333. {
  1334.    GLfloat vv[4];
  1335.  
  1336.    vv[0] = (GLfloat) v[0];
  1337.    vv[1] = (GLfloat) v[1];
  1338.    vv[2] = (GLfloat) v[2];
  1339.    vv[3] = (GLfloat) v[3];
  1340.  
  1341.    if (CC.CompileFlag) {
  1342.       gl_save_rasterpos( vv );
  1343.    }
  1344.    if (CC.ExecuteFlag) {
  1345.       gl_rasterpos( vv );
  1346.    }
  1347. }
  1348.  
  1349.  
  1350. void glRasterPos4sv( const GLshort *v )
  1351. {
  1352.    GLfloat vv[4];
  1353.  
  1354.    vv[0] = (GLfloat) v[0];
  1355.    vv[1] = (GLfloat) v[1];
  1356.    vv[2] = (GLfloat) v[2];
  1357.    vv[3] = (GLfloat) v[3];
  1358.  
  1359.    if (CC.CompileFlag) {
  1360.       gl_save_rasterpos( vv );
  1361.    }
  1362.    if (CC.ExecuteFlag) {
  1363.       gl_rasterpos( vv );
  1364.    }
  1365. }
  1366.  
  1367.  
  1368.  
  1369. /*
  1370.  *
  1371.  * Texture coordinates
  1372.  *
  1373.  */
  1374.  
  1375.  
  1376. void glTexCoord1d( GLdouble s )
  1377. {
  1378.    glTexCoord4f( (GLfloat) s, 0.0, 0.0, 1.0 );
  1379. }
  1380.  
  1381. void glTexCoord1f( GLfloat s )
  1382. {
  1383.    glTexCoord4f( s, 0.0, 0.0, 1.0 );
  1384. }
  1385.  
  1386. void glTexCoord1i( GLint s )
  1387. {
  1388.    glTexCoord4f( (GLfloat) s, 0.0, 0.0, 1.0 );
  1389. }
  1390.  
  1391. void glTexCoord1s( GLshort s )
  1392. {
  1393.    glTexCoord4f( (GLfloat) s, 0.0, 0.0, 1.0 );
  1394. }
  1395.  
  1396. void glTexCoord2d( GLdouble s, GLdouble t )
  1397. {
  1398.    glTexCoord4f( (GLfloat) s, (GLfloat) t, 0.0, 1.0 );
  1399. }
  1400.  
  1401. void glTexCoord2f( GLfloat s, GLfloat t )
  1402. {
  1403.    glTexCoord4f( s, t, 0.0, 1.0 );
  1404. }
  1405.  
  1406. void glTexCoord2i( GLint s, GLint t )
  1407. {
  1408.    glTexCoord4f( (GLfloat) s, (GLfloat) t, 0.0, 1.0 );
  1409. }
  1410.  
  1411. void glTexCoord2s( GLshort s, GLshort t )
  1412. {
  1413.    glTexCoord4f( (GLfloat) s, (GLfloat) t, 0.0, 1.0 );
  1414. }
  1415.  
  1416. void glTexCoord3d( GLdouble s, GLdouble t, GLdouble r )
  1417. {
  1418.    glTexCoord4f( (GLfloat) s, (GLfloat) t, (GLfloat) r, 1.0 );
  1419. }
  1420.  
  1421. void glTexCoord3f( GLfloat s, GLfloat t, GLfloat r )
  1422. {
  1423.    glTexCoord4f( s, t, r, 1.0 );
  1424. }
  1425.  
  1426. void glTexCoord3i( GLint s, GLint t, GLint r )
  1427. {
  1428.    glTexCoord4f( (GLfloat) s, (GLfloat) t, (GLfloat) r, 1.0 );
  1429. }
  1430.  
  1431. void glTexCoord3s( GLshort s, GLshort t, GLshort r )
  1432. {
  1433.    glTexCoord4f( (GLfloat) s, (GLfloat) t, (GLfloat) r, 1.0 );
  1434. }
  1435.  
  1436. void glTexCoord4d( GLdouble s, GLdouble t, GLdouble r, GLdouble q )
  1437. {
  1438.    glTexCoord4f( (GLfloat) s, (GLfloat) t, (GLfloat) r, (GLfloat) q );
  1439. }
  1440.  
  1441. void glTexCoord4f( GLfloat s, GLfloat t, GLfloat r, GLfloat q )
  1442. {
  1443.    if (CC.CompileFlag) {
  1444.       GLfloat tc[4];
  1445.       tc[0] = s;
  1446.       tc[1] = t;
  1447.       tc[2] = r;
  1448.       tc[3] = q;
  1449.       gl_save_texcoord( tc );
  1450.       if (!CC.ExecuteFlag) return;
  1451.    }
  1452.    CC.Current.TexCoord[0] = s;
  1453.    CC.Current.TexCoord[1] = t;
  1454.    CC.Current.TexCoord[2] = r;
  1455.    CC.Current.TexCoord[3] = q;
  1456. }
  1457.  
  1458. void glTexCoord4i( GLint s, GLint t, GLint r, GLint q )
  1459. {
  1460.    glTexCoord4f( (GLfloat) s, (GLfloat) t, (GLfloat) r, (GLfloat) q );
  1461. }
  1462.  
  1463. void glTexCoord4s( GLshort s, GLshort t, GLshort r, GLshort q )
  1464. {
  1465.    glTexCoord4f( (GLfloat) s, (GLfloat) t, (GLfloat) r, (GLfloat) q );
  1466. }
  1467.  
  1468. void glTexCoord1dv( const GLdouble *v )
  1469. {
  1470.    glTexCoord4f( (GLfloat) *v, 0.0, 0.0, 1.0 );
  1471. }
  1472.  
  1473. void glTexCoord1fv( const GLfloat *v )
  1474. {
  1475.    glTexCoord4f( *v, 0.0, 0.0, 1.0 );
  1476. }
  1477.  
  1478. void glTexCoord1iv( const GLint *v )
  1479. {
  1480.    glTexCoord4f( (GLfloat) *v, 0.0, 0.0, 1.0 );
  1481. }
  1482.  
  1483. void glTexCoord1sv( const GLshort *v )
  1484. {
  1485.    glTexCoord4f( (GLfloat) *v, 0.0, 0.0, 1.0 );
  1486. }
  1487.  
  1488. void glTexCoord2dv( const GLdouble *v )
  1489. {
  1490.    glTexCoord4f( (GLfloat) v[0], (GLfloat) v[1], 0.0, 1.0 );
  1491. }
  1492.  
  1493. void glTexCoord2fv( const GLfloat *v )
  1494. {
  1495.    glTexCoord4f( v[0], v[1], 0.0, 1.0 );
  1496. }
  1497.  
  1498. void glTexCoord2iv( const GLint *v )
  1499. {
  1500.    glTexCoord4f( (GLfloat) v[0], (GLfloat) v[1], 0.0, 1.0 );
  1501. }
  1502.  
  1503. void glTexCoord2sv( const GLshort *v )
  1504. {
  1505.    glTexCoord4f( (GLfloat) v[0], (GLfloat) v[1], 0.0, 1.0 );
  1506. }
  1507.  
  1508. void glTexCoord3dv( const GLdouble *v )
  1509. {
  1510.    glTexCoord4f( (GLfloat) v[0], (GLfloat) v[1], (GLfloat) v[2], 1.0 );
  1511. }
  1512.  
  1513. void glTexCoord3fv( const GLfloat *v )
  1514. {
  1515.    glTexCoord4f( v[0], v[1], v[2], 1.0 );
  1516. }
  1517.  
  1518. void glTexCoord3iv( const GLint *v )
  1519. {
  1520.    glTexCoord4f( (GLfloat) v[0], (GLfloat) v[1], (GLfloat) v[2], 1.0 );
  1521. }
  1522.  
  1523. void glTexCoord3sv( const GLshort *v )
  1524. {
  1525.    glTexCoord4f( (GLfloat) v[0], (GLfloat) v[1], (GLfloat) v[2], 1.0 );
  1526. }
  1527.  
  1528. void glTexCoord4dv( const GLdouble *v )
  1529. {
  1530.    glTexCoord4f( (GLfloat) v[0], (GLfloat) v[1],
  1531.          (GLfloat) v[2], (GLfloat) v[3] );
  1532. }
  1533.  
  1534. void glTexCoord4fv( const GLfloat *v )
  1535. {
  1536.    glTexCoord4f( v[0], v[1], v[2], v[3] );
  1537. }
  1538.  
  1539. void glTexCoord4iv( const GLint *v )
  1540. {
  1541.    glTexCoord4f( (GLfloat) v[0], (GLfloat) v[1],
  1542.          (GLfloat) v[2], (GLfloat) v[3] );
  1543. }
  1544.  
  1545. void glTexCoord4sv( const GLshort *v )
  1546. {
  1547.    glTexCoord4f( (GLfloat) v[0], (GLfloat) v[1],
  1548.          (GLfloat) v[2], (GLfloat) v[3] );
  1549. }
  1550.  
  1551.  
  1552.  
  1553. /*
  1554.  *
  1555.  * Polygon Edge Flags
  1556.  *
  1557.  */
  1558.  
  1559.  
  1560. void glEdgeFlag( GLboolean flag )
  1561. {
  1562.    if (CC.ExecuteFlag) {
  1563.       CC.Current.EdgeFlag = flag;
  1564.       if (!CC.CompileFlag) return;
  1565.    }
  1566.    gl_save_edgeflag( flag );
  1567. }
  1568.  
  1569.  
  1570.  
  1571. void glEdgeFlagv( const GLboolean *flag )
  1572. {
  1573.    if (CC.ExecuteFlag) {
  1574.       CC.Current.EdgeFlag = *flag;
  1575.       if (!CC.CompileFlag) return;
  1576.    }
  1577.    gl_save_edgeflag( *flag );
  1578. }
  1579.