0022819: Redesign of OpenGl driver
[occt.git] / src / OpenGl / OpenGl_GraphicDriver.hxx
CommitLineData
2166f0fa
SK
1// File: OpenGl_GraphicDriver.hxx
2// Created: 20 October 2011
3// Author: Sergey ZERCHANINOV
4// Copyright: OPEN CASCADE 2011
5
6#ifndef _OpenGl_GraphicDriver_HeaderFile
7#define _OpenGl_GraphicDriver_HeaderFile
8
9#include <Graphic3d_GraphicDriver.hxx>
10#include <Handle_OpenGl_GraphicDriver.hxx>
11
12#include <Standard_CString.hxx>
13
14#include <Handle_TColStd_HArray1OfByte.hxx>
15#include <Handle_TColStd_HArray1OfReal.hxx>
16#include <Quantity_PlaneAngle.hxx>
17#include <Quantity_NameOfColor.hxx>
18#include <Handle_AlienImage_AlienImage.hxx>
19#include <Image_CRawBufferData.hxx>
20
21#include <Aspect_Display.hxx>
22#include <Aspect_GradientFillMethod.hxx>
23#include <Aspect_FillMethod.hxx>
24#include <Aspect_CLayer2d.hxx>
25#include <Aspect_TypeOfTriedronPosition.hxx>
26#include <Aspect_TypeOfTriedronEcho.hxx>
27#include <Aspect_Handle.hxx>
28#include <Aspect_PrintAlgo.hxx>
29
30#include <Graphic3d_CView.hxx>
31#include <Graphic3d_CStructure.hxx>
32#include <Graphic3d_CGroup.hxx>
33#include <Graphic3d_TypeOfPrimitive.hxx>
34#include <Graphic3d_CPick.hxx>
35#include <Graphic3d_TypeOfPolygon.hxx>
36#include <Graphic3d_TextPath.hxx>
37#include <Graphic3d_HorizontalTextAlignment.hxx>
38#include <Graphic3d_VerticalTextAlignment.hxx>
39#include <Graphic3d_PrimitiveArray.hxx>
40#include <Graphic3d_CUserDraw.hxx>
41#include <Graphic3d_CGraduatedTrihedron.hxx>
42#include <Graphic3d_TypeOfComposition.hxx>
43#include <Graphic3d_TypeOfTexture.hxx>
44#include <Graphic3d_CInitTexture.hxx>
45#include <Graphic3d_ExportFormat.hxx>
46#include <Graphic3d_SortType.hxx>
47#include <Graphic3d_PtrFrameBuffer.hxx>
48#include <Graphic3d_Array1OfVertex.hxx>
49#include <Graphic3d_Array1OfVertexN.hxx>
50#include <Graphic3d_Array1OfVertexNT.hxx>
51#include <Graphic3d_Array1OfVertexC.hxx>
52#include <Graphic3d_Array1OfVertexNC.hxx>
53#include <Graphic3d_Array2OfVertex.hxx>
54#include <Graphic3d_Array2OfVertexN.hxx>
55#include <Graphic3d_Array2OfVertexNT.hxx>
56#include <NCollection_DataMap.hxx>
57
58class TColStd_Array1OfInteger;
59class TColStd_Array1OfReal;
60class TColStd_Array2OfReal;
61class TColStd_HArray1OfByte;
62class Graphic3d_VertexNC;
63class Graphic3d_Vector;
64class Quantity_Color;
65class Graphic3d_Vertex;
66class Aspect_Array1OfEdge;
67class TCollection_ExtendedString;
68class AlienImage_AlienImage;
69class TColStd_HArray1OfReal;
70class Handle(OpenGl_View);
71class Handle(OpenGl_Workspace);
72class OpenGl_Structure;
73
74//! This class defines an OpenGl graphic driver <br>
75class OpenGl_GraphicDriver : public Graphic3d_GraphicDriver
76{
77 public:
78
79 //! Constructor
80 Standard_EXPORT OpenGl_GraphicDriver (const Standard_CString theShrName);
81
82 Standard_EXPORT Standard_Boolean Begin (const Standard_CString ADisplay);
83 Standard_EXPORT Standard_Boolean Begin (const Aspect_Display ADisplay);
84 Standard_EXPORT void End ();
85 Standard_EXPORT Standard_Integer InquireLightLimit ();
86 Standard_EXPORT void InquireMat (const Graphic3d_CView& ACView, TColStd_Array2OfReal& AMatO, TColStd_Array2OfReal& AMatM);
87 Standard_EXPORT Standard_Integer InquireViewLimit ();
88 Standard_EXPORT Standard_Boolean InquireTextureAvailable ();
89 Standard_EXPORT void Blink (const Graphic3d_CStructure& ACStructure,const Standard_Boolean Create);
90 Standard_EXPORT void BoundaryBox (const Graphic3d_CStructure& ACStructure, const Standard_Boolean Create);
91 Standard_EXPORT void HighlightColor (const Graphic3d_CStructure& ACStructure, const Standard_ShortReal R, const Standard_ShortReal G, const Standard_ShortReal B, const Standard_Boolean Create);
92 Standard_EXPORT void NameSetStructure (const Graphic3d_CStructure& ACStructure);
93
94public: // Methods for graphical groups
95
96 Standard_EXPORT void ClearGroup (const Graphic3d_CGroup& ACGroup);
97 Standard_EXPORT void CloseGroup (const Graphic3d_CGroup& ACGroup);
98 Standard_EXPORT void FaceContextGroup (const Graphic3d_CGroup& theCGroup,
99 const Standard_Integer theNoInsert);
100 Standard_EXPORT void Group (Graphic3d_CGroup& theCGroup);
101 Standard_EXPORT void LineContextGroup (const Graphic3d_CGroup& theCGroup,
102 const Standard_Integer theNoInsert);
103 Standard_EXPORT void MarkerContextGroup (const Graphic3d_CGroup& theCGroup,
104 const Standard_Integer theNoInsert);
105 Standard_EXPORT void MarkerContextGroup (const Graphic3d_CGroup& theCGroup,
106 const Standard_Integer theNoInsert,
107 const Standard_Integer theMarkWidth,
108 const Standard_Integer theMarkHeight,
109 const Handle(TColStd_HArray1OfByte)& theTexture);
110 Standard_EXPORT void OpenGroup (const Graphic3d_CGroup& theCGroup);
111 Standard_EXPORT void RemoveGroup (const Graphic3d_CGroup& theCGroup);
112 Standard_EXPORT void TextContextGroup (const Graphic3d_CGroup& theCGroup,
113 const Standard_Integer theNoInsert);
114
115public: // Methods for graphical structures
116
117 Standard_EXPORT void ClearStructure (const Graphic3d_CStructure& theCStructure);
118 Standard_EXPORT void ContextStructure (const Graphic3d_CStructure& theCStructure);
119 Standard_EXPORT void Connect (const Graphic3d_CStructure& theFather,
120 const Graphic3d_CStructure& theSon);
121 Standard_EXPORT void Disconnect (const Graphic3d_CStructure& theFather,
122 const Graphic3d_CStructure& theSon);
123 Standard_EXPORT void DisplayStructure (const Graphic3d_CView& theCView,
124 const Graphic3d_CStructure& theCStructure,
125 const Standard_Integer thePriority);
126 Standard_EXPORT void EraseStructure (const Graphic3d_CView& theCView,
127 const Graphic3d_CStructure& theCStructure);
128 Standard_EXPORT void RemoveStructure (const Graphic3d_CStructure& theCStructure);
129 Standard_EXPORT void Structure (Graphic3d_CStructure& theCStructure);
130
131public:
132
133 Standard_EXPORT void DumpGroup (const Graphic3d_CGroup& theCGroup);
134 Standard_EXPORT void DumpStructure (const Graphic3d_CStructure& theCStructure);
135 Standard_EXPORT void DumpView (const Graphic3d_CView& theCView);
136 Standard_EXPORT Standard_Boolean ElementExploration (const Graphic3d_CStructure& ACStructure, const Standard_Integer ElementNumber, Graphic3d_VertexNC& AVertex, Graphic3d_Vector& AVector);
137 Standard_EXPORT Graphic3d_TypeOfPrimitive ElementType (const Graphic3d_CStructure& ACStructure, const Standard_Integer ElementNumber);
138 Standard_EXPORT void InitPick ();
139 Standard_EXPORT void Pick (Graphic3d_CPick& ACPick);
140 Standard_EXPORT void PickId (const Graphic3d_CGroup& ACGroup);
141 Standard_EXPORT void ActivateView (const Graphic3d_CView& ACView);
142 Standard_EXPORT void AntiAliasing (const Graphic3d_CView& ACView, const Standard_Boolean AFlag);
143 Standard_EXPORT void Background (const Graphic3d_CView& ACView);
144 Standard_EXPORT void GradientBackground (const Graphic3d_CView& ACView, const Quantity_Color& AColor1, const Quantity_Color& AColor2, const Aspect_GradientFillMethod FillStyle);
145 Standard_EXPORT void BackgroundImage (const Standard_CString FileName, const Graphic3d_CView& ACView, const Aspect_FillMethod FillStyle);
146 Standard_EXPORT void SetBgImageStyle (const Graphic3d_CView& ACView, const Aspect_FillMethod FillStyle);
147 Standard_EXPORT void SetBgGradientStyle (const Graphic3d_CView& ACView, const Aspect_GradientFillMethod FillStyle);
148 Standard_EXPORT void ClipLimit (const Graphic3d_CView& ACView, const Standard_Boolean AWait);
149 Standard_EXPORT void DeactivateView (const Graphic3d_CView& ACView);
150 Standard_EXPORT void DepthCueing (const Graphic3d_CView& ACView, const Standard_Boolean AFlag);
151 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);
152 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);
153 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);
154 Standard_EXPORT void RatioWindow (const Graphic3d_CView& ACView);
155 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);
156 Standard_EXPORT void RemoveView (const Graphic3d_CView& ACView);
157 Standard_EXPORT void SetLight (const Graphic3d_CView& ACView);
158 Standard_EXPORT void SetPlane (const Graphic3d_CView& ACView);
159 Standard_EXPORT void SetVisualisation (const Graphic3d_CView& ACView);
160 Standard_EXPORT void TransformStructure (const Graphic3d_CStructure& ACStructure);
161 Standard_EXPORT void DegenerateStructure (const Graphic3d_CStructure& ACStructure);
162 Standard_EXPORT void Transparency (const Graphic3d_CView& ACView, const Standard_Boolean AFlag);
163 Standard_EXPORT void Update (const Graphic3d_CView& ACView, const Aspect_CLayer2d& ACUnderLayer, const Aspect_CLayer2d& ACOverLayer);
164 Standard_EXPORT Standard_Boolean View (Graphic3d_CView& ACView);
165 Standard_EXPORT void ViewMapping (const Graphic3d_CView& ACView, const Standard_Boolean AWait);
166 Standard_EXPORT void ViewOrientation (const Graphic3d_CView& ACView,const Standard_Boolean AWait);
167 Standard_EXPORT void Environment (const Graphic3d_CView& ACView);
168 Standard_EXPORT void Marker (const Graphic3d_CGroup& ACGroup, const Graphic3d_Vertex& APoint, const Standard_Boolean EvalMinMax = Standard_True);
169 Standard_EXPORT void MarkerSet (const Graphic3d_CGroup& ACGroup, const Graphic3d_Array1OfVertex& ListVertex, const Standard_Boolean EvalMinMax = Standard_True);
170 Standard_EXPORT void Polygon (const Graphic3d_CGroup& ACGroup, const Graphic3d_Array1OfVertex& ListVertex, const Graphic3d_TypeOfPolygon AType = Graphic3d_TOP_CONVEX, const Standard_Boolean EvalMinMax = Standard_True);
171 Standard_EXPORT void Polygon (const Graphic3d_CGroup& ACGroup, const Graphic3d_Array1OfVertex& ListVertex, const Graphic3d_Vector& Normal, const Graphic3d_TypeOfPolygon AType = Graphic3d_TOP_CONVEX, const Standard_Boolean EvalMinMax = Standard_True);
172 Standard_EXPORT void Polygon (const Graphic3d_CGroup& ACGroup, const Graphic3d_Array1OfVertexN& ListVertex, const Graphic3d_TypeOfPolygon AType = Graphic3d_TOP_CONVEX, const Standard_Boolean EvalMinMax = Standard_True);
173 Standard_EXPORT void Polygon (const Graphic3d_CGroup& ACGroup, const Graphic3d_Array1OfVertexN& ListVertex, const Graphic3d_Vector& Normal, const Graphic3d_TypeOfPolygon AType = Graphic3d_TOP_CONVEX, const Standard_Boolean EvalMinMax = Standard_True);
174 Standard_EXPORT void Polygon (const Graphic3d_CGroup& ACGroup, const Graphic3d_Array1OfVertexNT& ListVertex, const Graphic3d_TypeOfPolygon AType = Graphic3d_TOP_CONVEX, const Standard_Boolean EvalMinMax = Standard_True);
175 Standard_EXPORT void PolygonHoles (const Graphic3d_CGroup& ACGroup, const TColStd_Array1OfInteger& Bounds, const Graphic3d_Array1OfVertex& ListVertex, const Standard_Boolean EvalMinMax = Standard_True);
176 Standard_EXPORT void PolygonHoles (const Graphic3d_CGroup& ACGroup, const TColStd_Array1OfInteger& Bounds, const Graphic3d_Array1OfVertex& ListVertex, const Graphic3d_Vector& Normal, const Standard_Boolean EvalMinMax = Standard_True);
177 Standard_EXPORT void PolygonHoles (const Graphic3d_CGroup& ACGroup, const TColStd_Array1OfInteger& Bounds, const Graphic3d_Array1OfVertexN& ListVertex, const Standard_Boolean EvalMinMax = Standard_True);
178 Standard_EXPORT void PolygonHoles (const Graphic3d_CGroup& ACGroup, const TColStd_Array1OfInteger& Bounds, const Graphic3d_Array1OfVertexN& ListVertex, const Graphic3d_Vector& Normal, const Standard_Boolean EvalMinMax = Standard_True);
179 Standard_EXPORT void Polyline (const Graphic3d_CGroup& ACGroup, const Standard_Real X1, const Standard_Real Y1, const Standard_Real Z1, const Standard_Real X2, const Standard_Real Y2, const Standard_Real Z2, const Standard_Boolean EvalMinMax = Standard_True);
180 Standard_EXPORT void Polyline (const Graphic3d_CGroup& ACGroup, const Graphic3d_Array1OfVertex& ListVertex, const Standard_Boolean EvalMinMax = Standard_True);
181 Standard_EXPORT void Polyline (const Graphic3d_CGroup& ACGroup, const Graphic3d_Array1OfVertexC& ListVertex, const Standard_Boolean EvalMinMax = Standard_True);
182 Standard_EXPORT void QuadrangleMesh (const Graphic3d_CGroup& ACGroup, const Graphic3d_Array2OfVertex& ListVertex, const Standard_Boolean EvalMinMax = Standard_True);
183 Standard_EXPORT void QuadrangleMesh (const Graphic3d_CGroup& ACGroup, const Graphic3d_Array2OfVertexN& ListVertex, const Standard_Boolean EvalMinMax = Standard_True);
184 Standard_EXPORT void QuadrangleMesh (const Graphic3d_CGroup& ACGroup, const Graphic3d_Array2OfVertexNT& ListVertex, const Standard_Boolean EvalMinMax = Standard_True);
185 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);
186 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);
187 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);
188 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);
189 Standard_EXPORT void TriangleMesh (const Graphic3d_CGroup& ACGroup,const Graphic3d_Array1OfVertex& ListVertex,const Standard_Boolean EvalMinMax = Standard_True);
190 Standard_EXPORT void TriangleMesh (const Graphic3d_CGroup& ACGroup,const Graphic3d_Array1OfVertexN& ListVertex,const Standard_Boolean EvalMinMax = Standard_True);
191 Standard_EXPORT void TriangleMesh (const Graphic3d_CGroup& ACGroup,const Graphic3d_Array1OfVertexNT& ListVertex,const Standard_Boolean EvalMinMax = Standard_True);
192 Standard_EXPORT void TriangleSet (const Graphic3d_CGroup& ACGroup,const Graphic3d_Array1OfVertex& ListVertex,const Aspect_Array1OfEdge& ListEdge,const Standard_Boolean EvalMinMax = Standard_True);
193 Standard_EXPORT void TriangleSet (const Graphic3d_CGroup& ACGroup,const Graphic3d_Array1OfVertexN& ListVertex,const Aspect_Array1OfEdge& ListEdge,const Standard_Boolean EvalMinMax = Standard_True);
194 Standard_EXPORT void TriangleSet (const Graphic3d_CGroup& ACGroup,const Graphic3d_Array1OfVertexNT& ListVertex,const Aspect_Array1OfEdge& ListEdge,const Standard_Boolean EvalMinMax = Standard_True);
195 Standard_EXPORT void TriangleSet (const Graphic3d_CGroup& ACGroup,const Graphic3d_Array1OfVertexC& ListVertex,const Aspect_Array1OfEdge& ListEdge,const Standard_Boolean EvalMinMax = Standard_True);
196 Standard_EXPORT void TriangleSet (const Graphic3d_CGroup& ACGroup,const Graphic3d_Array1OfVertexNC& ListVertex,const Aspect_Array1OfEdge& ListEdge,const Standard_Boolean EvalMinMax = Standard_True);
197 Standard_EXPORT void PrimitiveArray (const Graphic3d_CGroup& ACGroup,const Graphic3d_PrimitiveArray& parray,const Standard_Boolean EvalMinMax = Standard_True);
198 Standard_EXPORT void UserDraw (const Graphic3d_CGroup& ACGroup,const Graphic3d_CUserDraw& AUserDraw);
199 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);
200 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);
201 Standard_EXPORT void TriedronErase (const Graphic3d_CView& ACView);
202 Standard_EXPORT void TriedronEcho (const Graphic3d_CView& ACView, const Aspect_TypeOfTriedronEcho AType = Aspect_TOTE_NONE);
203 Standard_EXPORT void GraduatedTrihedronDisplay (const Graphic3d_CView& view, const Graphic3d_CGraduatedTrihedron& cubic);
204 Standard_EXPORT void GraduatedTrihedronErase (const Graphic3d_CView& view);
205 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);
206 Standard_EXPORT void BeginAnimation (const Graphic3d_CView& ACView);
207 Standard_EXPORT void EndAnimation (const Graphic3d_CView& ACView);
208 Standard_EXPORT Standard_Boolean BeginAddMode (const Graphic3d_CView& ACView);
209 Standard_EXPORT void EndAddMode ();
210 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);
211 Standard_EXPORT void BeginPolyline ();
212 Standard_EXPORT void ClearImmediatMode (const Graphic3d_CView& ACView,const Standard_Boolean aFlush = Standard_True);
213 Standard_EXPORT void Draw (const Standard_ShortReal X, const Standard_ShortReal Y, const Standard_ShortReal Z);
214 Standard_EXPORT void DrawStructure (const Graphic3d_CStructure& ACStructure);
215 Standard_EXPORT void EndImmediatMode (const Standard_Integer Synchronize);
216 Standard_EXPORT void EndPolyline ();
217 Standard_EXPORT void Move (const Standard_ShortReal X, const Standard_ShortReal Y, const Standard_ShortReal Z);
218 Standard_EXPORT void SetLineColor (const Standard_ShortReal R, const Standard_ShortReal G, const Standard_ShortReal B);
219 Standard_EXPORT void SetLineType (const Standard_Integer Type);
220 Standard_EXPORT void SetLineWidth (const Standard_ShortReal Width);
221 Standard_EXPORT void SetMinMax (const Standard_ShortReal X1, const Standard_ShortReal Y1, const Standard_ShortReal Z1, const Standard_ShortReal X2, const Standard_ShortReal Y2, const Standard_ShortReal Z2);
222 Standard_EXPORT void Transform (const TColStd_Array2OfReal& AMatrix, const Graphic3d_TypeOfComposition AType);
223 Standard_EXPORT void Layer (Aspect_CLayer2d& ACLayer);
224 Standard_EXPORT void RemoveLayer (const Aspect_CLayer2d& ACLayer);
225 Standard_EXPORT void BeginLayer (const Aspect_CLayer2d& ACLayer);
226 Standard_EXPORT void BeginPolygon2d ();
227 Standard_EXPORT void BeginPolyline2d ();
228 Standard_EXPORT void ClearLayer (const Aspect_CLayer2d& ACLayer);
229 Standard_EXPORT void Draw (const Standard_ShortReal X,const Standard_ShortReal Y);
230 Standard_EXPORT void Edge (const Standard_ShortReal X,const Standard_ShortReal Y);
231 Standard_EXPORT void EndLayer ();
232 Standard_EXPORT void EndPolygon2d ();
233 Standard_EXPORT void EndPolyline2d ();
234 Standard_EXPORT void Move (const Standard_ShortReal X,const Standard_ShortReal Y);
235 Standard_EXPORT void Rectangle (const Standard_ShortReal X,const Standard_ShortReal Y,const Standard_ShortReal Width,const Standard_ShortReal Height);
236 Standard_EXPORT void SetColor (const Standard_ShortReal R,const Standard_ShortReal G,const Standard_ShortReal B);
237 Standard_EXPORT void SetTransparency (const Standard_ShortReal ATransparency);
238 Standard_EXPORT void UnsetTransparency ();
239 Standard_EXPORT void SetLineAttributes (const Standard_Integer Type,const Standard_ShortReal Width);
240 Standard_EXPORT void SetTextAttributes (const Standard_CString FontName,const Standard_Integer Type,const Standard_ShortReal R,const Standard_ShortReal G,const Standard_ShortReal B);
241 Standard_EXPORT void Text (const Standard_CString AText,const Standard_ShortReal X,const Standard_ShortReal Y,const Standard_ShortReal AHeight);
242 Standard_EXPORT void TextSize (const Standard_CString AText,const Standard_ShortReal AHeight,Standard_ShortReal& AWidth,Standard_ShortReal& AnAscent,Standard_ShortReal& ADescent) const;
243 Standard_EXPORT void SetBackFacingModel (const Graphic3d_CView& aView);
244 //! print the contents of all layers of the view to the printer. <br>
245 //! <hPrnDC> : Pass the PrinterDeviceContext (HDC), <br>
246 //! <showBackground> : When set to FALSE then print the view without background color <br>
247 //! (background is white) <br>
248 //! else set to TRUE for printing with current background color. <br>
249 //! <filename>: If != NULL, then the view will be printed to a file. <br>
250 //! <printAlgorithm>: Select print algorithm: stretch, tile. <br>
251 //! <theScaleFactor>: Scaling coefficient, used internally to scale the <br>
252 //! printings accordingly to the scale factor selected in the printer <br>
253 //! properties dialog. <br>
254 //! Returns Standard_True if the data is passed to the printer, otherwise <br>
255 //! Standard_False if the print operation failed due to the printer errors, <br>
256 //! or lack of system memory. This might be related to insufficient memory <br>
257 //! or some internal errors. All this errors are indicated by the message <br>
258 //! boxes (on level of OpenGl_GraphicDriver). <br>
259 //! Warning: This function can reuse FBO assigned to the view <br>
260 //! Please take it into account if you use it for your purposes; <br>
261 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;
262 Standard_EXPORT void SetDepthTestEnabled (const Graphic3d_CView& view,const Standard_Boolean isEnabled) const;
263 Standard_EXPORT Standard_Boolean IsDepthTestEnabled (const Graphic3d_CView& view) const;
264 //! Reads depths of shown pixels of the given rectangle (glReadPixels with GL_DEPTH_COMPONENT) <br>
265 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;
266 //! Generate offscreen FBO (needs OpenGL2+ hardware) <br>
267 //! If not supported on hardware returns NULL. <br>
268 Standard_EXPORT Graphic3d_PtrFrameBuffer FBOCreate (const Graphic3d_CView& view, const Standard_Integer width, const Standard_Integer height);
269 //! Remove offscreen FBO <br>
270 Standard_EXPORT void FBORelease (const Graphic3d_CView& view, Graphic3d_PtrFrameBuffer& fboPtr);
271 //! Dump active rendering buffer into specified memory buffer. <br>
272 Standard_EXPORT Standard_Boolean BufferDump (const Graphic3d_CView& view, Image_CRawBufferData& buffer);
273 Standard_EXPORT void SetGLLightEnabled (const Graphic3d_CView& view,const Standard_Boolean isEnabled) const;
274 Standard_EXPORT Standard_Boolean IsGLLightEnabled (const Graphic3d_CView& view) const;
275 //! Clear visualization data in graphical driver and stop <br>
276 //! displaying the primitives array of the graphical group <theCGroup>. <br>
277 //! This method is internal and should be used by Graphic3d_Group only. <br>
278 Standard_EXPORT void RemovePrimitiveArray(const Graphic3d_CGroup& theCGroup,const Graphic3d_PrimitiveArray& thePArray);
279 Standard_EXPORT Standard_Integer InquirePlaneLimit();
280 Standard_EXPORT Standard_Integer CreateTexture(const Graphic3d_TypeOfTexture Type,const Handle(AlienImage_AlienImage)& Image,const Standard_CString FileName,const Handle(TColStd_HArray1OfReal)& TexUpperBounds) const;
281 Standard_EXPORT void DestroyTexture(const Standard_Integer TexId) const;
282 Standard_EXPORT void ModifyTexture(const Standard_Integer TexId,const Graphic3d_CInitTexture& AValue) const;
283 Standard_EXPORT Standard_ShortReal DefaultTextHeight() const;
284 Standard_EXPORT void FBOGetDimensions(const Graphic3d_CView& view,const Graphic3d_PtrFrameBuffer fboPtr,Standard_Integer& width,Standard_Integer& height,Standard_Integer& widthMax,Standard_Integer& heightMax);
285 Standard_EXPORT void FBOChangeViewport(const Graphic3d_CView& view,Graphic3d_PtrFrameBuffer& fboPtr,const Standard_Integer width,const Standard_Integer height);
286 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);
287
288public:
289
290 //! Returns true if VBO usage does not forbidden.
291 Standard_EXPORT static Standard_Boolean ToUseVBO();
292
293 //! VBO usage can be forbidden by this method even if it is supported by GL driver.
294 //! Notice that disabling of VBO will cause rendering performance degradation.
295 //! Warning! This method should be called only before any primitives are displayed in GL scene!
296 Standard_EXPORT void EnableVBO (const Standard_Boolean theToTurnOn);
297
298private:
299
300 //! Access the global map of views.
301 static NCollection_DataMap<Standard_Integer, Handle(OpenGl_View)>& GetMapOfViews();
302
303 //! Access the global map of workspaces.
304 static NCollection_DataMap<Standard_Integer, Handle(OpenGl_Workspace)>& GetMapOfWorkspaces();
305
306 //! Access the global map of structures.
307 static NCollection_DataMap<Standard_Integer, OpenGl_Structure*>& GetMapOfStructures();
308
309 //! Invalidates all workspaces - thus they will be redrawn on next update call.
310 static void InvalidateAllWorkspaces();
311
312public:
313
314 DEFINE_STANDARD_RTTI(OpenGl_GraphicDriver)
315};
316
317#endif //_OpenGl_GraphicDriver_HeaderFile