0024275: Cppcheck warnings on uninitialized class members
[occt.git] / src / OpenGl / OpenGl_GraphicDriver.hxx
1 // Created on: 2011-10-20
2 // Created by: Sergey ZERCHANINOV
3 // Copyright (c) 2011-2012 OPEN CASCADE SAS
4 //
5 // The content of this file is subject to the Open CASCADE Technology Public
6 // License Version 6.5 (the "License"). You may not use the content of this file
7 // except in compliance with the License. Please obtain a copy of the License
8 // at http://www.opencascade.org and read it completely before using this file.
9 //
10 // The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
11 // main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
12 //
13 // The Original Code and all software distributed under the License is
14 // distributed on an "AS IS" basis, without warranty of any kind, and the
15 // Initial Developer hereby disclaims all such warranties, including without
16 // limitation, any warranties of merchantability, fitness for a particular
17 // purpose or non-infringement. Please see the License for the specific terms
18 // and conditions governing the rights and limitations under the License.
19
20 #ifndef _OpenGl_GraphicDriver_HeaderFile
21 #define _OpenGl_GraphicDriver_HeaderFile
22
23 #include <Graphic3d_GraphicDriver.hxx>
24 #include <Handle_OpenGl_GraphicDriver.hxx>
25 #include <Handle_OpenGl_Display.hxx>
26 #include <OpenGl_Context.hxx>
27 #include <OpenGl_PrinterContext.hxx>
28
29 #include <Standard_CString.hxx>
30
31 #include <Handle_TColStd_HArray1OfByte.hxx>
32 #include <Handle_TColStd_HArray1OfReal.hxx>
33 #include <Quantity_PlaneAngle.hxx>
34 #include <Quantity_NameOfColor.hxx>
35 #include <Handle_OpenGl_View.hxx>
36 #include <Handle_OpenGl_Workspace.hxx>
37
38 #include <Aspect_Display.hxx>
39 #include <Aspect_DisplayConnection.hxx>
40 #include <Aspect_GradientFillMethod.hxx>
41 #include <Aspect_FillMethod.hxx>
42 #include <Aspect_CLayer2d.hxx>
43 #include <Aspect_TypeOfTriedronPosition.hxx>
44 #include <Aspect_TypeOfTriedronEcho.hxx>
45 #include <Aspect_Handle.hxx>
46 #include <Aspect_PrintAlgo.hxx>
47
48 #include <Graphic3d_CView.hxx>
49 #include <Graphic3d_CStructure.hxx>
50 #include <Graphic3d_CGroup.hxx>
51 #include <Graphic3d_TypeOfPrimitive.hxx>
52 #include <Graphic3d_CPick.hxx>
53 #include <Graphic3d_TextPath.hxx>
54 #include <Graphic3d_HorizontalTextAlignment.hxx>
55 #include <Graphic3d_VerticalTextAlignment.hxx>
56 #include <Graphic3d_PrimitiveArray.hxx>
57 #include <Graphic3d_CUserDraw.hxx>
58 #include <Graphic3d_CGraduatedTrihedron.hxx>
59 #include <Graphic3d_TypeOfComposition.hxx>
60 #include <Graphic3d_ExportFormat.hxx>
61 #include <Graphic3d_SortType.hxx>
62 #include <Graphic3d_PtrFrameBuffer.hxx>
63 #include <Graphic3d_Array1OfVertex.hxx>
64 #include <Graphic3d_Array2OfVertex.hxx>
65 #include <Graphic3d_BufferType.hxx>
66 #include <NCollection_DataMap.hxx>
67
68 class TColStd_Array1OfInteger;
69 class TColStd_Array1OfReal;
70 class TColStd_Array2OfReal;
71 class TColStd_HArray1OfByte;
72 class Graphic3d_Vector;
73 class Quantity_Color;
74 class Graphic3d_Vertex;
75 class Aspect_Array1OfEdge;
76 class TCollection_ExtendedString;
77 class Image_PixMap;
78 class TColStd_HArray1OfReal;
79 class Handle(OpenGl_Workspace);
80 class OpenGl_Element;
81 class OpenGl_Structure;
82 class OpenGl_Text;
83
84 //! Tool class to implement consistent state counter
85 //! for objects inside the same driver instance.
86 class OpenGl_StateCounter
87 {
88 public:
89
90   OpenGl_StateCounter() : myCounter (0) { }
91
92   Standard_Size Increment() { return ++myCounter; }
93
94 private:
95   
96   Standard_Size myCounter;
97 };
98
99 //! This class defines an OpenGl graphic driver <br>
100 class OpenGl_GraphicDriver : public Graphic3d_GraphicDriver
101 {
102 public:
103
104   //! Constructor
105   Standard_EXPORT OpenGl_GraphicDriver (const Handle(Aspect_DisplayConnection)& theDisplayConnection);
106
107   //! Constructor
108   Standard_EXPORT OpenGl_GraphicDriver (const Standard_CString theShrName = "TKOpenGl");
109   Standard_EXPORT Standard_Boolean Begin (const Handle(Aspect_DisplayConnection)& theDisplayConnection);
110   Standard_EXPORT void End ();
111
112   Standard_EXPORT Standard_Integer InquireLightLimit ();
113   Standard_EXPORT void InquireMat (const Graphic3d_CView& ACView, TColStd_Array2OfReal& AMatO, TColStd_Array2OfReal& AMatM);
114   Standard_EXPORT Standard_Integer InquireViewLimit ();
115   Standard_EXPORT void Blink (const Graphic3d_CStructure& ACStructure,const Standard_Boolean Create);
116   Standard_EXPORT void BoundaryBox (const Graphic3d_CStructure& ACStructure, const Standard_Boolean Create);
117   Standard_EXPORT void HighlightColor (const Graphic3d_CStructure& ACStructure, const Standard_ShortReal R, const Standard_ShortReal G, const Standard_ShortReal B, const Standard_Boolean Create);
118   Standard_EXPORT void NameSetStructure (const Graphic3d_CStructure& ACStructure);
119
120 public: // Methods for graphical groups
121
122   Standard_EXPORT void ClearGroup (const Graphic3d_CGroup& ACGroup);
123   Standard_EXPORT void FaceContextGroup (const Graphic3d_CGroup& theCGroup,
124                                          const Standard_Integer  theNoInsert);
125   Standard_EXPORT void Group (Graphic3d_CGroup& theCGroup);
126   Standard_EXPORT void LineContextGroup (const Graphic3d_CGroup& theCGroup,
127                                          const Standard_Integer  theNoInsert);
128   Standard_EXPORT void MarkerContextGroup (const Graphic3d_CGroup& theCGroup,
129                                            const Standard_Integer  theNoInsert);
130   Standard_EXPORT void RemoveGroup (const Graphic3d_CGroup& theCGroup);
131   Standard_EXPORT void TextContextGroup (const Graphic3d_CGroup& theCGroup,
132                                          const Standard_Integer  theNoInsert);
133
134 public: // Methods for graphical structures
135
136   Standard_EXPORT void ClearStructure (const Graphic3d_CStructure& theCStructure);
137   Standard_EXPORT void ContextStructure (const Graphic3d_CStructure& theCStructure);
138   Standard_EXPORT void Connect (const Graphic3d_CStructure& theFather,
139                                 const Graphic3d_CStructure& theSon);
140   Standard_EXPORT void Disconnect (const Graphic3d_CStructure& theFather,
141                                    const Graphic3d_CStructure& theSon);
142   Standard_EXPORT void DisplayStructure (const Graphic3d_CView&      theCView,
143                                          const Graphic3d_CStructure& theCStructure,
144                                          const Standard_Integer      thePriority);
145   Standard_EXPORT void EraseStructure (const Graphic3d_CView&      theCView,
146                                        const Graphic3d_CStructure& theCStructure);
147   Standard_EXPORT void RemoveStructure (const Graphic3d_CStructure& theCStructure);
148   Standard_EXPORT void Structure (Graphic3d_CStructure& theCStructure);
149
150 public:
151
152   Standard_EXPORT void ActivateView (const Graphic3d_CView& ACView);
153   Standard_EXPORT void AntiAliasing (const Graphic3d_CView& ACView, const Standard_Boolean AFlag);
154   Standard_EXPORT void Background (const Graphic3d_CView& ACView);
155   Standard_EXPORT void GradientBackground (const Graphic3d_CView& ACView, const Quantity_Color& AColor1, const Quantity_Color& AColor2, const Aspect_GradientFillMethod FillStyle);
156   Standard_EXPORT void BackgroundImage (const Standard_CString FileName, const Graphic3d_CView& ACView, const Aspect_FillMethod FillStyle);
157   Standard_EXPORT void SetBgImageStyle (const Graphic3d_CView& ACView, const Aspect_FillMethod FillStyle);
158   Standard_EXPORT void SetBgGradientStyle (const Graphic3d_CView& ACView, const Aspect_GradientFillMethod FillStyle);
159   Standard_EXPORT void ClipLimit (const Graphic3d_CView& ACView, const Standard_Boolean AWait);
160   Standard_EXPORT void DeactivateView (const Graphic3d_CView& ACView);
161   Standard_EXPORT void DepthCueing (const Graphic3d_CView& ACView, const Standard_Boolean AFlag);
162   Standard_EXPORT Standard_Boolean ProjectRaster (const Graphic3d_CView& ACView, const Standard_ShortReal AX, const Standard_ShortReal AY, const Standard_ShortReal AZ, Standard_Integer& AU, Standard_Integer& AV);
163   Standard_EXPORT Standard_Boolean UnProjectRaster (const Graphic3d_CView& ACView, const Standard_Integer Axm, const Standard_Integer Aym, const Standard_Integer AXM, const Standard_Integer AYM, const Standard_Integer AU, const Standard_Integer AV, Standard_ShortReal& AX, Standard_ShortReal& AY, Standard_ShortReal& AZ);
164   Standard_EXPORT Standard_Boolean UnProjectRasterWithRay (const Graphic3d_CView& ACView, const Standard_Integer Axm, const Standard_Integer Aym, const Standard_Integer AXM, const Standard_Integer AYM, const Standard_Integer AU, const Standard_Integer AV, Standard_ShortReal& AX, Standard_ShortReal& AY, Standard_ShortReal& AZ, Standard_ShortReal& DX, Standard_ShortReal& DY, Standard_ShortReal& DZ);
165   Standard_EXPORT void RatioWindow (const Graphic3d_CView& ACView);
166   Standard_EXPORT void Redraw (const Graphic3d_CView& ACView, const Aspect_CLayer2d& ACUnderLayer, const Aspect_CLayer2d& ACOverLayer, const Standard_Integer x = 0, const Standard_Integer y = 0, const Standard_Integer width = 0, const Standard_Integer height = 0);
167   Standard_EXPORT void RemoveView (const Graphic3d_CView& ACView);
168   Standard_EXPORT void SetLight (const Graphic3d_CView& ACView);
169   Standard_EXPORT void SetClipPlanes (const Graphic3d_CView& theCView);
170   Standard_EXPORT void SetClipPlanes (const Graphic3d_CStructure& theCStructure);
171   Standard_EXPORT void SetVisualisation (const Graphic3d_CView& ACView);
172   Standard_EXPORT void TransformStructure (const Graphic3d_CStructure& ACStructure);
173   Standard_EXPORT void Transparency (const Graphic3d_CView& ACView, const Standard_Boolean AFlag);
174   Standard_EXPORT void Update (const Graphic3d_CView& ACView, const Aspect_CLayer2d& ACUnderLayer, const Aspect_CLayer2d& ACOverLayer);
175   Standard_EXPORT Standard_Boolean View (Graphic3d_CView& ACView);
176   Standard_EXPORT void ViewMapping (const Graphic3d_CView& ACView, const Standard_Boolean AWait);
177   Standard_EXPORT void ViewOrientation (const Graphic3d_CView& ACView,const Standard_Boolean AWait);
178   Standard_EXPORT void Environment (const Graphic3d_CView& ACView);
179   Standard_EXPORT void SetStencilTestOptions (const Graphic3d_CGroup& theCGroup, const Standard_Boolean theIsEnabled);
180   Standard_EXPORT void Text (const Graphic3d_CGroup& ACGroup, const Standard_CString AText, const Graphic3d_Vertex& APoint, const Standard_Real AHeight, const Quantity_PlaneAngle AAngle, const Graphic3d_TextPath ATp, const Graphic3d_HorizontalTextAlignment AHta, const Graphic3d_VerticalTextAlignment AVta, const Standard_Boolean EvalMinMax = Standard_True);
181   Standard_EXPORT void Text (const Graphic3d_CGroup& ACGroup, const Standard_CString AText, const Graphic3d_Vertex& APoint, const Standard_Real AHeight, const Standard_Boolean EvalMinMax = Standard_True);
182   Standard_EXPORT void Text (const Graphic3d_CGroup& ACGroup, const TCollection_ExtendedString& AText, const Graphic3d_Vertex& APoint, const Standard_Real AHeight, const Quantity_PlaneAngle AAngle, const Graphic3d_TextPath ATp, const Graphic3d_HorizontalTextAlignment AHta, const Graphic3d_VerticalTextAlignment AVta, const Standard_Boolean EvalMinMax = Standard_True);
183   Standard_EXPORT void Text (const Graphic3d_CGroup& ACGroup, const TCollection_ExtendedString& AText, const Graphic3d_Vertex& APoint, const Standard_Real AHeight, const Standard_Boolean EvalMinMax = Standard_True);
184   Standard_EXPORT void PrimitiveArray (const Graphic3d_CGroup& ACGroup,const Graphic3d_PrimitiveArray& parray,const Standard_Boolean EvalMinMax = Standard_True);
185   Standard_EXPORT void UserDraw (const Graphic3d_CGroup& ACGroup,const Graphic3d_CUserDraw& AUserDraw);
186   Standard_EXPORT void ZBufferTriedronSetup (const Quantity_NameOfColor XColor = Quantity_NOC_RED, const Quantity_NameOfColor YColor = Quantity_NOC_GREEN, const Quantity_NameOfColor ZColor = Quantity_NOC_BLUE1, const Standard_Real SizeRatio = 0.8, const Standard_Real AxisDiametr = 0.05, const Standard_Integer NbFacettes = 12);
187   Standard_EXPORT void TriedronDisplay (const Graphic3d_CView& ACView, const Aspect_TypeOfTriedronPosition APosition = Aspect_TOTP_CENTER, const Quantity_NameOfColor AColor = Quantity_NOC_WHITE, const Standard_Real AScale = 0.02, const Standard_Boolean AsWireframe = Standard_True);
188   Standard_EXPORT void TriedronErase (const Graphic3d_CView& ACView);
189   Standard_EXPORT void TriedronEcho (const Graphic3d_CView& ACView, const Aspect_TypeOfTriedronEcho AType = Aspect_TOTE_NONE);
190   Standard_EXPORT void GraduatedTrihedronDisplay (const Graphic3d_CView& view, const Graphic3d_CGraduatedTrihedron& cubic);
191   Standard_EXPORT void GraduatedTrihedronErase (const Graphic3d_CView& view);
192   Standard_EXPORT void GraduatedTrihedronMinMaxValues (const Standard_ShortReal xmin, const Standard_ShortReal ymin, const Standard_ShortReal zmin, const Standard_ShortReal xmax, const Standard_ShortReal ymax, const Standard_ShortReal zmax);
193   Standard_EXPORT Standard_Boolean SetImmediateModeDrawToFront (const Graphic3d_CView& theCView,
194                                                                 const Standard_Boolean theDrawToFrontBuffer);
195   Standard_EXPORT Standard_Boolean BeginAddMode (const Graphic3d_CView& ACView);
196   Standard_EXPORT void EndAddMode ();
197   Standard_EXPORT Standard_Boolean BeginImmediatMode(const Graphic3d_CView& ACView, const Aspect_CLayer2d& ACUnderLayer, const Aspect_CLayer2d& ACOverLayer, const Standard_Boolean DoubleBuffer, const Standard_Boolean RetainMode);
198   Standard_EXPORT void ClearImmediatMode (const Graphic3d_CView& ACView,const Standard_Boolean aFlush = Standard_True);
199   Standard_EXPORT void DrawStructure (const Graphic3d_CStructure& ACStructure);
200   Standard_EXPORT void EndImmediatMode (const Standard_Integer Synchronize);
201   Standard_EXPORT void Layer (Aspect_CLayer2d& ACLayer);
202   Standard_EXPORT void RemoveLayer (const Aspect_CLayer2d& ACLayer);
203   Standard_EXPORT void BeginLayer (const Aspect_CLayer2d& ACLayer);
204   Standard_EXPORT void BeginPolygon2d ();
205   Standard_EXPORT void BeginPolyline2d ();
206   Standard_EXPORT void ClearLayer (const Aspect_CLayer2d& ACLayer);
207   Standard_EXPORT void Draw (const Standard_ShortReal X,const Standard_ShortReal Y);
208   Standard_EXPORT void Edge (const Standard_ShortReal X,const Standard_ShortReal Y);
209   Standard_EXPORT void EndLayer ();
210   Standard_EXPORT void EndPolygon2d ();
211   Standard_EXPORT void EndPolyline2d ();
212   Standard_EXPORT void Move (const Standard_ShortReal X,const Standard_ShortReal Y);
213   Standard_EXPORT void Rectangle (const Standard_ShortReal X,const Standard_ShortReal Y,const Standard_ShortReal Width,const Standard_ShortReal Height);
214   Standard_EXPORT void SetColor (const Standard_ShortReal R,const Standard_ShortReal G,const Standard_ShortReal B);
215   Standard_EXPORT void SetTransparency (const Standard_ShortReal ATransparency);
216   Standard_EXPORT void UnsetTransparency ();
217   Standard_EXPORT void SetLineAttributes (const Standard_Integer Type,const Standard_ShortReal Width);
218
219   //! Set text attributes for under-/overlayer. <br>
220   //! <Font> argument defines the name of the font to be used, <br>
221   //! <Type> argument defines the display type of the text, <br>
222   //! <R> <G> <B> values define the color of decal or subtitle background. <br>
223   //! To set the color of the text you can use the SetColor method. <br>
224   Standard_EXPORT void SetTextAttributes (const Standard_CString FontName,const Standard_Integer Type,const Standard_ShortReal R,const Standard_ShortReal G,const Standard_ShortReal B);
225   Standard_EXPORT void Text (const Standard_CString AText,const Standard_ShortReal X,const Standard_ShortReal Y,const Standard_ShortReal AHeight);
226   Standard_EXPORT void TextSize (const Standard_CString AText,const Standard_ShortReal AHeight,Standard_ShortReal& AWidth,Standard_ShortReal& AnAscent,Standard_ShortReal& ADescent) const;
227   Standard_EXPORT void SetBackFacingModel (const Graphic3d_CView& aView);
228   //! print the contents of all layers of the view to the printer. <br>
229   //! <hPrnDC> : Pass the PrinterDeviceContext (HDC), <br>
230   //! <showBackground> : When set to FALSE then print the view without background color <br>
231   //! (background is white) <br>
232   //! else set to TRUE for printing with current background color. <br>
233   //! <filename>: If != NULL, then the view will be printed to a file. <br>
234   //! <printAlgorithm>: Select print algorithm: stretch, tile. <br>
235   //! <theScaleFactor>: Scaling coefficient, used internally to scale the <br>
236   //! printings accordingly to the scale factor selected in the printer <br>
237   //! properties dialog. <br>
238   //! Returns Standard_True if the data is passed to the printer, otherwise <br>
239   //! Standard_False if the print operation failed due to the printer errors, <br>
240   //! or lack of system memory. This might be related to insufficient memory <br>
241   //! or some internal errors. All this errors are indicated by the message <br>
242   //! boxes (on level of OpenGl_GraphicDriver). <br>
243   //! Warning: This function can reuse FBO assigned to the view <br>
244   //! Please take it into account if you use it for your purposes; <br>
245   Standard_EXPORT Standard_Boolean Print (const Graphic3d_CView& ACView, const Aspect_CLayer2d& ACUnderLayer, const Aspect_CLayer2d& ACOverLayer, const Aspect_Handle hPrnDC, const Standard_Boolean showBackground, const Standard_CString filename, const Aspect_PrintAlgo printAlgorithm = Aspect_PA_STRETCH, const Standard_Real theScaleFactor = 1.0) const;
246   Standard_EXPORT void SetDepthTestEnabled (const Graphic3d_CView& view,const Standard_Boolean isEnabled) const;
247   Standard_EXPORT Standard_Boolean IsDepthTestEnabled (const Graphic3d_CView& view) const;
248   //! Reads depths of shown pixels of the given rectangle (glReadPixels with GL_DEPTH_COMPONENT) <br>
249   Standard_EXPORT void ReadDepths (const Graphic3d_CView& view,const Standard_Integer x,const Standard_Integer y,const Standard_Integer width,const Standard_Integer height,const Standard_Address buffer) const;
250   //! Generate offscreen FBO (needs OpenGL2+ hardware) <br>
251   //! If not supported on hardware returns NULL. <br>
252   Standard_EXPORT Graphic3d_PtrFrameBuffer FBOCreate (const Graphic3d_CView& view, const Standard_Integer width, const Standard_Integer height);
253   //! Remove offscreen FBO <br>
254   Standard_EXPORT void FBORelease (const Graphic3d_CView& view, Graphic3d_PtrFrameBuffer& fboPtr);
255   //! Dump active rendering buffer into specified memory buffer. <br>
256   Standard_EXPORT Standard_Boolean BufferDump (const Graphic3d_CView&      theCView,
257                                                Image_PixMap&               theImage,
258                                                const Graphic3d_BufferType& theBufferType);
259   Standard_EXPORT void SetGLLightEnabled (const Graphic3d_CView& view,const Standard_Boolean isEnabled) const;
260   Standard_EXPORT Standard_Boolean IsGLLightEnabled (const Graphic3d_CView& view) const;
261   //! Clear visualization data in graphical driver and stop <br>
262   //! displaying the primitives array of the graphical group <theCGroup>. <br>
263   //! This method is internal and should be used by Graphic3d_Group only. <br>
264   Standard_EXPORT Standard_Integer InquirePlaneLimit();
265   Standard_EXPORT Standard_ShortReal DefaultTextHeight() const;
266   Standard_EXPORT void FBOGetDimensions(const Graphic3d_CView& view,const Graphic3d_PtrFrameBuffer fboPtr,Standard_Integer& width,Standard_Integer& height,Standard_Integer& widthMax,Standard_Integer& heightMax);
267   Standard_EXPORT void FBOChangeViewport(const Graphic3d_CView& view,Graphic3d_PtrFrameBuffer& fboPtr,const Standard_Integer width,const Standard_Integer height);
268   Standard_EXPORT Standard_Boolean Export(const Standard_CString theFileName,const Graphic3d_ExportFormat theFormat,const Graphic3d_SortType theSortType,const Standard_Integer theWidth,const Standard_Integer theHeight,const Graphic3d_CView& theView,const Aspect_CLayer2d& theLayerUnder,const Aspect_CLayer2d& theLayerOver,const Standard_Real thePrecision = 0.005,const Standard_Address theProgressBarFunc = NULL,const Standard_Address theProgressObject = NULL);
269
270   //! Add a new top-level z layer with ID <theLayerId> for <br>
271   //! the view. Z layers allow drawing structures in higher layers <br>
272   //! in foreground of structures in lower layers. To add a structure <br>
273   //! to desired layer on display it is necessary to set the layer <br>
274   //! index for the structure. <br>
275   Standard_EXPORT void AddZLayer(const Graphic3d_CView& theCView,
276                                  const Standard_Integer theLayerId);
277
278   //! Remove Z layer from the specified view. All structures <br>
279   //! displayed at the moment in layer will be displayed in default layer <br>
280   //! ( the bottom-level z layer ). To unset layer index from associated <br>
281   //! structures use method UnsetZLayer (...). <br>
282   Standard_EXPORT void RemoveZLayer(const Graphic3d_CView& theCView,
283                                     const Standard_Integer theLayerId);
284
285   //! Unset Z layer ID for all structures. The structure <br>
286   //! indexes will be set to default layer ( the bottom-level z layer with <br>
287   //! ID = 0 ). <br>
288   Standard_EXPORT void UnsetZLayer(const Standard_Integer theLayerId);
289
290   //! Change Z layer of a structure. The new z layer ID will <br>
291   //! be used to define the associated layer for structure on display. <br>
292   //! It is recommended to take care of redisplaying the structures already <br>
293   //! presented in view with previously set layer index. This is usually <br>
294   //! done by viewer manager. Z layers allow drawing structures in <br>
295   //! higher layers in foreground of structures in lower layers. <br>
296   Standard_EXPORT void ChangeZLayer(const Graphic3d_CStructure& theCStructure,
297                                     const Standard_Integer theLayerId);
298
299   //! Change Z layer of a structure already presented in view. <br>
300   //! It is recommended to update z layer of already <br>
301   //! displayed structures with this method before setting new z layer <br>
302   //! index to the structure. This is usually done by viewer manager. <br>
303   Standard_EXPORT void ChangeZLayer(const Graphic3d_CStructure& theCStructure,
304                                     const Graphic3d_CView& theCView,
305                                     const Standard_Integer theNewLayerId);
306
307   //! Get Z layer ID of the structure. If the structure doesn't exists in <br>
308   //! graphic driver, the method returns -1. <br>
309   Standard_EXPORT Standard_Integer GetZLayer(const Graphic3d_CStructure& theCStructure) const;
310
311 public:
312
313   //! @return the visualization options
314   inline const OpenGl_Caps& Options() const
315   {
316     return *myCaps.operator->();
317   }
318
319   //! @return the visualization options
320   inline OpenGl_Caps& ChangeOptions()
321   {
322     return *myCaps.operator->();
323   }
324
325   //! VBO usage can be forbidden by this method even if it is supported by GL driver.
326   //! Notice that disabling of VBO will cause rendering performance degradation.
327   //! Warning! This method should be called only before any primitives are displayed in GL scene!
328   Standard_EXPORT void EnableVBO (const Standard_Boolean theToTurnOn);
329
330   //! Returns information about GPU memory usage.
331   //! Please read OpenGl_Context::MemoryInfo() for more description.
332   Standard_EXPORT Standard_Boolean MemoryInfo (Standard_Size&           theFreeBytes,
333                                                TCollection_AsciiString& theInfo) const;
334
335   //! UserDraw function prototype
336   typedef OpenGl_Element* (*OpenGl_UserDrawCallback_t )(const CALL_DEF_USERDRAW* );
337
338   //! Method to setup UserDraw callback
339   Standard_EXPORT OpenGl_UserDrawCallback_t& UserDrawCallback();
340
341 public:
342   
343   //! Returns information about OpenCL device used for computations.
344   Standard_EXPORT Standard_Boolean GetOpenClDeviceInfo (const Graphic3d_CView& theCView,
345                       NCollection_DataMap<TCollection_AsciiString, TCollection_AsciiString>& theInfo);
346
347 private:
348
349   //! Method to retrieve valid GL context.
350   //! Could return NULL-handle if no window created by this driver.
351   Standard_EXPORT const Handle(OpenGl_Context)& GetSharedContext() const;
352
353 public:
354
355   DEFINE_STANDARD_RTTI(OpenGl_GraphicDriver)
356
357 private:
358
359   Handle(OpenGl_Display)                                          myGlDisplay;
360   Handle(OpenGl_Caps)                                             myCaps;
361   NCollection_DataMap<Standard_Integer, Handle(OpenGl_View)>      myMapOfView;
362   NCollection_DataMap<Standard_Integer, Handle(OpenGl_Workspace)> myMapOfWS;
363   NCollection_DataMap<Standard_Integer, OpenGl_Structure*>        myMapOfStructure;
364   Handle(OpenGl_Workspace)                                        myImmediateWS;
365   mutable Handle(OpenGl_PrinterContext)                           myPrintContext;
366   OpenGl_UserDrawCallback_t                                       myUserDrawCallback;
367   OpenGl_Text*                                                    myTempText;         //!< variable for compatibility (drawing text in layers)
368
369 public:
370
371   OpenGl_StateCounter* GetStateCounter() const { return &myStateCounter; }
372
373 private:
374
375   mutable OpenGl_StateCounter myStateCounter;
376
377 };
378
379 #endif //_OpenGl_GraphicDriver_HeaderFile