3042912b08962326651bf28d374a8e9284467108
[occt.git] / src / OpenGl / OpenGl_Workspace.hxx
1 // Created on: 2011-09-20
2 // Created by: Sergey ZERCHANINOV
3 // Copyright (c) 2011-2013 OPEN CASCADE SAS
4 //
5 // This file is part of Open CASCADE Technology software library.
6 //
7 // This library is free software; you can redistribute it and/or modify it under
8 // the terms of the GNU Lesser General Public License version 2.1 as published
9 // by the Free Software Foundation, with special exception defined in the file
10 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
11 // distribution for complete text of the license and disclaimer of any warranty.
12 //
13 // Alternatively, this file may be used under the terms of Open CASCADE
14 // commercial license or contractual agreement.
15
16 #ifndef _OpenGl_Workspace_Header
17 #define _OpenGl_Workspace_Header
18
19 #include <map>
20 #include <set>
21
22 #include <Handle_OpenGl_Workspace.hxx>
23 #include <OpenGl_Window.hxx>
24
25 #include <TColStd_Array2OfReal.hxx>
26 #include <Quantity_Color.hxx>
27 #include <Graphic3d_CView.hxx>
28 #include <Graphic3d_TypeOfComposition.hxx>
29 #include <Graphic3d_TypeOfTexture.hxx>
30 #include <Graphic3d_PtrFrameBuffer.hxx>
31 #include <Graphic3d_BufferType.hxx>
32 #include <Handle_Graphic3d_TextureParams.hxx>
33
34 #include <Aspect_CLayer2d.hxx>
35 #include <Aspect_Handle.hxx>
36 #include <Aspect_PrintAlgo.hxx>
37
38 #include <InterfaceGraphic_Graphic3d.hxx>
39 #include <InterfaceGraphic_Visual3d.hxx>
40
41 #include <NCollection_Sequence.hxx>
42
43 #include <OpenGl_AspectFace.hxx>
44 #include <OpenGl_Display.hxx>
45 #include <OpenGl_FrameBuffer.hxx>
46 #include <OpenGl_Matrix.hxx>
47 #include <OpenGl_NamedStatus.hxx>
48 #include <OpenGl_PrinterContext.hxx>
49 #include <OpenGl_SceneGeometry.hxx>
50 #include <OpenGl_TextParam.hxx>
51 #include <OpenGl_RenderFilter.hxx>
52 #include <OpenGl_Vec.hxx>
53
54 #include <Handle_OpenGl_View.hxx>
55 #include <Handle_OpenGl_Texture.hxx>
56
57 #include <OpenGl_ShaderObject.hxx>
58 #include <OpenGl_ShaderProgram.hxx>
59 #include <OpenGl_TextureBufferArb.hxx>
60
61 class OpenGl_AspectLine;
62 class OpenGl_AspectMarker;
63 class OpenGl_AspectText;
64 class OpenGl_FrameBuffer;
65 class OpenGl_Structure;
66 class OpenGl_Element;
67 class Image_PixMap;
68
69 //! OpenGL material definition
70 struct OpenGl_Material
71 {
72
73   OpenGl_Vec4 Ambient;  //!< ambient reflection coefficient
74   OpenGl_Vec4 Diffuse;  //!< diffuse reflection coefficient
75   OpenGl_Vec4 Specular; //!< glossy  reflection coefficient
76   OpenGl_Vec4 Emission; //!< material emission
77   OpenGl_Vec4 Params;   //!< extra packed parameters
78
79   Standard_ShortReal  Shine()              const { return Params.x(); }
80   Standard_ShortReal& ChangeShine()              { return Params.x(); }
81
82   Standard_ShortReal  Transparency()       const { return Params.y(); }
83   Standard_ShortReal& ChangeTransparency()       { return Params.y(); }
84
85   //! Initialize material
86   void Init (const OPENGL_SURF_PROP& theProps);
87
88   //! Returns packed (serialized) representation of material properties
89   const OpenGl_Vec4* Packed() const { return reinterpret_cast<const OpenGl_Vec4*> (this); }
90   static Standard_Integer NbOfVec4() { return 5; }
91
92 };
93
94 //! Represents window with GL context.
95 //! Provides methods to render primitives and maintain GL state.
96 class OpenGl_Workspace : public OpenGl_Window
97 {
98 public:
99
100   //! Main constructor - prepare GL context for specified window.
101   OpenGl_Workspace (const Handle(OpenGl_Display)& theDisplay,
102                     const CALL_DEF_WINDOW&        theCWindow,
103                     Aspect_RenderingContext       theGContext,
104                     const Handle(OpenGl_Caps)&    theCaps,
105                     const Handle(OpenGl_Context)& theShareCtx);
106
107   //! Destructor
108   virtual ~OpenGl_Workspace();
109
110   void SetActiveView (const Handle(OpenGl_View)& theView) { myView = theView; }
111   const Handle(OpenGl_View)& ActiveView () const { return myView; }
112
113   //! Redraw the window.
114   void Redraw (const Graphic3d_CView& theCView,
115                const Aspect_CLayer2d& theCUnderLayer,
116                const Aspect_CLayer2d& theCOverLayer);
117
118   Standard_Boolean SetImmediateModeDrawToFront (const Standard_Boolean theDrawToFrontBuffer);
119   void RedrawImmediate (const Graphic3d_CView& theCView,
120                         const Aspect_CLayer2d& theCUnderLayer,
121                         const Aspect_CLayer2d& theCOverLayer,
122                         const Standard_Boolean theToForce = Standard_False);
123
124   void Invalidate (const Graphic3d_CView& /*theCView*/)
125   {
126     myBackBufferRestored = Standard_False;
127   }
128
129   //! Special method to perform printing.
130   //! System-specific and currently only Win platform implemented.
131   Standard_Boolean Print (const Handle(OpenGl_PrinterContext)& thePrintContext,
132                           const Graphic3d_CView& theCView,
133                           const Aspect_CLayer2d& theCUnderLayer,
134                           const Aspect_CLayer2d& theCOverLayer,
135                           const Aspect_Handle    theHPrintDC,
136                           const Standard_Boolean theToShowBackground,
137                           const Standard_CString theFileName,
138                           const Aspect_PrintAlgo thePrintAlgorithm,
139                           const Standard_Real    theScaleFactor);
140
141   const Handle(OpenGl_PrinterContext)& PrinterContext() const
142   {
143     return myPrintContext;
144   }
145
146   void DisplayCallback (const Graphic3d_CView& theCView, int theReason);
147
148   Graphic3d_PtrFrameBuffer FBOCreate (const Standard_Integer theWidth, const Standard_Integer theHeight);
149   void FBORelease (Graphic3d_PtrFrameBuffer theFBOPtr);
150   Standard_Boolean BufferDump (OpenGl_FrameBuffer*         theFBOPtr,
151                                Image_PixMap&               theImage,
152                                const Graphic3d_BufferType& theBufferType);
153
154   void UseTransparency (const Standard_Boolean theFlag);
155   Standard_Boolean& UseZBuffer()   { return myUseZBuffer; }
156   Standard_Boolean& UseDepthTest() { return myUseDepthTest; }
157   Standard_Boolean& UseGLLight()   { return myUseGLLight; }
158
159   //// RELATED TO STATUS ////
160
161   Standard_Integer   NamedStatus;
162
163   const TEL_COLOUR* HighlightColor;
164
165   const OpenGl_Matrix* SetViewMatrix (const OpenGl_Matrix* );
166   const OpenGl_Matrix* SetStructureMatrix (const OpenGl_Matrix*, bool aRevert = false);
167
168   //! Updates current model-view matrix
169   //! replacing it with StructureMatrixT*ViewMatrix from the workspace.
170   const void UpdateModelViewMatrix();
171
172   const OpenGl_AspectLine*   SetAspectLine   (const OpenGl_AspectLine*   theAspect);
173   const OpenGl_AspectFace*   SetAspectFace   (const OpenGl_AspectFace*   theAspect);
174   const OpenGl_AspectMarker* SetAspectMarker (const OpenGl_AspectMarker* theAspect);
175   const OpenGl_AspectText*   SetAspectText   (const OpenGl_AspectText*   theAspect);
176
177   void SetTextParam (const OpenGl_TextParam* theParam) { TextParam_set = theParam; }
178
179   //// THESE METHODS ARE EXPORTED AS THEY PROVIDE STATE INFO TO USERDRAW
180   Standard_EXPORT const OpenGl_AspectLine*   AspectLine   (const Standard_Boolean theWithApply);
181   Standard_EXPORT const OpenGl_AspectFace*   AspectFace   (const Standard_Boolean theWithApply);
182   Standard_EXPORT const OpenGl_AspectMarker* AspectMarker (const Standard_Boolean theWithApply);
183   Standard_EXPORT const OpenGl_AspectText*   AspectText   (const Standard_Boolean theWithApply);
184   inline const OpenGl_TextParam* AspectTextParams() const
185   {
186     return TextParam_applied;
187   }
188
189   //! Clear the applied aspect state.
190   void ResetAppliedAspect();
191
192   Standard_EXPORT Handle(OpenGl_Texture) DisableTexture();
193   Standard_EXPORT Handle(OpenGl_Texture) EnableTexture (const Handle(OpenGl_Texture)&          theTexture,
194                                                         const Handle(Graphic3d_TextureParams)& theParams = NULL);
195
196   //! Set filter for restricting rendering of particular elements.
197   //! Filter can be applied for rendering passes used by recursive
198   //! rendering algorithms for rendering elements of groups.
199   //! @param theFilter [in] the filter instance.
200   inline void SetRenderFilter (const Handle(OpenGl_RenderFilter)& theFilter)
201   {
202     myRenderFilter = theFilter;
203   }
204
205   //! Get rendering filter.
206   //! @return filter instance.
207   inline const Handle(OpenGl_RenderFilter)& GetRenderFilter() const
208   {
209     return myRenderFilter;
210   }
211
212   //! @return applied view matrix.
213   inline const OpenGl_Matrix* ViewMatrix() const { return ViewMatrix_applied; }
214
215   //! @return applied model structure matrix.
216   inline const OpenGl_Matrix* ModelMatrix() const { return StructureMatrix_applied; }
217
218 protected:
219
220   //! Copy content of Back buffer to the Front buffer
221   void copyBackToFront();
222
223   virtual Standard_Boolean Activate();
224
225   void redraw1 (const Graphic3d_CView& theCView,
226                 const Aspect_CLayer2d& theCUnderLayer,
227                 const Aspect_CLayer2d& theCOverLayer,
228                 const int              theToSwap);
229
230   void updateMaterial (const int theFlag);
231
232   void setTextureParams (Handle(OpenGl_Texture)&                theTexture,
233                          const Handle(Graphic3d_TextureParams)& theParams);
234
235 protected:
236
237   //! Result of OpenGL shaders initialization.
238   enum RaytraceInitStatus
239   {
240     OpenGl_RT_NONE,
241     OpenGl_RT_INIT,
242     OpenGl_RT_FAIL
243   };
244
245   //! Describes update mode (state).
246   enum GeomUpdateMode
247   {
248     OpenGl_GUM_CHECK,   //!< check if geometry update is necessary
249     OpenGl_GUM_PREPARE, //!< collect unchanged objects
250     OpenGl_GUM_UPDATE   //!< update raytracing data, rebuild changed objects
251   };
252
253   //! Defines frequently used shader variables.
254   enum ShaderVariableIndex
255   {
256     OpenGl_RT_aPosition,
257
258     OpenGl_RT_uOriginLT,
259     OpenGl_RT_uOriginLB,
260     OpenGl_RT_uOriginRT,
261     OpenGl_RT_uOriginRB,
262
263     OpenGl_RT_uDirectLT,
264     OpenGl_RT_uDirectLB,
265     OpenGl_RT_uDirectRT,
266     OpenGl_RT_uDirectRB,
267     
268     OpenGl_RT_uSceneRad,
269     OpenGl_RT_uSceneEps,
270
271     OpenGl_RT_uLightAmbnt,
272     OpenGl_RT_uLightCount,
273
274     OpenGl_RT_uShadEnabled,
275     OpenGl_RT_uReflEnabled,
276     
277     OpenGl_RT_uInputTexture,
278
279     OpenGl_RT_uOffsetX,
280     OpenGl_RT_uOffsetY,
281     OpenGl_RT_uSamples,
282
283     OpenGl_RT_uEnvironmentEnable,
284
285     OpenGl_RT_NbVariables // special field
286   };
287
288   //! Defines texture samplers.
289   enum ShaderSamplerNames
290   {
291     OpenGl_RT_SceneNodeInfoTexture = 0,
292     OpenGl_RT_SceneMinPointTexture = 1,
293     OpenGl_RT_SceneMaxPointTexture = 2,
294
295     OpenGl_RT_ObjectNodeInfoTexture = 3,
296     OpenGl_RT_ObjectMinPointTexture = 4,
297     OpenGl_RT_ObjectMaxPointTexture = 5,
298
299     OpenGl_RT_GeometryVertexTexture = 6,
300     OpenGl_RT_GeometryNormalTexture = 7,
301     OpenGl_RT_GeometryTriangTexture = 8,
302
303     OpenGl_RT_EnvironmentMapTexture = 9,
304
305     OpenGl_RT_RaytraceMaterialTexture = 10,
306     OpenGl_RT_RaytraceLightSrcTexture = 11,
307
308     OpenGl_RT_FSAAInputTexture = 12,
309
310     OpenGl_RT_SceneTransformTexture = 13
311   };
312
313   //! Tool class for management of shader sources.
314   class ShaderSource
315   {
316   public:
317
318     //! Creates new uninitialized shader source.
319     ShaderSource()
320     {
321       //
322     }
323
324     //! Creates new shader source from specified file.
325     ShaderSource (const TCollection_AsciiString& theFileName)
326     {
327       Load (&theFileName, 1);
328     }
329
330   public:
331
332     //! Returns prefix to insert before the source.
333     const TCollection_AsciiString& Prefix() const
334     {
335       return myPrefix;
336     }
337
338     //! Sets prefix to insert before the source.
339     void SetPrefix (const TCollection_AsciiString& thePrefix)
340     {
341       myPrefix = thePrefix;
342     }
343
344     //! Returns shader source combined with prefix.
345     TCollection_AsciiString Source() const;
346
347     //! Loads shader source from specified files.
348     void Load (const TCollection_AsciiString* theFileNames, const Standard_Integer theCount);
349
350   private:
351
352     TCollection_AsciiString mySource; //!< Source string of the shader object
353     TCollection_AsciiString myPrefix; //!< Prefix to insert before the source
354
355   };
356
357   //! Default size of traversal stack.
358   static const Standard_Integer THE_DEFAULT_STACK_SIZE = 24;
359
360 protected: //! @name methods related to ray-tracing
361
362   //! Updates 3D scene geometry for ray-tracing.
363   Standard_Boolean UpdateRaytraceGeometry (GeomUpdateMode theMode);
364
365   //! Checks to see if the structure is modified.
366   Standard_Boolean CheckRaytraceStructure (const OpenGl_Structure* theStructure);
367
368   //! Updates 3D scene light sources for ray-tracing.
369   Standard_Boolean UpdateRaytraceLightSources (const GLdouble theInvModelView[16]);
370
371   //! Updates environment map for ray-tracing.
372   Standard_Boolean UpdateRaytraceEnvironmentMap();
373
374   //! Adds OpenGL structure to ray-traced scene geometry.
375   Standard_Boolean AddRaytraceStructure (const OpenGl_Structure* theStructure,
376     const Standard_ShortReal* theTransform, std::set<const OpenGl_Structure*>& theElements);
377
378   //! Adds OpenGL primitive array to ray-traced scene geometry.
379   OpenGl_TriangleSet* AddRaytracePrimitiveArray (
380     const OpenGl_PrimitiveArray* theArray, int theMatID, const Standard_ShortReal* theTrans);
381
382   //! Adds vertex indices from OpenGL primitive array to ray-traced scene geometry.
383   Standard_Boolean AddRaytraceVertexIndices (OpenGl_TriangleSet* theSet,
384     const CALL_DEF_PARRAY* theArray, Standard_Integer theOffset, Standard_Integer theCount, Standard_Integer theMatID);
385
386   //! Adds OpenGL triangle array to ray-traced scene geometry.
387   Standard_Boolean AddRaytraceTriangleArray (OpenGl_TriangleSet* theSet,
388     const CALL_DEF_PARRAY* theArray, Standard_Integer theOffset, Standard_Integer theCount, Standard_Integer theMatID);
389
390   //! Adds OpenGL triangle fan array to ray-traced scene geometry.
391   Standard_Boolean AddRaytraceTriangleFanArray (OpenGl_TriangleSet* theSet,
392     const CALL_DEF_PARRAY* theArray, Standard_Integer theOffset, Standard_Integer theCount, Standard_Integer theMatID);
393
394   //! Adds OpenGL triangle strip array to ray-traced scene geometry.
395   Standard_Boolean AddRaytraceTriangleStripArray (OpenGl_TriangleSet* theSet,
396     const CALL_DEF_PARRAY* theArray, Standard_Integer theOffset, Standard_Integer theCount, Standard_Integer theMatID);
397
398   //! Adds OpenGL quadrangle array to ray-traced scene geometry.
399   Standard_Boolean AddRaytraceQuadrangleArray (OpenGl_TriangleSet* theSet,
400     const CALL_DEF_PARRAY* theArray, Standard_Integer theOffset, Standard_Integer theCount, Standard_Integer theMatID);
401
402   //! Adds OpenGL quadrangle strip array to ray-traced scene geometry.
403   Standard_Boolean AddRaytraceQuadrangleStripArray (OpenGl_TriangleSet* theSet,
404     const CALL_DEF_PARRAY* theArray, Standard_Integer theOffset, Standard_Integer theCount, Standard_Integer theMatID);
405
406   //! Adds OpenGL polygon array to ray-traced scene geometry.
407   Standard_Boolean AddRaytracePolygonArray (OpenGl_TriangleSet* theSet,
408     const CALL_DEF_PARRAY* theArray, Standard_Integer theOffset, Standard_Integer theCount, Standard_Integer theMatID);
409
410   //! Loads and compiles shader object from specified source.
411   Handle(OpenGl_ShaderObject) LoadShader (const ShaderSource& theSource, GLenum theType);
412
413   //! Performs safe exit when shaders initialization fails.
414   Standard_Boolean SafeFailBack (const TCollection_ExtendedString& theMessage);
415
416   //! Initializes OpenGL/GLSL shader programs.
417   Standard_Boolean InitRaytraceResources();
418
419   //! Releases OpenGL/GLSL shader programs.
420   void ReleaseRaytraceResources();
421
422   //! Uploads ray-trace data to the GPU.
423   Standard_Boolean UploadRaytraceData();
424
425   //! Resizes OpenGL frame buffers.
426   Standard_Boolean ResizeRaytraceBuffers (const Standard_Integer theSizeX,
427                                           const Standard_Integer theSizeY);
428
429   //! Generates viewing rays for corners of screen quad.
430   void UpdateCamera (const NCollection_Mat4<GLdouble>& theOrientation,
431                      const NCollection_Mat4<GLdouble>& theViewMapping,
432                      OpenGl_Vec3                       theOrigins[4],
433                      OpenGl_Vec3                       theDirects[4]);
434
435   //! Runs ray-tracing shader programs.
436   Standard_Boolean RunRaytraceShaders (const Graphic3d_CView& theCView,
437                                        const Standard_Integer theSizeX,
438                                        const Standard_Integer theSizeY,
439                                        const OpenGl_Vec3      theOrigins[4],
440                                        const OpenGl_Vec3      theDirects[4],
441                                        OpenGl_FrameBuffer*    theFrameBuffer);
442
443   //! Redraws the window using OpenGL/GLSL ray-tracing.
444   Standard_Boolean Raytrace (const Graphic3d_CView& theCView,
445                              const Standard_Integer theSizeX,
446                              const Standard_Integer theSizeY,
447                              const Standard_Boolean theToSwap,
448                              OpenGl_FrameBuffer*    theFrameBuffer);
449
450 protected: //! @name fields related to ray-tracing
451
452   //! Result of shaders initialization.
453   RaytraceInitStatus myComputeInitStatus;
454
455   //! Is geometry data valid?
456   Standard_Boolean myIsRaytraceDataValid;
457
458   //! 3D scene geometry data for ray-tracing.
459   OpenGl_RaytraceGeometry myRaytraceGeometry;
460
461   //! Radius of bounding sphere of the scene.
462   Standard_ShortReal myRaytraceSceneRadius;
463   //! Scene epsilon to prevent self-intersections.
464   Standard_ShortReal myRaytraceSceneEpsilon;
465
466   //! Actual size of traversal stack in shader program.
467   Standard_Integer myTraversalStackSize;
468
469   //! OpenGL/GLSL source of ray-tracing fragment shader.
470   ShaderSource myRaytraceShaderSource;
471   //! OpenGL/GLSL source of adaptive-AA fragment shader.
472   ShaderSource myPostFSAAShaderSource;
473
474   //! OpenGL/GLSL ray-tracing fragment shader.
475   Handle(OpenGl_ShaderObject) myRaytraceShader;
476   //! OpenGL/GLSL adaptive-AA fragment shader.
477   Handle(OpenGl_ShaderObject) myPostFSAAShader;
478
479   //! OpenGL/GLSL ray-tracing shader program.
480   Handle(OpenGl_ShaderProgram) myRaytraceProgram;
481   //! OpenGL/GLSL adaptive-AA shader program.
482   Handle(OpenGl_ShaderProgram) myPostFSAAProgram;
483
484   //! Texture buffer of data records of high-level BVH nodes.
485   Handle(OpenGl_TextureBufferArb) mySceneNodeInfoTexture;
486   //! Texture buffer of minimum points of high-level BVH nodes.
487   Handle(OpenGl_TextureBufferArb) mySceneMinPointTexture;
488   //! Texture buffer of maximum points of high-level BVH nodes.
489   Handle(OpenGl_TextureBufferArb) mySceneMaxPointTexture;
490   //! Texture buffer of transformations of high-level BVH nodes.
491   Handle(OpenGl_TextureBufferArb) mySceneTransformTexture;
492
493   //! Texture buffer of data records of bottom-level BVH nodes.
494   Handle(OpenGl_TextureBufferArb) myObjectNodeInfoTexture;
495   //! Texture buffer of minimum points of bottom-level BVH nodes.
496   Handle(OpenGl_TextureBufferArb) myObjectMinPointTexture;
497   //! Texture buffer of maximum points of bottom-level BVH nodes.
498   Handle(OpenGl_TextureBufferArb) myObjectMaxPointTexture;
499
500   //! Texture buffer of vertex coords.
501   Handle(OpenGl_TextureBufferArb) myGeometryVertexTexture;
502   //! Texture buffer of vertex normals.
503   Handle(OpenGl_TextureBufferArb) myGeometryNormalTexture;
504   //! Texture buffer of triangle indices.
505   Handle(OpenGl_TextureBufferArb) myGeometryTriangTexture;
506   
507   //! Texture buffer of material properties.
508   Handle(OpenGl_TextureBufferArb) myRaytraceMaterialTexture;
509   //! Texture buffer of light source properties.
510   Handle(OpenGl_TextureBufferArb) myRaytraceLightSrcTexture;
511
512   //! Vertex buffer (VBO) for drawing dummy quad.
513   OpenGl_VertexBuffer myRaytraceScreenQuad;
514
515   //! Framebuffer (FBO) to perform adaptive FSAA.
516   Handle(OpenGl_FrameBuffer) myRaytraceFBO1;
517   //! Framebuffer (FBO) to perform adaptive FSAA.
518   Handle(OpenGl_FrameBuffer) myRaytraceFBO2;
519
520   //! State of OpenGL view.
521   Standard_Size myViewModificationStatus;
522   //! State of OpenGL layer list.
523   Standard_Size myLayersModificationStatus;
524
525   //! State of OpenGL structures reflected to ray-tracing.
526   std::map<const OpenGl_Structure*, Standard_Size> myStructureStates;
527
528   //! PrimitiveArray to TriangleSet map for scene partial update.
529   std::map<const OpenGl_PrimitiveArray*, OpenGl_TriangleSet*> myArrayToTrianglesMap;
530
531   //! Cached locations of frequently used uniform variables.
532   Standard_Integer myUniformLocations[2][OpenGl_RT_NbVariables];
533
534 protected: //! @name protected fields
535
536   Handle(OpenGl_PrinterContext) myPrintContext;
537   Handle(OpenGl_View)    myView;            // WSViews - now just one view is supported
538   Standard_Boolean       myTransientDrawToFront; //!< optimization flag for immediate mode (to render directly to the front buffer)
539   Standard_Boolean       myBackBufferRestored;
540   Standard_Boolean       myIsImmediateDrawn;     //!< flag indicates that immediate mode buffer contains some data
541   Standard_Boolean       myUseTransparency;
542   Standard_Boolean       myUseZBuffer;
543   Standard_Boolean       myUseDepthTest;
544   Standard_Boolean       myUseGLLight;
545
546 protected: //! @name fields related to status
547
548   Handle(OpenGl_RenderFilter) myRenderFilter;
549   Handle(OpenGl_Texture) myTextureBound;    //!< currently bound texture (managed by OpenGl_AspectFace and OpenGl_View environment texture)
550   const OpenGl_AspectLine *AspectLine_set, *AspectLine_applied;
551   const OpenGl_AspectFace *AspectFace_set, *AspectFace_applied;
552   const OpenGl_AspectMarker *AspectMarker_set, *AspectMarker_applied;
553   const OpenGl_AspectText *AspectText_set, *AspectText_applied;
554
555   const OpenGl_TextParam *TextParam_set, *TextParam_applied;
556
557   const OpenGl_Matrix* ViewMatrix_applied;
558   const OpenGl_Matrix* StructureMatrix_applied;
559
560   OpenGl_Material myMatFront;    //!< current front material state (cached to reduce GL context updates)
561   OpenGl_Material myMatBack;     //!< current back  material state
562   OpenGl_Material myMatTmp;      //!< temporary variable
563   TelCullMode     myCullingMode; //!< back face culling mode, applied from face aspect
564
565   //! Model matrix with applied structure transformations
566   OpenGl_Matrix myModelViewMatrix;
567
568   const TEL_POFFSET_PARAM* PolygonOffset_applied;
569
570   OpenGl_AspectFace myAspectFaceHl; // Hiddenline aspect
571
572 public: //! @name type definition
573
574   DEFINE_STANDARD_RTTI(OpenGl_Workspace)
575   DEFINE_STANDARD_ALLOC
576
577 };
578
579 #endif // _OpenGl_Workspace_Header