0024797: TKOpenGl, OpenGl_PointSprite - the assert is absent during incorrect object...
[occt.git] / src / OpenGl / OpenGl_Workspace.hxx
CommitLineData
b311480e 1// Created on: 2011-09-20
2// Created by: Sergey ZERCHANINOV
1981cb22 3// Copyright (c) 2011-2013 OPEN CASCADE SAS
b311480e 4//
973c2be1 5// This file is part of Open CASCADE Technology software library.
b311480e 6//
d5f74e42 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
973c2be1 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.
b311480e 12//
973c2be1 13// Alternatively, this file may be used under the terms of Open CASCADE
14// commercial license or contractual agreement.
b311480e 15
2166f0fa
SK
16#ifndef _OpenGl_Workspace_Header
17#define _OpenGl_Workspace_Header
18
fc73a202 19#include <map>
20#include <set>
e276548b 21
2166f0fa
SK
22#include <Handle_OpenGl_Workspace.hxx>
23#include <OpenGl_Window.hxx>
24
25#include <TColStd_Array2OfReal.hxx>
26#include <Quantity_Color.hxx>
bf75be98 27#include <Graphic3d_CView.hxx>
2166f0fa 28#include <Graphic3d_TypeOfComposition.hxx>
bf75be98 29#include <Graphic3d_TypeOfTexture.hxx>
30#include <Graphic3d_PtrFrameBuffer.hxx>
31#include <Graphic3d_BufferType.hxx>
32#include <Handle_Graphic3d_TextureParams.hxx>
2166f0fa 33
2166f0fa
SK
34#include <Aspect_CLayer2d.hxx>
35#include <Aspect_Handle.hxx>
36#include <Aspect_PrintAlgo.hxx>
2166f0fa
SK
37
38#include <InterfaceGraphic_Graphic3d.hxx>
39#include <InterfaceGraphic_Visual3d.hxx>
40
1981cb22 41#include <NCollection_Sequence.hxx>
42
bf75be98 43#include <OpenGl_AspectFace.hxx>
2166f0fa 44#include <OpenGl_Display.hxx>
fc73a202 45#include <OpenGl_FrameBuffer.hxx>
2166f0fa
SK
46#include <OpenGl_Matrix.hxx>
47#include <OpenGl_NamedStatus.hxx>
a174a3c5 48#include <OpenGl_PrinterContext.hxx>
fc73a202 49#include <OpenGl_SceneGeometry.hxx>
2166f0fa 50#include <OpenGl_TextParam.hxx>
4269bd1b 51#include <OpenGl_RenderFilter.hxx>
0adbd30f 52#include <OpenGl_Vec.hxx>
2166f0fa
SK
53
54#include <Handle_OpenGl_View.hxx>
bf75be98 55#include <Handle_OpenGl_Texture.hxx>
2166f0fa 56
fc73a202 57#include <OpenGl_ShaderObject.hxx>
58#include <OpenGl_ShaderProgram.hxx>
59#include <OpenGl_TextureBufferArb.hxx>
60
2166f0fa 61class OpenGl_AspectLine;
2166f0fa
SK
62class OpenGl_AspectMarker;
63class OpenGl_AspectText;
64class OpenGl_FrameBuffer;
65class OpenGl_Structure;
4269bd1b 66class OpenGl_Element;
692613e5 67class Image_PixMap;
2166f0fa 68
0adbd30f 69//! OpenGL material definition
70struct 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
e276548b 94//! Represents window with GL context.
95//! Provides methods to render primitives and maintain GL state.
2166f0fa
SK
96class OpenGl_Workspace : public OpenGl_Window
97{
98public:
99
100 //! Main constructor - prepare GL context for specified window.
101 OpenGl_Workspace (const Handle(OpenGl_Display)& theDisplay,
102 const CALL_DEF_WINDOW& theCWindow,
5e27df78 103 Aspect_RenderingContext theGContext,
58655684 104 const Handle(OpenGl_Caps)& theCaps,
5e27df78 105 const Handle(OpenGl_Context)& theShareCtx);
2166f0fa
SK
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
679ecdee 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*/)
2166f0fa 125 {
679ecdee 126 myBackBufferRestored = Standard_False;
2166f0fa
SK
127 }
128
129 //! Special method to perform printing.
130 //! System-specific and currently only Win platform implemented.
a174a3c5 131 Standard_Boolean Print (const Handle(OpenGl_PrinterContext)& thePrintContext,
132 const Graphic3d_CView& theCView,
bf75be98 133 const Aspect_CLayer2d& theCUnderLayer,
2166f0fa
SK
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
a174a3c5 141 const Handle(OpenGl_PrinterContext)& PrinterContext() const
142 {
143 return myPrintContext;
144 }
145
2166f0fa
SK
146 void DisplayCallback (const Graphic3d_CView& theCView, int theReason);
147
2166f0fa
SK
148 Graphic3d_PtrFrameBuffer FBOCreate (const Standard_Integer theWidth, const Standard_Integer theHeight);
149 void FBORelease (Graphic3d_PtrFrameBuffer theFBOPtr);
692613e5 150 Standard_Boolean BufferDump (OpenGl_FrameBuffer* theFBOPtr,
151 Image_PixMap& theImage,
152 const Graphic3d_BufferType& theBufferType);
2166f0fa 153
2166f0fa
SK
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
2166f0fa
SK
163 const TEL_COLOUR* HighlightColor;
164
165 const OpenGl_Matrix* SetViewMatrix (const OpenGl_Matrix* );
30f0ad28 166 const OpenGl_Matrix* SetStructureMatrix (const OpenGl_Matrix*, bool aRevert = false);
2166f0fa 167
0f8c0fb8 168 //! Updates current model-view matrix
169 //! replacing it with StructureMatrixT*ViewMatrix from the workspace.
170 const void UpdateModelViewMatrix();
171
2166f0fa
SK
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
3946774d 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);
a174a3c5 184 inline const OpenGl_TextParam* AspectTextParams() const
185 {
186 return TextParam_applied;
187 }
2166f0fa 188
34a44cbd 189 //! Clear the applied aspect state.
190 void ResetAppliedAspect();
191
bf75be98 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
4269bd1b 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 {
5322131b 202 myRenderFilter = theFilter;
4269bd1b 203 }
204
205 //! Get rendering filter.
206 //! @return filter instance.
5322131b 207 inline const Handle(OpenGl_RenderFilter)& GetRenderFilter() const
208 {
209 return myRenderFilter;
4269bd1b 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
2166f0fa
SK
218protected:
219
679ecdee 220 //! Copy content of Back buffer to the Front buffer
221 void copyBackToFront();
2166f0fa
SK
222
223 virtual Standard_Boolean Activate();
224
679ecdee 225 void redraw1 (const Graphic3d_CView& theCView,
bf75be98 226 const Aspect_CLayer2d& theCUnderLayer,
2166f0fa 227 const Aspect_CLayer2d& theCOverLayer,
679ecdee 228 const int theToSwap);
2166f0fa 229
0adbd30f 230 void updateMaterial (const int theFlag);
2166f0fa 231
bf75be98 232 void setTextureParams (Handle(OpenGl_Texture)& theTexture,
233 const Handle(Graphic3d_TextureParams)& theParams);
2166f0fa 234
fc73a202 235protected:
e276548b 236
fc73a202 237 //! Result of OpenGL shaders initialization.
238 enum RaytraceInitStatus
239 {
240 OpenGl_RT_NONE,
241 OpenGl_RT_INIT,
242 OpenGl_RT_FAIL
243 };
e276548b 244
fc73a202 245 //! Defines frequently used shader variables.
246 enum ShaderVariableIndex
247 {
248 OpenGl_RT_aPosition,
249
250 OpenGl_RT_uOriginLT,
251 OpenGl_RT_uOriginLB,
252 OpenGl_RT_uOriginRT,
253 OpenGl_RT_uOriginRB,
254
255 OpenGl_RT_uDirectLT,
256 OpenGl_RT_uDirectLB,
257 OpenGl_RT_uDirectRT,
258 OpenGl_RT_uDirectRB,
259
260 OpenGl_RT_uSceneRad,
261 OpenGl_RT_uSceneEps,
262
263 OpenGl_RT_uLightAmbnt,
264 OpenGl_RT_uLightCount,
265
266 OpenGl_RT_uShadEnabled,
267 OpenGl_RT_uReflEnabled,
268
269 OpenGl_RT_uInputTexture,
270
271 OpenGl_RT_uOffsetX,
272 OpenGl_RT_uOffsetY,
273 OpenGl_RT_uSamples,
274
275 OpenGl_RT_NbVariables // special field
276 };
e276548b 277
fc73a202 278 //! Defines texture samplers.
279 enum ShaderSamplerNames
280 {
281 OpenGl_RT_SceneNodeInfoTexture = 0,
282 OpenGl_RT_SceneMinPointTexture = 1,
283 OpenGl_RT_SceneMaxPointTexture = 2,
284
285 OpenGl_RT_ObjectNodeInfoTexture = 3,
286 OpenGl_RT_ObjectMinPointTexture = 4,
287 OpenGl_RT_ObjectMaxPointTexture = 5,
288
289 OpenGl_RT_GeometryVertexTexture = 6,
290 OpenGl_RT_GeometryNormalTexture = 7,
291 OpenGl_RT_GeometryTriangTexture = 8,
e276548b 292
fc73a202 293 OpenGl_RT_EnvironmentMapTexture = 9,
294
295 OpenGl_RT_RaytraceMaterialTexture = 10,
296 OpenGl_RT_RaytraceLightSrcTexture = 11,
297
298 OpenGl_RT_FSAAInputTexture = 12
299 };
300
301 //! Tool class for management of shader sources.
302 class ShaderSource
e276548b 303 {
fc73a202 304 public:
305
306 //! Creates new uninitialized shader source.
307 ShaderSource()
308 {
309 //
310 }
311
312 //! Creates new shader source from specified file.
313 ShaderSource (const TCollection_AsciiString& theFileName)
314 {
315 Load (&theFileName, 1);
316 }
317
318 public:
319
320 //! Returns prefix to insert before the source.
321 const TCollection_AsciiString& Prefix() const
322 {
323 return myPrefix;
324 }
325
326 //! Sets prefix to insert before the source.
327 void SetPrefix (const TCollection_AsciiString& thePrefix)
328 {
329 myPrefix = thePrefix;
330 }
331
332 //! Returns shader source combined with prefix.
333 TCollection_AsciiString Source() const;
334
335 //! Loads shader source from specified files.
336 void Load (const TCollection_AsciiString* theFileNames, const Standard_Integer theCount);
337
338 private:
339
340 TCollection_AsciiString mySource; //!< Source string of the shader object
341 TCollection_AsciiString myPrefix; //!< Prefix to insert before the source
342
e276548b 343 };
344
fc73a202 345 //! Default size of traversal stack.
346 static const Standard_Integer THE_DEFAULT_STACK_SIZE = 24;
347
e276548b 348protected: //! @name methods related to ray-tracing
349
350 //! Updates 3D scene geometry for ray-tracing.
351 Standard_Boolean UpdateRaytraceGeometry (Standard_Boolean theCheck);
352
353 //! Checks to see if the structure is modified.
354 Standard_Boolean CheckRaytraceStructure (const OpenGl_Structure* theStructure);
355
356 //! Updates 3D scene light sources for ray-tracing.
357 Standard_Boolean UpdateRaytraceLightSources (const GLdouble theInvModelView[16]);
358
359 //! Updates environment map for ray-tracing.
360 Standard_Boolean UpdateRaytraceEnvironmentMap();
5322131b 361
e276548b 362 //! Adds OpenGL structure to ray-traced scene geometry.
265d4508 363 Standard_Boolean AddRaytraceStructure (const OpenGl_Structure* theStructure,
364 const Standard_ShortReal* theTransform, std::set<const OpenGl_Structure*>& theElements);
e276548b 365
366 //! Adds OpenGL primitive array to ray-traced scene geometry.
265d4508 367 OpenGl_TriangleSet* AddRaytracePrimitiveArray (
368 const CALL_DEF_PARRAY* theArray, int theMatID, const Standard_ShortReal* theTrans);
e276548b 369
370 //! Adds vertex indices from OpenGL primitive array to ray-traced scene geometry.
265d4508 371 Standard_Boolean AddRaytraceVertexIndices (OpenGl_TriangleSet* theSet,
372 const CALL_DEF_PARRAY* theArray, Standard_Integer theOffset, Standard_Integer theCount, Standard_Integer theMatID);
e276548b 373
374 //! Adds OpenGL triangle array to ray-traced scene geometry.
265d4508 375 Standard_Boolean AddRaytraceTriangleArray (OpenGl_TriangleSet* theSet,
376 const CALL_DEF_PARRAY* theArray, Standard_Integer theOffset, Standard_Integer theCount, Standard_Integer theMatID);
e276548b 377
378 //! Adds OpenGL triangle fan array to ray-traced scene geometry.
265d4508 379 Standard_Boolean AddRaytraceTriangleFanArray (OpenGl_TriangleSet* theSet,
380 const CALL_DEF_PARRAY* theArray, Standard_Integer theOffset, Standard_Integer theCount, Standard_Integer theMatID);
e276548b 381
265d4508 382 //! Adds OpenGL triangle strip array to ray-traced scene geometry.
383 Standard_Boolean AddRaytraceTriangleStripArray (OpenGl_TriangleSet* theSet,
384 const CALL_DEF_PARRAY* theArray, Standard_Integer theOffset, Standard_Integer theCount, Standard_Integer theMatID);
e276548b 385
386 //! Adds OpenGL quadrangle array to ray-traced scene geometry.
265d4508 387 Standard_Boolean AddRaytraceQuadrangleArray (OpenGl_TriangleSet* theSet,
388 const CALL_DEF_PARRAY* theArray, Standard_Integer theOffset, Standard_Integer theCount, Standard_Integer theMatID);
e276548b 389
390 //! Adds OpenGL quadrangle strip array to ray-traced scene geometry.
265d4508 391 Standard_Boolean AddRaytraceQuadrangleStripArray (OpenGl_TriangleSet* theSet,
392 const CALL_DEF_PARRAY* theArray, Standard_Integer theOffset, Standard_Integer theCount, Standard_Integer theMatID);
e276548b 393
394 //! Adds OpenGL polygon array to ray-traced scene geometry.
265d4508 395 Standard_Boolean AddRaytracePolygonArray (OpenGl_TriangleSet* theSet,
396 const CALL_DEF_PARRAY* theArray, Standard_Integer theOffset, Standard_Integer theCount, Standard_Integer theMatID);
e276548b 397
fc73a202 398 //! Loads and compiles shader object from specified source.
399 Handle(OpenGl_ShaderObject) LoadShader (const ShaderSource& theSource, GLenum theType);
400
401 //! Performs safe exit when shaders initialization fails.
402 Standard_Boolean SafeFailBack (const TCollection_ExtendedString& theMessage);
403
404 //! Initializes OpenGL/GLSL shader programs.
405 Standard_Boolean InitRaytraceResources();
5322131b 406
fc73a202 407 //! Releases OpenGL/GLSL shader programs.
408 void ReleaseRaytraceResources();
e276548b 409
fc73a202 410 //! Uploads ray-trace data to the GPU.
411 Standard_Boolean UploadRaytraceData();
e276548b 412
fc73a202 413 //! Resizes OpenGL frame buffers.
414 Standard_Boolean ResizeRaytraceBuffers (const Standard_Integer theSizeX,
415 const Standard_Integer theSizeY);
e276548b 416
fc73a202 417 //! Generates viewing rays for corners of screen quad.
418 void UpdateCamera (const NCollection_Mat4<GLdouble>& theOrientation,
419 const NCollection_Mat4<GLdouble>& theViewMapping,
420 OpenGl_Vec3 theOrigins[4],
421 OpenGl_Vec3 theDirects[4]);
e276548b 422
fc73a202 423 //! Runs ray-tracing shader programs.
424 Standard_Boolean RunRaytraceShaders (const Graphic3d_CView& theCView,
425 const Standard_Integer theSizeX,
426 const Standard_Integer theSizeY,
427 const OpenGl_Vec3 theOrigins[4],
428 const OpenGl_Vec3 theDirects[4],
429 OpenGl_FrameBuffer* theFrameBuffer);
265d4508 430
fc73a202 431 //! Redraws the window using OpenGL/GLSL ray-tracing.
e276548b 432 Standard_Boolean Raytrace (const Graphic3d_CView& theCView,
fc73a202 433 const Standard_Integer theSizeX,
434 const Standard_Integer theSizeY,
435 const Standard_Boolean theToSwap,
436 OpenGl_FrameBuffer* theFrameBuffer);
e276548b 437
438protected: //! @name fields related to ray-tracing
439
fc73a202 440 //! Result of shaders initialization.
441 RaytraceInitStatus myComputeInitStatus;
e276548b 442
443 //! Is geometry data valid?
444 Standard_Boolean myIsRaytraceDataValid;
5322131b 445
e276548b 446 //! 3D scene geometry data for ray-tracing.
265d4508 447 OpenGl_RaytraceGeometry myRaytraceGeometry;
e276548b 448
449 //! Radius of bounding sphere of the scene.
265d4508 450 Standard_ShortReal myRaytraceSceneRadius;
e276548b 451 //! Scene epsilon to prevent self-intersections.
265d4508 452 Standard_ShortReal myRaytraceSceneEpsilon;
e276548b 453
fc73a202 454 //! Actual size of traversal stack in shader program.
455 Standard_Integer myTraversalStackSize;
456
457 //! OpenGL/GLSL source of ray-tracing fragment shader.
458 ShaderSource myRaytraceShaderSource;
459 //! OpenGL/GLSL source of adaptive-AA fragment shader.
460 ShaderSource myPostFSAAShaderSource;
461
462 //! OpenGL/GLSL ray-tracing fragment shader.
463 Handle(OpenGl_ShaderObject) myRaytraceShader;
464 //! OpenGL/GLSL adaptive-AA fragment shader.
465 Handle(OpenGl_ShaderObject) myPostFSAAShader;
466
467 //! OpenGL/GLSL ray-tracing shader program.
468 Handle(OpenGl_ShaderProgram) myRaytraceProgram;
469 //! OpenGL/GLSL adaptive-AA shader program.
470 Handle(OpenGl_ShaderProgram) myPostFSAAProgram;
471
472 //! Texture buffer of data records of high-level BVH nodes.
473 Handle(OpenGl_TextureBufferArb) mySceneNodeInfoTexture;
474 //! Texture buffer of minimum points of high-level BVH nodes.
475 Handle(OpenGl_TextureBufferArb) mySceneMinPointTexture;
476 //! Texture buffer of maximum points of high-level BVH nodes.
477 Handle(OpenGl_TextureBufferArb) mySceneMaxPointTexture;
478
479 //! Texture buffer of data records of bottom-level BVH nodes.
480 Handle(OpenGl_TextureBufferArb) myObjectNodeInfoTexture;
481 //! Texture buffer of minimum points of bottom-level BVH nodes.
482 Handle(OpenGl_TextureBufferArb) myObjectMinPointTexture;
483 //! Texture buffer of maximum points of bottom-level BVH nodes.
484 Handle(OpenGl_TextureBufferArb) myObjectMaxPointTexture;
485
486 //! Texture buffer of vertex coords.
487 Handle(OpenGl_TextureBufferArb) myGeometryVertexTexture;
488 //! Texture buffer of vertex normals.
489 Handle(OpenGl_TextureBufferArb) myGeometryNormalTexture;
490 //! Texture buffer of triangle indices.
491 Handle(OpenGl_TextureBufferArb) myGeometryTriangTexture;
492
493 //! Texture buffer of material properties.
494 Handle(OpenGl_TextureBufferArb) myRaytraceMaterialTexture;
495 //! Texture buffer of light source properties.
496 Handle(OpenGl_TextureBufferArb) myRaytraceLightSrcTexture;
497
498 //! Vertex buffer (VBO) for drawing dummy quad.
499 OpenGl_VertexBuffer myRaytraceScreenQuad;
500
501 //! Framebuffer (FBO) to perform adaptive FSAA.
502 Handle(OpenGl_FrameBuffer) myRaytraceFBO1;
503 //! Framebuffer (FBO) to perform adaptive FSAA.
504 Handle(OpenGl_FrameBuffer) myRaytraceFBO2;
265d4508 505
e276548b 506 //! State of OpenGL view.
507 Standard_Size myViewModificationStatus;
e276548b 508 //! State of OpenGL layer list.
509 Standard_Size myLayersModificationStatus;
510
265d4508 511 //! State of OpenGL structures reflected to ray-tracing.
e276548b 512 std::map<const OpenGl_Structure*, Standard_Size> myStructureStates;
513
fc73a202 514 //! Cached locations of frequently used uniform variables.
515 Standard_Integer myUniformLocations[2][OpenGl_RT_NbVariables];
e276548b 516
bf75be98 517protected: //! @name protected fields
2166f0fa 518
a174a3c5 519 Handle(OpenGl_PrinterContext) myPrintContext;
bf75be98 520 Handle(OpenGl_View) myView; // WSViews - now just one view is supported
1981cb22 521 Standard_Boolean myTransientDrawToFront; //!< optimization flag for immediate mode (to render directly to the front buffer)
679ecdee 522 Standard_Boolean myBackBufferRestored;
523 Standard_Boolean myIsImmediateDrawn; //!< flag indicates that immediate mode buffer contains some data
bf75be98 524 Standard_Boolean myUseTransparency;
525 Standard_Boolean myUseZBuffer;
526 Standard_Boolean myUseDepthTest;
527 Standard_Boolean myUseGLLight;
2166f0fa 528
bf75be98 529protected: //! @name fields related to status
530
4269bd1b 531 Handle(OpenGl_RenderFilter) myRenderFilter;
bf75be98 532 Handle(OpenGl_Texture) myTextureBound; //!< currently bound texture (managed by OpenGl_AspectFace and OpenGl_View environment texture)
2166f0fa
SK
533 const OpenGl_AspectLine *AspectLine_set, *AspectLine_applied;
534 const OpenGl_AspectFace *AspectFace_set, *AspectFace_applied;
535 const OpenGl_AspectMarker *AspectMarker_set, *AspectMarker_applied;
536 const OpenGl_AspectText *AspectText_set, *AspectText_applied;
537
538 const OpenGl_TextParam *TextParam_set, *TextParam_applied;
539
540 const OpenGl_Matrix* ViewMatrix_applied;
541 const OpenGl_Matrix* StructureMatrix_applied;
542
3b1817a9 543 OpenGl_Material myMatFront; //!< current front material state (cached to reduce GL context updates)
544 OpenGl_Material myMatBack; //!< current back material state
545 OpenGl_Material myMatTmp; //!< temporary variable
546 TelCullMode myCullingMode; //!< back face culling mode, applied from face aspect
0adbd30f 547
0f8c0fb8 548 //! Model matrix with applied structure transformations
549 OpenGl_Matrix myModelViewMatrix;
550
2166f0fa
SK
551 const TEL_POFFSET_PARAM* PolygonOffset_applied;
552
bf75be98 553 OpenGl_AspectFace myAspectFaceHl; // Hiddenline aspect
554
555public: //! @name type definition
2166f0fa 556
bf75be98 557 DEFINE_STANDARD_RTTI(OpenGl_Workspace)
1c35b92f 558 DEFINE_STANDARD_ALLOC
2166f0fa
SK
559
560};
561
bf75be98 562#endif // _OpenGl_Workspace_Header