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

  1. /* $Id: enable.c,v 1.28 1996/04/25 20:40:48 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: enable.c,v $
  26.  * Revision 1.28  1996/04/25  20:40:48  brianp
  27.  * call DD.alloc_depth_buffer() instead of gl_alloc_depth_buffer()
  28.  *
  29.  * Revision 1.27  1996/04/23  22:11:35  brianp
  30.  * set CC.VertexFunc to gl_nop_vertex when lighting or texturing en/disabled
  31.  *
  32.  * Revision 1.26  1996/02/26  15:07:16  brianp
  33.  * replaced CC.Current.Color with CC.Current.IntColor
  34.  *
  35.  * Revision 1.25  1996/02/15  16:11:24  brianp
  36.  * don't compile vertex array enable/disables into display lists
  37.  *
  38.  * Revision 1.24  1996/02/15  16:01:49  brianp
  39.  * added vertex array extension support
  40.  *
  41.  * Revision 1.23  1996/02/13  17:47:19  brianp
  42.  * removed code to compute CC.Light.LastEnabled
  43.  *
  44.  * Revision 1.22  1996/01/02  22:11:53  brianp
  45.  * signal CC.NewState when enable/disabling dithering
  46.  *
  47.  * Revision 1.21  1995/12/20  17:29:12  brianp
  48.  * replaced call to gl_color with call to gl_material
  49.  *
  50.  * Revision 1.20  1995/11/01  21:45:45  brianp
  51.  * update CC.Light.LastEnabled when enabling/disabling lights
  52.  *
  53.  * Revision 1.19  1995/10/27  20:29:02  brianp
  54.  * added glPolygonOffsetEXT() support
  55.  *
  56.  * Revision 1.18  1995/10/19  15:47:26  brianp
  57.  * only set NewState flag when really needed
  58.  *
  59.  * Revision 1.17  1995/10/14  16:30:49  brianp
  60.  * added DD.dither call
  61.  *
  62.  * Revision 1.16  1995/10/04  22:02:38  brianp
  63.  * set CC.NewState when GL_LIGHTING is enabled/disabled
  64.  *
  65.  * Revision 1.15  1995/09/22  21:49:52  brianp
  66.  * don't allow glEnable(GL_TEXTURE_xD) in CI mode
  67.  *
  68.  * Revision 1.14  1995/09/15  18:40:25  brianp
  69.  * only signal CC.NewState when necessary
  70.  *
  71.  * Revision 1.13  1995/08/31  21:29:53  brianp
  72.  * new TexGenEnabled bitfield
  73.  * introduced CC.NewState convention
  74.  *
  75.  * Revision 1.12  1995/06/21  15:10:47  brianp
  76.  * allocate stencil buffer when stencil test is enabled
  77.  *
  78.  * Revision 1.11  1995/06/20  22:11:18  brianp
  79.  * fixed depth buffer allocation bug in glEnable(), per Asif Khan
  80.  *
  81.  * Revision 1.10  1995/05/22  21:02:41  brianp
  82.  * Release 1.2
  83.  *
  84.  * Revision 1.9  1995/05/12  19:26:43  brianp
  85.  * replaced CC.Mode!=0 with INSIDE_BEGIN_END
  86.  *
  87.  * Revision 1.8  1995/03/27  20:31:26  brianp
  88.  * new Texture.Enabled scheme
  89.  *
  90.  * Revision 1.7  1995/03/24  20:03:21  brianp
  91.  * added gl_update_pixel_logic call to GL_BLEND case
  92.  *
  93.  * Revision 1.6  1995/03/24  17:00:22  brianp
  94.  * added gl_update_pixel_logic
  95.  *
  96.  * Revision 1.5  1995/03/09  21:41:39  brianp
  97.  * call gl_udpate_rasterflags for GL_CULL_FACE
  98.  *
  99.  * Revision 1.4  1995/03/09  19:07:39  brianp
  100.  * removed gl_disable, fixed color_material bug
  101.  *
  102.  * Revision 1.3  1995/03/04  19:29:44  brianp
  103.  * 1.1 beta revision
  104.  *
  105.  * Revision 1.2  1995/02/24  15:25:46  brianp
  106.  * added error checks to gl_enable and gl_disable
  107.  *
  108.  * Revision 1.1  1995/02/24  14:21:54  brianp
  109.  * Initial revision
  110.  *
  111.  */
  112.  
  113.  
  114. #include <string.h>
  115. #include "context.h"
  116. #include "dd.h"
  117. #include "depth.h"
  118. #include "draw.h"
  119. #include "light.h"
  120. #include "list.h"
  121. #include "macros.h"
  122. #include "stencil.h"
  123.  
  124.  
  125.  
  126.  
  127. /*
  128.  * Perform glEnable and glDisable calls.
  129.  */
  130. void gl_enable( GLenum cap, GLboolean state )
  131. {
  132.    GLuint i, p;
  133.  
  134.    if (INSIDE_BEGIN_END) {
  135.       if (state) {
  136.      gl_error( GL_INVALID_OPERATION, "glEnable" );
  137.       }
  138.       else {
  139.      gl_error( GL_INVALID_OPERATION, "glDisable" );
  140.       }
  141.       return;
  142.    }
  143.  
  144.    switch (cap) {
  145.       case GL_ALPHA_TEST:
  146.          if (CC.Color.AlphaEnabled!=state) {
  147.             CC.Color.AlphaEnabled = state;
  148.             CC.NewState = GL_TRUE;
  149.          }
  150.      break;
  151.       case GL_AUTO_NORMAL:
  152.      CC.Eval.AutoNormal = state;
  153.      break;
  154.       case GL_BLEND:
  155.          if (CC.Color.BlendEnabled!=state) {
  156.             CC.Color.BlendEnabled = state;
  157.             CC.NewState = GL_TRUE;
  158.          }
  159.      break;
  160.       case GL_CLIP_PLANE0:
  161.       case GL_CLIP_PLANE1:
  162.       case GL_CLIP_PLANE2:
  163.       case GL_CLIP_PLANE3:
  164.       case GL_CLIP_PLANE4:
  165.       case GL_CLIP_PLANE5:
  166.      CC.Transform.ClipEnabled[cap-GL_CLIP_PLANE0] = state;
  167.      /* Check if any clip planes enabled */
  168.          CC.Transform.AnyClip = GL_FALSE;
  169.          for (p=0;p<MAX_CLIP_PLANES;p++) {
  170.             if (CC.Transform.ClipEnabled[p]) {
  171.                CC.Transform.AnyClip = GL_TRUE;
  172.                break;
  173.             }
  174.          }
  175.      break;
  176.       case GL_COLOR_MATERIAL:
  177.          if (CC.Light.ColorMaterialEnabled!=state) {
  178.             CC.Light.ColorMaterialEnabled = state;
  179.             if (state) {
  180.                GLfloat color[4];
  181.                color[0] = CC.Current.IntColor[0] / CC.RedScale;
  182.                color[1] = CC.Current.IntColor[1] / CC.GreenScale;
  183.                color[2] = CC.Current.IntColor[2] / CC.BlueScale;
  184.                color[3] = CC.Current.IntColor[3] / CC.AlphaScale;
  185.                /* update material with current color */
  186.                gl_material( CC.Light.ColorMaterialFace,
  187.                             CC.Light.ColorMaterialMode, color );
  188.             }
  189.             CC.NewState = GL_TRUE;
  190.          }
  191.      break;
  192.       case GL_CULL_FACE:
  193.          if (CC.Polygon.CullFlag!=state) {
  194.             CC.Polygon.CullFlag = state;
  195.             CC.NewState = GL_TRUE;
  196.          }
  197.      break;
  198.       case GL_DEPTH_TEST:
  199.      if (CC.Depth.Test!=state) {
  200.             CC.Depth.Test = state;
  201.             CC.NewState = GL_TRUE;
  202.          }
  203.      if (state && !CC.DepthBuffer) {
  204.         /* need to allocate a depth buffer now */
  205.         (*DD.alloc_depth_buffer)();
  206.      }
  207.          break;
  208.       case GL_DITHER:
  209.      CC.Color.DitherFlag = state;
  210.          if (DD.dither) {
  211.             (*DD.dither)( state );
  212.          }
  213.          CC.NewState = GL_TRUE;
  214.      break;
  215.       case GL_FOG:
  216.      if (CC.Fog.Enabled!=state) {
  217.             CC.Fog.Enabled = state;
  218.             CC.NewState = GL_TRUE;
  219.          }
  220.      break;
  221.       case GL_LIGHT0:
  222.       case GL_LIGHT1:
  223.       case GL_LIGHT2:
  224.       case GL_LIGHT3:
  225.       case GL_LIGHT4:
  226.       case GL_LIGHT5:
  227.       case GL_LIGHT6:
  228.       case GL_LIGHT7:
  229.          CC.Light.Light[cap-GL_LIGHT0].Enabled = state;
  230.          CC.NewState = GL_TRUE;
  231.          break;
  232.       case GL_LIGHTING:
  233.          if (CC.Light.Enabled!=state) {
  234.             CC.Light.Enabled = state;
  235.             CC.NewState = GL_TRUE;
  236.             CC.VertexFunc = gl_nop_vertex;
  237.          }
  238.          break;
  239.       case GL_LINE_SMOOTH:
  240.      if (CC.Line.SmoothFlag!=state) {
  241.             CC.Line.SmoothFlag = state;
  242.             CC.NewState = GL_TRUE;
  243.          }
  244.      break;
  245.       case GL_LINE_STIPPLE:
  246.      if (CC.Line.StippleFlag!=state) {
  247.             CC.Line.StippleFlag = state;
  248.             CC.NewState = GL_TRUE;
  249.          }
  250.      break;
  251.       case GL_LOGIC_OP:
  252.      if (CC.Color.LogicOpEnabled!=state) {
  253.             CC.NewState = GL_TRUE;
  254.          }
  255.      CC.Color.LogicOpEnabled = state;
  256.      break;
  257.       case GL_MAP1_COLOR_4:
  258.      CC.Eval.Map1Color4 = state;
  259.      break;
  260.       case GL_MAP1_INDEX:
  261.      CC.Eval.Map1Index = state;
  262.      break;
  263.       case GL_MAP1_NORMAL:
  264.      CC.Eval.Map1Normal = state;
  265.      break;
  266.       case GL_MAP1_TEXTURE_COORD_1:
  267.      CC.Eval.Map1TextureCoord1 = state;
  268.      break;
  269.       case GL_MAP1_TEXTURE_COORD_2:
  270.      CC.Eval.Map1TextureCoord2 = state;
  271.      break;
  272.       case GL_MAP1_TEXTURE_COORD_3:
  273.      CC.Eval.Map1TextureCoord3 = state;
  274.      break;
  275.       case GL_MAP1_TEXTURE_COORD_4:
  276.      CC.Eval.Map1TextureCoord4 = state;
  277.      break;
  278.       case GL_MAP1_VERTEX_3:
  279.      CC.Eval.Map1Vertex3 = state;
  280.      break;
  281.       case GL_MAP1_VERTEX_4:
  282.      CC.Eval.Map1Vertex4 = state;
  283.      break;
  284.       case GL_MAP2_COLOR_4:
  285.      CC.Eval.Map2Color4 = state;
  286.      break;
  287.       case GL_MAP2_INDEX:
  288.      CC.Eval.Map2Index = state;
  289.      break;
  290.       case GL_MAP2_NORMAL:
  291.      CC.Eval.Map2Normal = state;
  292.      break;
  293.       case GL_MAP2_TEXTURE_COORD_1: 
  294.      CC.Eval.Map2TextureCoord1 = state;
  295.      break;
  296.       case GL_MAP2_TEXTURE_COORD_2:
  297.      CC.Eval.Map2TextureCoord2 = state;
  298.      break;
  299.       case GL_MAP2_TEXTURE_COORD_3:
  300.      CC.Eval.Map2TextureCoord3 = state;
  301.      break;
  302.       case GL_MAP2_TEXTURE_COORD_4:
  303.      CC.Eval.Map2TextureCoord4 = state;
  304.      break;
  305.       case GL_MAP2_VERTEX_3:
  306.      CC.Eval.Map2Vertex3 = state;
  307.      break;
  308.       case GL_MAP2_VERTEX_4:
  309.      CC.Eval.Map2Vertex4 = state;
  310.      break;
  311.       case GL_NORMALIZE:
  312.      CC.Transform.Normalize = state;
  313.      break;
  314.       case GL_POINT_SMOOTH:
  315.      if (CC.Point.SmoothFlag!=state) {
  316.             CC.Point.SmoothFlag = state;
  317.             CC.NewState = GL_TRUE;
  318.          }
  319.      break;
  320.       case GL_POLYGON_SMOOTH:
  321.      if (CC.Polygon.SmoothFlag!=state) {
  322.             CC.Polygon.SmoothFlag = state;
  323.             CC.NewState = GL_TRUE;
  324.          }
  325.      break;
  326.       case GL_POLYGON_STIPPLE:
  327.      if (CC.Polygon.StippleFlag!=state) {
  328.             CC.Polygon.StippleFlag = state;
  329.             CC.NewState = GL_TRUE;
  330.          }
  331.      break;
  332.       case GL_POLYGON_OFFSET_EXT:
  333.          if (CC.Polygon.OffsetEnabled!=state) {
  334.             CC.Polygon.OffsetEnabled = state;
  335.             CC.NewState = GL_TRUE;
  336.          }
  337.          break;
  338.       case GL_SCISSOR_TEST:
  339.          if (CC.Scissor.Enabled!=state) {
  340.             CC.Scissor.Enabled = state;
  341.             CC.NewState = GL_TRUE;
  342.          }
  343.      break;
  344.       case GL_STENCIL_TEST:
  345.      if (CC.Stencil.Enabled!=state) {
  346.             CC.Stencil.Enabled = state;
  347.             CC.NewState = GL_TRUE;
  348.          }
  349.      if (state && !CC.StencilBuffer) {
  350.         /* need to allocate a stencil buffer now */
  351.         gl_alloc_stencil_buffer();
  352.      }
  353.      break;
  354.       case GL_TEXTURE_1D:
  355.          if (CC.RGBAflag) {
  356.             /* texturing only works in RGB mode */
  357.             if (state) {
  358.                CC.Texture.Enabled |= 1;
  359.             }
  360.             else {
  361.                CC.Texture.Enabled &= 2;
  362.             }
  363.             CC.NewState = GL_TRUE;
  364.             CC.VertexFunc = gl_nop_vertex;
  365.          }
  366.      break;
  367.       case GL_TEXTURE_2D:
  368.          if (CC.RGBAflag) {
  369.             /* texturing only works in RGB mode */
  370.             if (state) {
  371.                CC.Texture.Enabled |= 2;
  372.             }
  373.             else {
  374.                CC.Texture.Enabled &= 1;
  375.             }
  376.             CC.NewState = GL_TRUE;
  377.             CC.VertexFunc = gl_nop_vertex;
  378.          }
  379.      break;
  380.       case GL_TEXTURE_GEN_Q:
  381.          if (state) {
  382.             CC.Texture.TexGenEnabled |= Q_BIT;
  383.          }
  384.          else {
  385.             CC.Texture.TexGenEnabled &= ~Q_BIT;
  386.          }
  387.          CC.NewState = GL_TRUE;
  388.      break;
  389.       case GL_TEXTURE_GEN_R:
  390.          if (state) {
  391.             CC.Texture.TexGenEnabled |= R_BIT;
  392.          }
  393.          else {
  394.             CC.Texture.TexGenEnabled &= ~R_BIT;
  395.          }
  396.          CC.NewState = GL_TRUE;
  397.      break;
  398.       case GL_TEXTURE_GEN_S:
  399.      if (state) {
  400.             CC.Texture.TexGenEnabled |= S_BIT;
  401.          }
  402.          else {
  403.             CC.Texture.TexGenEnabled &= ~S_BIT;
  404.          }
  405.          CC.NewState = GL_TRUE;
  406.      break;
  407.       case GL_TEXTURE_GEN_T:
  408.          if (state) {
  409.             CC.Texture.TexGenEnabled |= T_BIT;
  410.          }
  411.          else {
  412.             CC.Texture.TexGenEnabled &= ~T_BIT;
  413.          }
  414.          CC.NewState = GL_TRUE;
  415.      break;
  416.       case GL_VERTEX_ARRAY_EXT:
  417.          CC.Array.VertexEnabled = state;
  418.          break;
  419.       case GL_NORMAL_ARRAY_EXT:
  420.          CC.Array.NormalEnabled = state;
  421.          break;
  422.       case GL_COLOR_ARRAY_EXT:
  423.          CC.Array.ColorEnabled = state;
  424.          break;
  425.       case GL_INDEX_ARRAY_EXT:
  426.          CC.Array.IndexEnabled = state;
  427.          break;
  428.       case GL_TEXTURE_COORD_ARRAY_EXT:
  429.          CC.Array.TexCoordEnabled = state;
  430.          break;
  431.       case GL_EDGE_FLAG_ARRAY_EXT:
  432.          CC.Array.EdgeFlagEnabled = state;
  433.          break;
  434.       default:
  435.      if (state) {
  436.         gl_error( GL_INVALID_ENUM, "glEnable" );
  437.      }
  438.      else {
  439.         gl_error( GL_INVALID_ENUM, "glDisable" );
  440.      }
  441.          break;
  442.    }
  443. }
  444.  
  445.  
  446.  
  447.  
  448. void glEnable( GLenum cap )
  449. {
  450.    if (CC.CompileFlag) {
  451.       switch (cap) {
  452.          case GL_VERTEX_ARRAY_EXT:
  453.          case GL_NORMAL_ARRAY_EXT:
  454.          case GL_COLOR_ARRAY_EXT:
  455.          case GL_INDEX_ARRAY_EXT:
  456.          case GL_TEXTURE_COORD_ARRAY_EXT:
  457.          case GL_EDGE_FLAG_ARRAY_EXT:
  458.             /* A special case: these don't get put into display lists */
  459.             break;
  460.          default:
  461.             gl_save_enable( cap );
  462.       }
  463.    }
  464.    if (CC.ExecuteFlag) {
  465.       gl_enable( cap, GL_TRUE );
  466.    }
  467. }
  468.  
  469.  
  470.  
  471. void glDisable( GLenum cap )
  472. {
  473.    if (CC.CompileFlag) {
  474.       switch (cap) {
  475.          case GL_VERTEX_ARRAY_EXT:
  476.          case GL_NORMAL_ARRAY_EXT:
  477.          case GL_COLOR_ARRAY_EXT:
  478.          case GL_INDEX_ARRAY_EXT:
  479.          case GL_TEXTURE_COORD_ARRAY_EXT:
  480.          case GL_EDGE_FLAG_ARRAY_EXT:
  481.             /* A special case: these don't get put into display lists */
  482.             break;
  483.          default:
  484.             gl_save_disable( cap );
  485.       }
  486.    }
  487.    if (CC.ExecuteFlag) {
  488.       gl_enable( cap, GL_FALSE );
  489.    }
  490. }
  491.  
  492.  
  493.  
  494. GLboolean glIsEnabled( GLenum cap )
  495. {
  496.    switch (cap) {
  497.       case GL_ALPHA_TEST:
  498.          return CC.Color.AlphaEnabled;
  499.       case GL_AUTO_NORMAL:
  500.      return CC.Eval.AutoNormal;
  501.       case GL_BLEND:
  502.          return CC.Color.BlendEnabled;
  503.       case GL_CLIP_PLANE0:
  504.       case GL_CLIP_PLANE1:
  505.       case GL_CLIP_PLANE2:
  506.       case GL_CLIP_PLANE3:
  507.       case GL_CLIP_PLANE4:
  508.       case GL_CLIP_PLANE5:
  509.      return CC.Transform.ClipEnabled[cap-GL_CLIP_PLANE0];
  510.       case GL_COLOR_MATERIAL:
  511.      return CC.Light.ColorMaterialEnabled;
  512.       case GL_CULL_FACE:
  513.          return CC.Polygon.CullFlag;
  514.       case GL_DEPTH_TEST:
  515.          return CC.Depth.Test;
  516.       case GL_DITHER:
  517.      return CC.Color.DitherFlag;
  518.       case GL_FOG:
  519.      return CC.Fog.Enabled;
  520.       case GL_LIGHTING:
  521.          return CC.Light.Enabled;
  522.       case GL_LIGHT0:
  523.       case GL_LIGHT1:
  524.       case GL_LIGHT2:
  525.       case GL_LIGHT3:
  526.       case GL_LIGHT4:
  527.       case GL_LIGHT5:
  528.       case GL_LIGHT6:
  529.       case GL_LIGHT7:
  530.          return CC.Light.Light[cap-GL_LIGHT0].Enabled;
  531.       case GL_LINE_SMOOTH:
  532.      return CC.Line.SmoothFlag;
  533.       case GL_LINE_STIPPLE:
  534.      return CC.Line.StippleFlag;
  535.       case GL_LOGIC_OP:
  536.      return CC.Color.LogicOpEnabled;
  537.       case GL_MAP1_COLOR_4:
  538.      return CC.Eval.Map1Color4;
  539.       case GL_MAP1_INDEX:
  540.      return CC.Eval.Map1Index;
  541.       case GL_MAP1_NORMAL:
  542.      return CC.Eval.Map1Normal;
  543.       case GL_MAP1_TEXTURE_COORD_1:
  544.      return CC.Eval.Map1TextureCoord1;
  545.       case GL_MAP1_TEXTURE_COORD_2:
  546.      return CC.Eval.Map1TextureCoord2;
  547.       case GL_MAP1_TEXTURE_COORD_3:
  548.      return CC.Eval.Map1TextureCoord3;
  549.       case GL_MAP1_TEXTURE_COORD_4:
  550.      return CC.Eval.Map1TextureCoord4;
  551.       case GL_MAP1_VERTEX_3:
  552.      return CC.Eval.Map1Vertex3;
  553.       case GL_MAP1_VERTEX_4:
  554.      return CC.Eval.Map1Vertex4;
  555.       case GL_MAP2_COLOR_4:
  556.      return CC.Eval.Map2Color4;
  557.       case GL_MAP2_INDEX:
  558.      return CC.Eval.Map2Index;
  559.       case GL_MAP2_NORMAL:
  560.      return CC.Eval.Map2Normal;
  561.       case GL_MAP2_TEXTURE_COORD_1: 
  562.      return CC.Eval.Map2TextureCoord1;
  563.       case GL_MAP2_TEXTURE_COORD_2:
  564.      return CC.Eval.Map2TextureCoord2;
  565.       case GL_MAP2_TEXTURE_COORD_3:
  566.      return CC.Eval.Map2TextureCoord3;
  567.       case GL_MAP2_TEXTURE_COORD_4:
  568.      return CC.Eval.Map2TextureCoord4;
  569.       case GL_MAP2_VERTEX_3:
  570.      return CC.Eval.Map2Vertex3;
  571.       case GL_MAP2_VERTEX_4:
  572.      return CC.Eval.Map2Vertex4;
  573.       case GL_NORMALIZE:
  574.      return CC.Transform.Normalize;
  575.       case GL_POINT_SMOOTH:
  576.      return CC.Point.SmoothFlag;
  577.       case GL_POLYGON_SMOOTH:
  578.      return CC.Polygon.SmoothFlag;
  579.       case GL_POLYGON_STIPPLE:
  580.      return CC.Polygon.StippleFlag;
  581.       case GL_POLYGON_OFFSET_EXT:
  582.      return CC.Polygon.OffsetEnabled;
  583.       case GL_SCISSOR_TEST:
  584.      return CC.Scissor.Enabled;
  585.       case GL_STENCIL_TEST:
  586.      return CC.Stencil.Enabled;
  587.       case GL_TEXTURE_1D:
  588.      return (CC.Texture.Enabled & 1) ? GL_TRUE : GL_FALSE;
  589.       case GL_TEXTURE_2D:
  590.      return (CC.Texture.Enabled & 2) ? GL_TRUE : GL_FALSE;
  591.       case GL_TEXTURE_GEN_Q:
  592.      return (CC.Texture.TexGenEnabled & Q_BIT) ? GL_TRUE : GL_FALSE;
  593.       case GL_TEXTURE_GEN_R:
  594.      return (CC.Texture.TexGenEnabled & R_BIT) ? GL_TRUE : GL_FALSE;
  595.       case GL_TEXTURE_GEN_S:
  596.      return (CC.Texture.TexGenEnabled & S_BIT) ? GL_TRUE : GL_FALSE;
  597.       case GL_TEXTURE_GEN_T:
  598.      return (CC.Texture.TexGenEnabled & T_BIT) ? GL_TRUE : GL_FALSE;
  599.       case GL_VERTEX_ARRAY_EXT:
  600.          return CC.Array.VertexEnabled;
  601.       case GL_NORMAL_ARRAY_EXT:
  602.          return CC.Array.NormalEnabled;
  603.       case GL_COLOR_ARRAY_EXT:
  604.          return CC.Array.ColorEnabled;
  605.       case GL_INDEX_ARRAY_EXT:
  606.          return CC.Array.IndexEnabled;
  607.       case GL_TEXTURE_COORD_ARRAY_EXT:
  608.          return CC.Array.TexCoordEnabled;
  609.       case GL_EDGE_FLAG_ARRAY_EXT:
  610.          return CC.Array.EdgeFlagEnabled;
  611.       default:
  612.      gl_error( GL_INVALID_ENUM, "glIsEnabled" );
  613.      return GL_FALSE;
  614.    }
  615. }
  616.  
  617.