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