0022627: Change OCCT memory management defaults
[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
2166f0fa
SK
133 Standard_EXPORT void ActivateView (const Graphic3d_CView& ACView);
134 Standard_EXPORT void AntiAliasing (const Graphic3d_CView& ACView, const Standard_Boolean AFlag);
135 Standard_EXPORT void Background (const Graphic3d_CView& ACView);
136 Standard_EXPORT void GradientBackground (const Graphic3d_CView& ACView, const Quantity_Color& AColor1, const Quantity_Color& AColor2, const Aspect_GradientFillMethod FillStyle);
137 Standard_EXPORT void BackgroundImage (const Standard_CString FileName, const Graphic3d_CView& ACView, const Aspect_FillMethod FillStyle);
138 Standard_EXPORT void SetBgImageStyle (const Graphic3d_CView& ACView, const Aspect_FillMethod FillStyle);
139 Standard_EXPORT void SetBgGradientStyle (const Graphic3d_CView& ACView, const Aspect_GradientFillMethod FillStyle);
140 Standard_EXPORT void ClipLimit (const Graphic3d_CView& ACView, const Standard_Boolean AWait);
141 Standard_EXPORT void DeactivateView (const Graphic3d_CView& ACView);
142 Standard_EXPORT void DepthCueing (const Graphic3d_CView& ACView, const Standard_Boolean AFlag);
143 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);
144 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);
145 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);
146 Standard_EXPORT void RatioWindow (const Graphic3d_CView& ACView);
147 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);
148 Standard_EXPORT void RemoveView (const Graphic3d_CView& ACView);
149 Standard_EXPORT void SetLight (const Graphic3d_CView& ACView);
150 Standard_EXPORT void SetPlane (const Graphic3d_CView& ACView);
151 Standard_EXPORT void SetVisualisation (const Graphic3d_CView& ACView);
152 Standard_EXPORT void TransformStructure (const Graphic3d_CStructure& ACStructure);
153 Standard_EXPORT void DegenerateStructure (const Graphic3d_CStructure& ACStructure);
154 Standard_EXPORT void Transparency (const Graphic3d_CView& ACView, const Standard_Boolean AFlag);
155 Standard_EXPORT void Update (const Graphic3d_CView& ACView, const Aspect_CLayer2d& ACUnderLayer, const Aspect_CLayer2d& ACOverLayer);
156 Standard_EXPORT Standard_Boolean View (Graphic3d_CView& ACView);
157 Standard_EXPORT void ViewMapping (const Graphic3d_CView& ACView, const Standard_Boolean AWait);
158 Standard_EXPORT void ViewOrientation (const Graphic3d_CView& ACView,const Standard_Boolean AWait);
159 Standard_EXPORT void Environment (const Graphic3d_CView& ACView);
160 Standard_EXPORT void Marker (const Graphic3d_CGroup& ACGroup, const Graphic3d_Vertex& APoint, const Standard_Boolean EvalMinMax = Standard_True);
161 Standard_EXPORT void MarkerSet (const Graphic3d_CGroup& ACGroup, const Graphic3d_Array1OfVertex& ListVertex, const Standard_Boolean EvalMinMax = Standard_True);
162 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);
163 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);
164 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);
165 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);
166 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);
167 Standard_EXPORT void PolygonHoles (const Graphic3d_CGroup& ACGroup, const TColStd_Array1OfInteger& Bounds, const Graphic3d_Array1OfVertex& ListVertex, const Standard_Boolean EvalMinMax = Standard_True);
168 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);
169 Standard_EXPORT void PolygonHoles (const Graphic3d_CGroup& ACGroup, const TColStd_Array1OfInteger& Bounds, const Graphic3d_Array1OfVertexN& ListVertex, const Standard_Boolean EvalMinMax = Standard_True);
170 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);
171 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);
172 Standard_EXPORT void Polyline (const Graphic3d_CGroup& ACGroup, const Graphic3d_Array1OfVertex& ListVertex, const Standard_Boolean EvalMinMax = Standard_True);
173 Standard_EXPORT void Polyline (const Graphic3d_CGroup& ACGroup, const Graphic3d_Array1OfVertexC& ListVertex, const Standard_Boolean EvalMinMax = Standard_True);
174 Standard_EXPORT void QuadrangleMesh (const Graphic3d_CGroup& ACGroup, const Graphic3d_Array2OfVertex& ListVertex, const Standard_Boolean EvalMinMax = Standard_True);
175 Standard_EXPORT void QuadrangleMesh (const Graphic3d_CGroup& ACGroup, const Graphic3d_Array2OfVertexN& ListVertex, const Standard_Boolean EvalMinMax = Standard_True);
176 Standard_EXPORT void QuadrangleMesh (const Graphic3d_CGroup& ACGroup, const Graphic3d_Array2OfVertexNT& ListVertex, const Standard_Boolean EvalMinMax = Standard_True);
177 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);
178 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);
179 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);
180 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);
181 Standard_EXPORT void TriangleMesh (const Graphic3d_CGroup& ACGroup,const Graphic3d_Array1OfVertex& ListVertex,const Standard_Boolean EvalMinMax = Standard_True);
182 Standard_EXPORT void TriangleMesh (const Graphic3d_CGroup& ACGroup,const Graphic3d_Array1OfVertexN& ListVertex,const Standard_Boolean EvalMinMax = Standard_True);
183 Standard_EXPORT void TriangleMesh (const Graphic3d_CGroup& ACGroup,const Graphic3d_Array1OfVertexNT& ListVertex,const Standard_Boolean EvalMinMax = Standard_True);
184 Standard_EXPORT void TriangleSet (const Graphic3d_CGroup& ACGroup,const Graphic3d_Array1OfVertex& ListVertex,const Aspect_Array1OfEdge& ListEdge,const Standard_Boolean EvalMinMax = Standard_True);
185 Standard_EXPORT void TriangleSet (const Graphic3d_CGroup& ACGroup,const Graphic3d_Array1OfVertexN& ListVertex,const Aspect_Array1OfEdge& ListEdge,const Standard_Boolean EvalMinMax = Standard_True);
186 Standard_EXPORT void TriangleSet (const Graphic3d_CGroup& ACGroup,const Graphic3d_Array1OfVertexNT& ListVertex,const Aspect_Array1OfEdge& ListEdge,const Standard_Boolean EvalMinMax = Standard_True);
187 Standard_EXPORT void TriangleSet (const Graphic3d_CGroup& ACGroup,const Graphic3d_Array1OfVertexC& ListVertex,const Aspect_Array1OfEdge& ListEdge,const Standard_Boolean EvalMinMax = Standard_True);
188 Standard_EXPORT void TriangleSet (const Graphic3d_CGroup& ACGroup,const Graphic3d_Array1OfVertexNC& ListVertex,const Aspect_Array1OfEdge& ListEdge,const Standard_Boolean EvalMinMax = Standard_True);
189 Standard_EXPORT void PrimitiveArray (const Graphic3d_CGroup& ACGroup,const Graphic3d_PrimitiveArray& parray,const Standard_Boolean EvalMinMax = Standard_True);
190 Standard_EXPORT void UserDraw (const Graphic3d_CGroup& ACGroup,const Graphic3d_CUserDraw& AUserDraw);
191 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);
192 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);
193 Standard_EXPORT void TriedronErase (const Graphic3d_CView& ACView);
194 Standard_EXPORT void TriedronEcho (const Graphic3d_CView& ACView, const Aspect_TypeOfTriedronEcho AType = Aspect_TOTE_NONE);
195 Standard_EXPORT void GraduatedTrihedronDisplay (const Graphic3d_CView& view, const Graphic3d_CGraduatedTrihedron& cubic);
196 Standard_EXPORT void GraduatedTrihedronErase (const Graphic3d_CView& view);
197 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);
198 Standard_EXPORT void BeginAnimation (const Graphic3d_CView& ACView);
199 Standard_EXPORT void EndAnimation (const Graphic3d_CView& ACView);
200 Standard_EXPORT Standard_Boolean BeginAddMode (const Graphic3d_CView& ACView);
201 Standard_EXPORT void EndAddMode ();
202 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);
203 Standard_EXPORT void BeginPolyline ();
204 Standard_EXPORT void ClearImmediatMode (const Graphic3d_CView& ACView,const Standard_Boolean aFlush = Standard_True);
205 Standard_EXPORT void Draw (const Standard_ShortReal X, const Standard_ShortReal Y, const Standard_ShortReal Z);
206 Standard_EXPORT void DrawStructure (const Graphic3d_CStructure& ACStructure);
207 Standard_EXPORT void EndImmediatMode (const Standard_Integer Synchronize);
208 Standard_EXPORT void EndPolyline ();
209 Standard_EXPORT void Move (const Standard_ShortReal X, const Standard_ShortReal Y, const Standard_ShortReal Z);
210 Standard_EXPORT void SetLineColor (const Standard_ShortReal R, const Standard_ShortReal G, const Standard_ShortReal B);
211 Standard_EXPORT void SetLineType (const Standard_Integer Type);
212 Standard_EXPORT void SetLineWidth (const Standard_ShortReal Width);
213 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);
214 Standard_EXPORT void Transform (const TColStd_Array2OfReal& AMatrix, const Graphic3d_TypeOfComposition AType);
215 Standard_EXPORT void Layer (Aspect_CLayer2d& ACLayer);
216 Standard_EXPORT void RemoveLayer (const Aspect_CLayer2d& ACLayer);
217 Standard_EXPORT void BeginLayer (const Aspect_CLayer2d& ACLayer);
218 Standard_EXPORT void BeginPolygon2d ();
219 Standard_EXPORT void BeginPolyline2d ();
220 Standard_EXPORT void ClearLayer (const Aspect_CLayer2d& ACLayer);
221 Standard_EXPORT void Draw (const Standard_ShortReal X,const Standard_ShortReal Y);
222 Standard_EXPORT void Edge (const Standard_ShortReal X,const Standard_ShortReal Y);
223 Standard_EXPORT void EndLayer ();
224 Standard_EXPORT void EndPolygon2d ();
225 Standard_EXPORT void EndPolyline2d ();
226 Standard_EXPORT void Move (const Standard_ShortReal X,const Standard_ShortReal Y);
227 Standard_EXPORT void Rectangle (const Standard_ShortReal X,const Standard_ShortReal Y,const Standard_ShortReal Width,const Standard_ShortReal Height);
228 Standard_EXPORT void SetColor (const Standard_ShortReal R,const Standard_ShortReal G,const Standard_ShortReal B);
229 Standard_EXPORT void SetTransparency (const Standard_ShortReal ATransparency);
230 Standard_EXPORT void UnsetTransparency ();
231 Standard_EXPORT void SetLineAttributes (const Standard_Integer Type,const Standard_ShortReal Width);
25289ec1 232
233 //! Set text attributes for under-/overlayer. <br>
234 //! <Font> argument defines the name of the font to be used, <br>
235 //! <Type> argument defines the display type of the text, <br>
236 //! <R> <G> <B> values define the color of decal or subtitle background. <br>
237 //! To set the color of the text you can use the SetColor method. <br>
2166f0fa
SK
238 Standard_EXPORT void SetTextAttributes (const Standard_CString FontName,const Standard_Integer Type,const Standard_ShortReal R,const Standard_ShortReal G,const Standard_ShortReal B);
239 Standard_EXPORT void Text (const Standard_CString AText,const Standard_ShortReal X,const Standard_ShortReal Y,const Standard_ShortReal AHeight);
240 Standard_EXPORT void TextSize (const Standard_CString AText,const Standard_ShortReal AHeight,Standard_ShortReal& AWidth,Standard_ShortReal& AnAscent,Standard_ShortReal& ADescent) const;
241 Standard_EXPORT void SetBackFacingModel (const Graphic3d_CView& aView);
242 //! print the contents of all layers of the view to the printer. <br>
243 //! <hPrnDC> : Pass the PrinterDeviceContext (HDC), <br>
244 //! <showBackground> : When set to FALSE then print the view without background color <br>
245 //! (background is white) <br>
246 //! else set to TRUE for printing with current background color. <br>
247 //! <filename>: If != NULL, then the view will be printed to a file. <br>
248 //! <printAlgorithm>: Select print algorithm: stretch, tile. <br>
249 //! <theScaleFactor>: Scaling coefficient, used internally to scale the <br>
250 //! printings accordingly to the scale factor selected in the printer <br>
251 //! properties dialog. <br>
252 //! Returns Standard_True if the data is passed to the printer, otherwise <br>
253 //! Standard_False if the print operation failed due to the printer errors, <br>
254 //! or lack of system memory. This might be related to insufficient memory <br>
255 //! or some internal errors. All this errors are indicated by the message <br>
256 //! boxes (on level of OpenGl_GraphicDriver). <br>
257 //! Warning: This function can reuse FBO assigned to the view <br>
258 //! Please take it into account if you use it for your purposes; <br>
259 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;
260 Standard_EXPORT void SetDepthTestEnabled (const Graphic3d_CView& view,const Standard_Boolean isEnabled) const;
261 Standard_EXPORT Standard_Boolean IsDepthTestEnabled (const Graphic3d_CView& view) const;
262 //! Reads depths of shown pixels of the given rectangle (glReadPixels with GL_DEPTH_COMPONENT) <br>
263 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;
264 //! Generate offscreen FBO (needs OpenGL2+ hardware) <br>
265 //! If not supported on hardware returns NULL. <br>
266 Standard_EXPORT Graphic3d_PtrFrameBuffer FBOCreate (const Graphic3d_CView& view, const Standard_Integer width, const Standard_Integer height);
267 //! Remove offscreen FBO <br>
268 Standard_EXPORT void FBORelease (const Graphic3d_CView& view, Graphic3d_PtrFrameBuffer& fboPtr);
269 //! Dump active rendering buffer into specified memory buffer. <br>
270 Standard_EXPORT Standard_Boolean BufferDump (const Graphic3d_CView& view, Image_CRawBufferData& buffer);
271 Standard_EXPORT void SetGLLightEnabled (const Graphic3d_CView& view,const Standard_Boolean isEnabled) const;
272 Standard_EXPORT Standard_Boolean IsGLLightEnabled (const Graphic3d_CView& view) const;
273 //! Clear visualization data in graphical driver and stop <br>
274 //! displaying the primitives array of the graphical group <theCGroup>. <br>
275 //! This method is internal and should be used by Graphic3d_Group only. <br>
276 Standard_EXPORT void RemovePrimitiveArray(const Graphic3d_CGroup& theCGroup,const Graphic3d_PrimitiveArray& thePArray);
277 Standard_EXPORT Standard_Integer InquirePlaneLimit();
278 Standard_EXPORT Standard_Integer CreateTexture(const Graphic3d_TypeOfTexture Type,const Handle(AlienImage_AlienImage)& Image,const Standard_CString FileName,const Handle(TColStd_HArray1OfReal)& TexUpperBounds) const;
279 Standard_EXPORT void DestroyTexture(const Standard_Integer TexId) const;
280 Standard_EXPORT void ModifyTexture(const Standard_Integer TexId,const Graphic3d_CInitTexture& AValue) const;
281 Standard_EXPORT Standard_ShortReal DefaultTextHeight() const;
282 Standard_EXPORT void FBOGetDimensions(const Graphic3d_CView& view,const Graphic3d_PtrFrameBuffer fboPtr,Standard_Integer& width,Standard_Integer& height,Standard_Integer& widthMax,Standard_Integer& heightMax);
283 Standard_EXPORT void FBOChangeViewport(const Graphic3d_CView& view,Graphic3d_PtrFrameBuffer& fboPtr,const Standard_Integer width,const Standard_Integer height);
284 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);
59f45b7c 285
286 //! Add a new top-level z layer with ID <theLayerId> for <br>
287 //! the view. Z layers allow drawing structures in higher layers <br>
288 //! in foreground of structures in lower layers. To add a structure <br>
289 //! to desired layer on display it is necessary to set the layer <br>
290 //! index for the structure. <br>
291 Standard_EXPORT void AddZLayer(const Graphic3d_CView& theCView,
292 const Standard_Integer theLayerId);
293
294 //! Remove Z layer from the specified view. All structures <br>
295 //! displayed at the moment in layer will be displayed in default layer <br>
296 //! ( the bottom-level z layer ). To unset layer index from associated <br>
297 //! structures use method UnsetZLayer (...). <br>
298 Standard_EXPORT void RemoveZLayer(const Graphic3d_CView& theCView,
299 const Standard_Integer theLayerId);
300
301 //! Unset Z layer ID for all structures. The structure <br>
302 //! indexes will be set to default layer ( the bottom-level z layer with <br>
303 //! ID = 0 ). <br>
304 Standard_EXPORT void UnsetZLayer(const Standard_Integer theLayerId);
305
306 //! Change Z layer of a structure. The new z layer ID will <br>
307 //! be used to define the associated layer for structure on display. <br>
308 //! It is recommended to take care of redisplaying the structures already <br>
309 //! presented in view with previously set layer index. This is usually <br>
310 //! done by viewer manager. Z layers allow drawing structures in <br>
311 //! higher layers in foreground of structures in lower layers. <br>
312 Standard_EXPORT void ChangeZLayer(const Graphic3d_CStructure& theCStructure,
313 const Standard_Integer theLayerId);
314
315 //! Change Z layer of a structure already presented in view. <br>
316 //! It is recommended to update z layer of already <br>
317 //! displayed structures with this method before setting new z layer <br>
318 //! index to the structure. This is usually done by viewer manager. <br>
319 Standard_EXPORT void ChangeZLayer(const Graphic3d_CStructure& theCStructure,
320 const Graphic3d_CView& theCView,
321 const Standard_Integer theNewLayerId);
322
323 //! Get Z layer ID of the structure. If the structure doesn't exists in <br>
324 //! graphic driver, the method returns -1. <br>
325 Standard_EXPORT Standard_Integer GetZLayer(const Graphic3d_CStructure& theCStructure) const;
2166f0fa
SK
326
327public:
328
329 //! Returns true if VBO usage does not forbidden.
330 Standard_EXPORT static Standard_Boolean ToUseVBO();
331
332 //! VBO usage can be forbidden by this method even if it is supported by GL driver.
333 //! Notice that disabling of VBO will cause rendering performance degradation.
334 //! Warning! This method should be called only before any primitives are displayed in GL scene!
335 Standard_EXPORT void EnableVBO (const Standard_Boolean theToTurnOn);
336
337private:
338
339 //! Access the global map of views.
340 static NCollection_DataMap<Standard_Integer, Handle(OpenGl_View)>& GetMapOfViews();
341
342 //! Access the global map of workspaces.
343 static NCollection_DataMap<Standard_Integer, Handle(OpenGl_Workspace)>& GetMapOfWorkspaces();
344
345 //! Access the global map of structures.
346 static NCollection_DataMap<Standard_Integer, OpenGl_Structure*>& GetMapOfStructures();
347
348 //! Invalidates all workspaces - thus they will be redrawn on next update call.
349 static void InvalidateAllWorkspaces();
350
351public:
352
353 DEFINE_STANDARD_RTTI(OpenGl_GraphicDriver)
354};
355
356#endif //_OpenGl_GraphicDriver_HeaderFile