VTK
dox/Rendering/OpenGL/vtkOpenGLState.h
Go to the documentation of this file.
00001 /*=========================================================================
00002 
00003   Program:   Visualization Toolkit
00004   Module:    vtkOpenGLState.h
00005 
00006   Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
00007   All rights reserved.
00008   See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
00009 
00010      This software is distributed WITHOUT ANY WARRANTY; without even
00011      the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
00012      PURPOSE.  See the above copyright notice for more information.
00013 
00014 =========================================================================*/
00033 #ifndef __vtkOpenGLState_h
00034 #define __vtkOpenGLState_h
00035 
00036 #include "vtkRenderingOpenGLModule.h" // For export macro
00037 #include "vtkgl.h"
00038 #include <vector>
00039 
00040 class vtkOpenGLRenderWindow;
00041 
00042 class vtkOpenGLMaterialState
00043 {
00044 public:
00045   GLfloat Ambient[4];
00046   GLfloat Diffuse[4];
00047   GLfloat Specular[4];
00048   GLfloat Shininess;
00049 
00050   GLfloat AmbientIndex;
00051   GLfloat DiffuseIndex;
00052   GLfloat SpecularIndex;
00053 };
00054 
00055 class vtkOpenGLLightState
00056 {
00057 public:
00058   void Update();
00059 
00060   GLfloat Ambient[4];
00061   GLfloat Diffuse[4];
00062   GLfloat Specular[4];
00063   GLfloat Position[4];
00064   GLfloat ConstantAttenuation;
00065   GLfloat LinearAttenuation;
00066   GLfloat QuadraticAttenuation;
00067   GLfloat SpotDirection[4];
00068   GLfloat SpotExponent;
00069   GLfloat SpotCutoff;
00070 };
00071 
00072 class vtkOpenGLTextureImageState
00073 {
00074 public:
00075   void Update();
00076 
00077   GLvoid *Image;
00078   GLint Width;
00079   GLint Height;
00080   GLint Border;
00081   GLint InternalFormat;
00082   GLint RedSize;
00083   GLint GreenSize;
00084   GLint BlueSize;
00085   GLint AlphaSize;
00086   GLint LuminanceSize;
00087   GLint IntensitySize;
00088 
00089   // 1.2.1
00090   GLint Depth;
00091 
00092   // 1.3
00093   GLboolean Compressed;
00094   GLint CompressedImageSize;
00095 
00096   // 1.4
00097   GLint DepthSize;
00098 };
00099 
00100 #if 0
00101 class vtkOpenGLTextureObjectState
00102 {
00103 public:
00104   void Update();
00105 
00106   static const int n=10;
00107   vtkOpenGLTextureImageState Texture1D[n];
00108   vtkOpenGLTextureImageState Texture2D[n];
00109 
00110   GLfloat BorderColor[4];
00111   GLint MinFilter;
00112   GLint MagFilter;
00113   GLint WrapS;
00114   GLint WrapT;
00115   GLfloat TexturePriority;
00116   GLboolean TextureResident;
00117 
00118   // 1.2.1
00119   vtkOpenGLTextureImageState Texture3D[n];
00120 
00121   GLint WrapR;
00122   GLint MinLOD;
00123   GLint MaxLOD;
00124   GLint BaseLevel;
00125   GLint MaxLevel;
00126 
00127   // 1.3
00128   vtkOpenGLTextureImageState TextureCubeMapPositiveX[n];
00129   vtkOpenGLTextureImageState TextureCubeMapNegativeX[n];
00130   vtkOpenGLTextureImageState TextureCubeMapPositiveY[n];
00131   vtkOpenGLTextureImageState TextureCubeMapNegativeY[n];
00132   vtkOpenGLTextureImageState TextureCubeMapPositiveZ[n];
00133   vtkOpenGLTextureImageState TextureCubeMapNegativeZ[n];
00134 
00135   // 1.4
00136   GLfloat LODBias;
00137   GLint DepthTextureMode;
00138   GLint TextureCompareMode;
00139   GLint TextureCompareFunc;
00140   GLboolean GenerateMipmap;
00141 };
00142 #endif
00143 
00144 class vtkOpenGLTexGenState
00145 {
00146 public:
00147   void Update();
00148 
00149   GLboolean Enabled;
00150   GLfloat EyePlane[4];
00151   GLfloat ObjectPlane[4];
00152   GLint Mode;
00153 };
00154 
00155 class vtkOpenGLPixelControl
00156 {
00157 public:
00158   void Update();
00159   void PrintSelf(ostream &os,
00160                  vtkIndent indent);
00161   GLboolean SwapBytes;
00162   GLboolean LsbFirst; // Warning: cannot be LSBFirst, as it is defined in X.h
00163   GLint RowLength;
00164   GLint SkipRows;
00165   GLint SkipPixels;
00166   GLint Alignment;
00167 
00168   // 1.2.1
00169   GLint ImageHeight;
00170   GLint SkipImages;
00171 };
00172 
00173 class vtkOpenGLComponentTransform
00174 {
00175 public:
00176   void Update();
00177   void PrintSelf(ostream &os,
00178                  vtkIndent indent);
00179   GLfloat Scale;
00180   GLfloat Bias;
00181 };
00182 
00183 class vtkOpenGLRGBAPixelMapState
00184 {
00185 public:
00186   void Update();
00187 
00188   GLint Size;
00189   GLfloat *Map; // values
00190 };
00191 
00192 class vtkOpenGLIndexPixelMapState
00193 {
00194 public:
00195   void Update();
00196 
00197   GLint Size;
00198   GLint *Map; // values
00199 };
00200 
00201 class vtkOpenGLTextureCoordinateProcessingUnit
00202 {
00203 public:
00204   GLfloat CurrentMatrix[16];
00205   GLint MatrixStackDepth;
00206   vtkOpenGLTexGenState TextureGenS;
00207   vtkOpenGLTexGenState TextureGenT;
00208   vtkOpenGLTexGenState TextureGenR;
00209   vtkOpenGLTexGenState TextureGenQ;
00210   // Texture environment generation, 2.0
00211   GLboolean CoordReplace;
00212 
00213   GLfloat CurrentTextureCoords[4];
00214   GLfloat CurrentRasterTextureCoords[4];
00215 };
00216 
00217 class vtkOpenGLTextureImageUnit
00218 {
00219 public:
00220   // Texture object bound to 1D target/sampler
00221   GLint TextureBinding1D;
00222   // Texture object bound to 2D target/sampler
00223   GLint TextureBinding2D;
00224   // 1.2.1
00225   // Texture object bound to 3D target/sampler
00226   GLint TextureBinding3D;
00227   // 1.3
00228   // Texture object bound to cubemap target/sampler
00229   GLint TextureBindingCubeMap;
00230 };
00231 
00232 class vtkOpenGLTextureImageUnitFixedPipelineState
00233 {
00234 public:
00235   GLboolean Texture1DEnabled;
00236   GLboolean Texture2DEnabled;
00237   // 1.2.1
00238   GLboolean Texture3DEnabled;
00239   // 1.3
00240   GLboolean TextureCubeMapEnabled;
00241 };
00242 
00243 class vtkOpenGLClipPlaneState
00244 {
00245 public:
00246   GLfloat Equation[4];
00247   GLboolean Enabled;
00248 };
00249 
00250 
00251 // Replaced by shader program
00252 class vtkOpenGLFixePipelineState
00253 {
00254 public:
00255   // Replaced by verter shader
00256 
00257   // Transformation state
00258   GLboolean Normalize;
00259 
00260   // Transformation state: 1.2.1
00261   GLboolean RescaleNormal;
00262 
00263   // Lighting
00264   GLboolean LightingEnabled;
00265 
00266   std::vector<GLboolean> *LightEnabled; // MaxLights (ex:8)
00267 
00268 
00269   // Replaced by fragment shader:
00270 
00271   // 1.3
00272   GLint CombineRGB;
00273   GLint CombineAlpha;
00274   GLint Source0RGB;
00275   GLint Source1RGB;
00276   GLint Source2RGB;
00277   GLint Source0Alpha;
00278   GLint Source1Alpha;
00279   GLint Source2Alpha;
00280   GLint Operand0RGB;
00281   GLint Operand1RGB;
00282   GLint Operand2RGB;
00283   GLint Operand0Alpha;
00284   GLint Operand1Alpha;
00285   GLint Operand2Alpha;
00286   GLint RGBScale;
00287   GLint AlphaScale;
00288 
00289   std::vector<vtkOpenGLTextureImageUnitFixedPipelineState> *TextureImageUnitEnabled; // MaxTextureUnits (ex: 4)
00290 
00291     // Coloring
00292   GLboolean FogEnabled;
00293   // Coloring, 1.4
00294   GLboolean ColorSumEnabled;
00295 };
00296 
00297 class vtkOpenGLBufferObjectState
00298 {
00299 public:
00300   void PrintSelf(ostream &os,
00301                  vtkIndent indent);
00302 
00303   GLuint Id;
00304   GLint Size;
00305   GLenum Usage;
00306   GLenum Access;
00307   GLenum AccessFlags; // in GL 3.1 spec but missing in header files
00308   GLboolean Mapped;
00309   GLvoid *MapPointer;
00310   GLint MapOffset; // in GL 3.1 spec but missing in header files
00311   GLint MapLength; // in GL 3.1 spec but missing in header files
00312 protected:
00313   void BufferAccessFlagsToStream(ostream &os);
00314   const char *BufferUsageToString();
00315   const char *BufferAccessToString();
00316 };
00317 
00318 class vtkOpenGLShaderState
00319 {
00320 public:
00321   void PrintSelf(ostream &os,
00322                  vtkIndent indent);
00323   GLuint Id;
00324   GLenum Type;
00325   GLboolean DeleteStatus;
00326   GLboolean CompileStatus;
00327   vtkgl::GLchar *InfoLog;
00328   GLint InfoLogLength;
00329   vtkgl::GLchar *Source;
00330   GLint SourceLength;
00331 protected:
00332   const char *ShaderTypeToString();
00333 };
00334 
00335 class vtkOpenGLProgramState
00336 {
00337 public:
00338   void PrintSelf(ostream &os,
00339                  vtkIndent indent);
00340   GLuint Id;
00341   GLboolean DeleteStatus;
00342   GLboolean LinkStatus;
00343   GLboolean ValidateStatus;
00344   GLint NumberOfAttachedShaders;
00345   GLint InfoLogLength;
00346   GLint ActiveUniforms;
00347   GLint ActiveUniformMaxLength;
00348   GLint ActiveAttributes;
00349   GLint ActiveAttributeMaxLength;
00350   std::vector<vtkOpenGLShaderState> *AttachedShaders;
00351   vtkgl::GLchar *InfoLog;
00352 
00353 
00354   bool HasVertexShader;
00355   bool HasFragmentShader;
00356 };
00357 
00358 class VTKRENDERINGOPENGL_EXPORT vtkOpenGLState
00359 {
00360 public:
00361   vtkOpenGLState(vtkOpenGLRenderWindow *context);
00362   ~vtkOpenGLState();
00363 
00364   // Save current OpenGL state in the object.
00365   void Update();
00366 
00367   void PrintSelf(ostream &os,
00368                  vtkIndent indent);
00369 
00370   // There are too many variables to make them protected and implement
00371   // a public Get method for each of them. We keep them public.
00372   // I wish C++ would syntaxically forbid construction like c->value=x,
00373   // like Eiffel does...
00374 
00375 
00376   vtkOpenGLFixePipelineState FixedPipeline;
00377 
00378   // OpenGL 1.1 state
00379 
00380   // Current values and associated data
00381 
00382   GLfloat CurrentColor[4];
00383   GLfloat CurrentIndex;
00384   //  CurrentTextureCoords: see vtkOpenGLTextureCoordinateProcessingUnit
00385   GLfloat CurrentNormal[3];
00386 
00387   GLfloat CurrentRasterPosition[4];
00388   GLfloat CurrentRasterDistance;
00389   GLfloat CurrentRasterColor[4];
00390   GLfloat CurrentRasterIndex;
00391   //  CurrentRasterTextureCoords:  see vtkOpenGLTextureCoordinateProcessingUnit
00392   GLboolean CurrentRasterPositionValid;
00393   GLboolean EdgeFlag;
00394 
00395   // Current values and associated data, 1.4
00396   GLfloat CurrentSecondaryColor[4];
00397   GLfloat CurrentFogCoordinate[3]; // or scalar?
00398 
00399   // Current values and associated data, 2.1
00400   GLfloat CurrentRasterSecondaryColor[4];
00401 
00402 
00403   // Vertex Array Data
00404 
00405   GLboolean VertexArrayEnabled;
00406   GLint VertexArraySize;
00407   GLint VertexArrayType;
00408   GLint VertexArrayStride;
00409   GLvoid *VertexArrayPointer;
00410 
00411   GLboolean NormalArrayEnabled;
00412   GLint NormalArrayType;
00413   GLint NormalArrayStride;
00414   GLvoid *NormalArrayPointer;
00415 
00416   GLboolean ColorArrayEnabled;
00417   GLint ColorArraySize;
00418   GLint ColorArrayType;
00419   GLint ColorArrayStride;
00420   GLvoid *ColorArrayPointer;
00421 
00422   GLboolean IndexArrayEnabled;
00423   GLint IndexArrayType;
00424   GLint IndexArrayStride;
00425   GLvoid *IndexArrayPointer;
00426 
00427   GLboolean TextureCoordArrayEnabled;
00428   GLint TextureCoordArraySize;
00429   GLint TextureCoordArrayType;
00430   GLint TextureCoordArrayStride;
00431   GLvoid *TextureCoordArrayPointer;
00432 
00433   GLboolean EdgeFlagArray;
00434   GLint EdgeFlagArrayStride;
00435   GLvoid *EdgeFlagArrayPointer;
00436 
00437   // Vertex Array Data, 1.3
00438   GLenum ClientActiveTexture;
00439 
00440   // Vertex Array Data, 1.4
00441   GLboolean FogCoordinateArrayEnabled;
00442   GLint FogCoordinateArrayType;
00443   GLint FogCoordinateArrayStride;
00444   GLvoid *FogCoordinateArrayPointer;
00445 
00446   GLboolean SecondaryColorArrayEnabled;
00447   GLint SecondaryColorArraySize;
00448   GLint SecondaryColorArrayType;
00449   GLint SecondaryColorArrayStride;
00450   GLvoid *SecondaryColorArrayPointer;
00451 
00452   // Vertex Array Data, 1.5, VBO
00453   GLint ArrayBufferBinding;
00454   GLint VertexArrayBufferBinding;
00455   GLint NormalArrayBufferBinding;
00456   GLint ColorArrayBufferBinding;
00457   GLint IndexArrayBufferBinding;
00458   GLint TextureCoordArrayBufferBinding;
00459   GLint EdgeFlagArrayBufferBinding;
00460   GLint SecondaryColorArrayBufferBinding;
00461   GLint FogCoordArrayBufferBinding;
00462   GLint ElementArrayBufferBinding;
00463 
00464   // Vertex Array Data, 2.0
00465   GLboolean VertexAttribArrayEnabled;
00466   GLint VertexAttribArraySize;
00467   GLint VertexAttribArrayStride;
00468   GLint VertexAttribArrayType;
00469   GLboolean VertexAttribArrayNormalized;
00470   GLvoid *VertexAttribArrayPointer;
00471 
00472   // Vertex Array Data, 2.1
00473   GLint VertexAttribArrayBufferBinding;
00474 
00475   // Buffer Object State, 1.5
00476   GLint BufferSize;
00477   GLint BufferUsage;
00478   GLint BufferAccess;
00479   GLboolean BufferMapped;
00480   GLvoid *BufferMapPointer;
00481 
00482   // Transformation state
00483 
00484   GLfloat ModelViewMatrix[16];
00485   GLint ModelViewStackDepth;
00486 
00487   GLfloat ProjectionMatrix[16];
00488   GLint ProjectionStackDepth;
00489 
00490   // 2.0
00491   GLint MaxTextureCoords; // 8
00492   std::vector<vtkOpenGLTextureCoordinateProcessingUnit> *TCPU;
00493 
00494   // 2.0
00495   GLint MaxCombinedTextureImageUnits; // 16
00496   std::vector<vtkOpenGLTextureImageUnit> *TIU;
00497 
00498   GLint Viewport[4];
00499   GLfloat DepthRange[2];
00500 
00501   GLint MatrixMode;
00502   GLboolean Normalize;
00503 
00504   std::vector<vtkOpenGLClipPlaneState> *ClipPlanes; // MaxClipPlanes (ex: 6)
00505 
00506   // Transformation state: 1.2.1, optional
00507   GLfloat ColorMatrix[16];
00508   GLint ColorMatrixStackDepth;
00509 
00510   // Coloring
00511 
00512   GLfloat FogColor[4];
00513   GLfloat FogIndex;
00514   GLfloat FogDensity;
00515   GLfloat FogStart;
00516   GLfloat FogEnd;
00517   GLint FogMode;
00518 
00519   GLint ShadeModel; // fixed-pipeline and GLSL
00520 
00521   // Coloring, 1.4
00522   GLint FogCoordinateSource; // renamed FogCoordSrc in 1.5
00523 
00524   // Lighting
00525   GLboolean ColorMaterialEnabled;
00526   GLint ColorMaterialParameter;
00527   GLint ColorMaterialFace;
00528   vtkOpenGLMaterialState FrontMaterial;
00529   vtkOpenGLMaterialState BackMaterial;
00530 
00531   GLfloat LightModelAmbient[4];
00532   GLboolean LightModelLocalViewer;
00533   GLboolean LightModelTwoSide;
00534 
00535   std::vector<vtkOpenGLLightState> *Lights; // MaxLights (ex: 8)
00536 
00537   // Lighting: 1.2.1
00538   GLint lightModelColorControl;
00539 
00540   // Rasterization
00541   GLfloat PointSize;
00542   GLboolean PointSmoothEnabled;
00543 
00544   GLfloat LineWidth;
00545   GLboolean LineSmoothEnabled;
00546   GLint LineStipplePattern;
00547   GLint LineStippleRepeat;
00548   GLboolean LineStippleEnabled;
00549 
00550   GLboolean CullFaceEnabled;
00551   GLint CullFaceMode;
00552   GLint FrontFace;
00553   GLboolean PolygonSmoothEnabled;
00554   GLint PolygonMode[2]; //0=front, 1=back
00555   GLfloat PolygonOffsetFactor;
00556   GLfloat PolygonOffsetUnits;
00557   GLboolean PolygonOffsetPointEnabled;
00558   GLboolean PolygonOffsetLineEnabled;
00559   GLboolean PolygonOffsetFillEnabled;
00560   GLint PolygonStipple;
00561   GLboolean PolygonStippleEnabled;
00562 
00563   // Rasterization, 1.4
00564   GLfloat PointSizeMin;
00565   GLfloat PointSizeMax;
00566   GLfloat PointFadeThresholdSize;
00567   GLfloat PointDistanceAttenuation;
00568 
00569   // Rasterization, 2.0
00570   GLboolean PointSpriteEnabled;
00571   GLint PointSpriteCoordOrigin;
00572 
00573   // Multisampling (1.2.1)
00574   GLboolean MultiSampleEnabled;
00575   GLboolean SampleAlphaToCoverageEnabled;
00576   GLboolean SampleAlphaToOneEnabled;
00577   GLboolean SampleCoverageEnabled;
00578   GLfloat SampleCoverageValue;
00579   GLboolean SampleCoverageInvert;
00580 
00581 
00582 
00583 //  vtkOpenGLTextureObjectState TextureObjects;
00584 
00585   // Texture environment generation
00586   GLint TextureEnvMode;
00587   GLfloat TextureEnvColor;
00588 
00589   // Texture environment generation, 1.3
00590   GLenum ActiveTexture;
00591 
00592   // Texture environment generation, 1.4
00593   GLfloat TextureLODBias;
00594 
00595   // Pixel operations
00596   // - Scissor
00597   GLboolean ScissorTestEnabled;
00598   GLint ScissorBox[4];
00599 
00600   GLboolean AlphaTestEnabled;
00601   GLint AlphaTestFunc;
00602   GLfloat AlphaTestRef;
00603 
00604   GLboolean StencilTestEnabled;
00605   GLint StencilFunc;
00606   GLint StencilValueMask;
00607   GLint StencilRef;
00608   GLint StencilFail;
00609   GLint StencilPassDepthFail;
00610   GLint StencilPassDepthPass;
00611 
00612   // - Stencil, 2.0
00613   GLint StencilBackFunc;
00614   GLint StencilBackValueMask;
00615   GLint StencilBackRef;
00616   GLint StencilBackFail;
00617   GLint StencilBackPassDepthFail;
00618   GLint StencilBackPassDepthPass;
00619 
00620   GLboolean DepthTestEnabled;
00621   GLint DepthFunc;
00622 
00623   GLboolean BlendEnabled;
00624   GLint BlendSrc; // <=1.3
00625   GLint BlendDst; // <=1.3
00626 
00627   // Optional in 1.2.1, mandatory in 1.4
00628   GLint BlendEquation; // renamed BlendEquationRGB in 2.0
00629   GLfloat BlendColor[4];
00630 
00631   // 1.4
00632   GLint BlendSrcRGB;
00633   GLint BlendSrcAlpha;
00634   GLint BlendDstRGB;
00635   GLint BlendDstAlpha;
00636 
00637   // 2.0
00638   GLint BlendEquationRGB;
00639   GLint BlendEquationAlpha;
00640 
00641   GLboolean DitherEnabled;
00642 
00643   GLboolean IndexLogicOpEnabled;
00644   GLboolean ColorLogicOpEnabled;
00645   GLint LogicOpMode;
00646 
00647   // Framebuffer control (drawing)
00648 
00649   // 2.0
00650   GLint MaxDrawBuffers;
00651   std::vector<GLint> *DrawBuffers;
00652 
00653   GLint IndexWriteMask;
00654   GLboolean ColorWriteMask[4];
00655   GLboolean DepthWriteMask;
00656   GLuint StencilWriteMask;
00657   GLfloat ColorClearValue[4];
00658   GLfloat IndexClearValue;
00659   GLfloat DepthClearValue;
00660   GLint StencilClearValue;
00661   GLfloat AccumClearValue[4];
00662 
00663   // Framebuffer control (drawing) 2.0
00664   GLuint StencilBackWriteMask;
00665 
00666   // Framebuffer control (drawing) 2.1
00667   GLint DrawBuffer0;
00668   GLint DrawBuffer1;
00669   GLint DrawBuffer3; // <max
00670 
00671   // Pixels
00672 
00673   vtkOpenGLPixelControl Unpack;
00674   vtkOpenGLPixelControl Pack;
00675 
00676   GLboolean MapColor; // see PixelMap
00677   GLboolean MapStencil; // see PixelMap
00678   GLint IndexShift;
00679   GLint IndexOffset;
00680 
00681   vtkOpenGLComponentTransform RedTransform;
00682   vtkOpenGLComponentTransform GreenTransform;
00683   vtkOpenGLComponentTransform BlueTransform;
00684   vtkOpenGLComponentTransform AlphaTransform;
00685   vtkOpenGLComponentTransform DepthTransform;
00686 
00687   GLfloat ZoomX;
00688   GLfloat ZoomY;
00689 
00690   // Size==1 <=> not used.
00691   vtkOpenGLIndexPixelMapState PixelMapColorIndexToColorIndex;
00692   vtkOpenGLIndexPixelMapState PixelMapStencilIndexToStencilIndex;
00693   vtkOpenGLRGBAPixelMapState PixelMapColorIndexToRed;
00694   vtkOpenGLRGBAPixelMapState PixelMapColorIndexToGreen;
00695   vtkOpenGLRGBAPixelMapState PixelMapColorIndexToBlue;
00696   vtkOpenGLRGBAPixelMapState PixelMapColorIndexToAlpha;
00697   vtkOpenGLRGBAPixelMapState PixelMapRedToRed;
00698   vtkOpenGLRGBAPixelMapState PixelMapGreenToGreen;
00699   vtkOpenGLRGBAPixelMapState PixelMapBlueToBlue;
00700   vtkOpenGLRGBAPixelMapState PixelMapAlphaToAlpha;
00701 
00702   // Pixels, 2.1
00703   GLenum PixelPackBufferBinding;
00704   GLenum PixelUnpackBufferBinding;
00705 
00706   // Relevant only if PixelPackBufferBinding>0
00707   vtkOpenGLBufferObjectState PixelPackBufferObject;
00708   // Relevant only if PixelUnPackBufferBinding>0
00709   vtkOpenGLBufferObjectState PixelUnpackBufferObject;
00710 
00711   // 1.2.1, optional
00712   GLboolean ColorTableEnabled;
00713   GLboolean PostConvolutionColorTableEnabled;
00714   GLboolean PostColorMatricColorTableEnabled;
00715   // TODO ...
00716 
00717   // Framebuffer control (reading)
00718 
00719   GLint ReadBuffer;
00720 
00721   // Evaluators
00722   // TODO
00723 
00724   // Shader Object State 2.0
00725   vtkOpenGLProgramState *CurrentProgramState;
00726 
00727 #if 0
00728   GLint ShaderType;
00729   GLboolean DeleteStatus;
00730   GLboolean CompileStatus;
00731   vtkgl::GLchar *ShaderLogInfo;
00732   GLint InfoLogLength;
00733   vtkgl::GLchar *ShaderSource;
00734   GLint ShaderSourceLength;
00735 #endif
00736   // Program Object State 2.0
00737   GLuint CurrentProgram;
00738 
00739 #if 0
00740   GLboolean DeleteStatus;
00741   GLboolean LinkStatus;
00742   GLboolean ValidateStatus;
00743   GLint *AttachedShaders;
00744   GLint InfoLogLength;
00745   GLint ActiveUniforms;
00746   GLint ActiveUniformMaxLength;
00747   GLint ActiveAttributes;
00748   GLint ActiveAttributesMaxLength;
00749 #endif
00750 
00751   // Vertex Shader State 2.0
00752   GLboolean VertexProgramTwoSideEnabled;
00753   GLfloat CurrentVertexAttrib[16][4];
00754   GLboolean VertexProgramPointSizeEnabled;
00755 
00756   // Hints
00757   GLint PerpectiveCorrectionHint;
00758   GLint PointSmoothHint;
00759   GLint LineSmoothHint;
00760   GLint PolygonSmoothHint;
00761   GLint FogHint;
00762   // Hints: 1.3
00763   GLint TextureCompressionHint;
00764   // Hints: 1.4
00765   GLint GenerateMipMapHint;
00766   // Hints: 2.0
00767   GLint FragmentShaderDerivativeHint;
00768 
00769   // Implementation dependent values
00770 
00771   // per OpenGL implementation
00772 
00773   GLint MaxLights;
00774   GLint MaxClipPlanes;
00775   GLint MaxModelViewStackDepth;
00776   GLint MaxProjectionStackDepth;
00777   GLint MaxTextureStackDepth;
00778   GLint SubpixelBits;
00779   GLint MaxTextureSize;
00780   GLint MaxPixelMapTable;
00781   GLint MaxNameStackDepth;
00782   GLint MaxListNesting;
00783   GLint MaxEvalOrder;
00784   GLint MaxViewportDims;
00785   GLint MaxAttribStackDepth;
00786   GLint MaxClientAttribStackDepth;
00787 
00788   // per framebuffer
00789   GLint AuxBuffers;
00790   GLboolean RGBAMode;
00791   GLboolean IndexMode;
00792   GLboolean DoubleBuffer;
00793   GLboolean Stereo;
00794 
00795   // per framebuffer object
00796   GLint MaxColorAttachments;
00797 
00798   // per OpenGL implementation
00799 
00800   GLfloat PointSizeRange[2]; // 1.2.1: renamed SmoothPointSizeRange
00801   GLfloat PointSizeGranularity; // 1.2.1: renamed SmoothPointSizeGranularity
00802   GLfloat LineWidthRange[2]; // 1.2.1: renamed SmoothLineWidthRange
00803   GLfloat LineWidthGranularity; // 1.2.1: renamed SmoothLineWidthGranularity
00804 
00805   // per framebuffer (for each color buffer)
00806   GLint RedBits;
00807   GLint GreenBits;
00808   GLint BlueBits;
00809   GLint AlphaBits;
00810   GLint IndexBits;
00811 
00812   GLint DepthBits; // depth buffer
00813   GLint StencilBits; // stencil buffer
00814 
00815   GLint AccumRedBits;
00816   GLint AccumGreenBits;
00817   GLint AccumBlueBits;
00818   GLint AccumAlphaBits;
00819 
00820   // per OpenGL implementation, 1.2.1
00821   GLint Max3DTextureSize;
00822   GLfloat AliasedPointSizeRange[2];
00823   GLfloat AliasedLineWidthRange[2];
00824   GLint MaxElementsIndices;
00825   GLint MaxElementsVertices;
00826 
00827 
00828   // per OpenGL implementation, 1.2.1, optional
00829   GLint MaxColorMatrixStackDepth;
00830   GLint MaxConvolutionWidth[3];
00831   GLint MaxConvolutionHeight[2];
00832 
00833   // per OpenGL implementation, 1.3
00834   GLint MaxCubeMapTextureSize;
00835   GLint MaxTextureUnits;
00836   GLint CompressedTextureFormats;
00837   GLint NumCompressedTextureFormats;
00838 
00839   // per framebuffer, 1.3
00840   GLint SampleBuffers;
00841   GLint Samples;
00842 
00843   // per OpenGL implementation, 1.4
00844   GLfloat MaxTextureLODBias;
00845 
00846   // per OpenGL implementation, 1.5
00847   GLint QueryCounterBits;
00848 
00849   // per OpenGL implementations, 2.0
00850   GLubyte *Extensions;
00851   GLubyte *Renderer;
00852   GLubyte *ShadingLanguageVersion;
00853   GLubyte *Vendor;
00854   GLubyte *Version;
00855   GLint MaxVertexAttribs;
00856   GLint MaxVertexUniformComponents;
00857   GLint MaxVaryingFloats;
00858   GLint MaxVertexTextureImageUnits;
00859   GLint MaxTextureImageUnits;
00860   GLint MaxFragmentUniformComponents;
00861 
00862   // Misc.
00863 
00864   // - Display lists
00865   GLint ListBase;
00866   GLint ListIndex;
00867   GLint ListMode;
00868 
00869 
00870   // - Current depth of stacks
00871   GLint AttribStackDepth;
00872   GLint ClientAtribStackDepth;
00873   GLint NameStackDepth;
00874 
00875   GLint RenderMode;
00876 
00877   // - Selection buffer
00878   GLvoid *SelectionBufferPointer;
00879   GLint SelectionBufferSize;
00880 
00881   // - Feedback buffer
00882   GLvoid *FeedbackBufferPointer;
00883   GLint FeedbackBufferSize;
00884   GLint FeedbackBufferType;
00885 
00886   // - error code
00887   GLenum ErrorCode;
00888 
00889   // Misc, 1.5
00890   GLint CurrentQuery;
00891 
00892   // Framebuffer, GL_EXT_framebuffer_object
00893   GLint FrameBufferBinding;
00894   GLint Read;
00895 
00896 protected:
00897   void UpdateCurrentProgram();
00898   void UpdateShader(size_t i);
00899 
00900   void ColorBufferToStream(ostream &os,GLint colorBuffer);
00901   const char *ErrorCodeToString();
00902   const char *BlendFuncToString(GLint blendFunc);
00903   const char *BlendEquationToString(GLint blendEquation);
00904   const char *LogicOpModeToString();
00905   const char *ListModeToString();
00906   const char *BooleanToString(GLint booleanValue);
00907   const char *ShadeModelToString();
00908   const char *CullFaceModeToString();
00909   const char *FrontFaceToString();
00910   const char *PolygonModeToString(GLint polygonMode);
00911   const char *AlphaTestFuncToString();
00912   const char *DepthFuncToString();
00913   const char *RenderModeToString();
00914   const char *MatrixModeToString();
00915 
00916   const char *ValueToString(GLint value,
00917                             int valueTable[],
00918                             const char *stringTable[],
00919                             int tableSize);
00920 
00921   void PrintMatrix(ostream &os,
00922                    vtkIndent indent,
00923                    GLfloat matrix[16]);
00924 
00925   vtkOpenGLRenderWindow *Context;
00926 };
00927 
00928 
00929 
00930 #endif
00931 // VTK-HeaderTest-Exclude: vtkOpenGLState.h