1 // Created on: 2011-09-20
2 // Created by: Sergey ZERCHANINOV
3 // Copyright (c) 2011-2012 OPEN CASCADE SAS
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.
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.
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.
20 #ifndef _OpenGl_Display_Header
21 #define _OpenGl_Display_Header
23 #include <Handle_OpenGl_Display.hxx>
24 #include <MMgt_TShared.hxx>
26 #include <Standard_CString.hxx>
27 #include <TColStd_HArray1OfByte.hxx>
28 #include <NCollection_DataMap.hxx>
30 #include <Aspect_Display.hxx>
31 #include <Aspect_DisplayConnection.hxx>
32 #include <Aspect_Drawable.hxx>
33 #include <Aspect_TypeOfLine.hxx>
34 #include <Aspect_TypeOfMarker.hxx>
36 #include <Font_FontAspect.hxx>
38 #include <InterfaceGraphic_telem.hxx>
40 #include <Handle_OpenGl_Window.hxx>
42 struct OpenGl_Facilities
52 class OpenGl_AspectText;
53 struct OpenGl_TextParam;
55 class OpenGl_Display : public MMgt_TShared
58 OpenGl_Display (const Handle(Aspect_DisplayConnection)& theDisplayConnection);
59 virtual ~OpenGl_Display ();
61 Aspect_Display GetDisplay () const { return myDisplay; }
63 Handle(OpenGl_Window) GetWindow (const Aspect_Drawable AParent) const;
64 void SetWindow (const Aspect_Drawable AParent, const Handle(OpenGl_Window) &AWindow);
66 const OpenGl_Facilities & Facilities () const { return myFacilities; }
68 Standard_Boolean DBuffer () const { return myDBuffer; }
69 Standard_Boolean Dither () const { return myDither; }
70 Standard_Boolean BackDither () const { return myBackDither; }
71 Standard_Boolean Walkthrough () const { return myWalkthrough; }
72 Standard_Boolean SymPerspective() const { return mySymPerspective; }
73 Standard_Boolean PolygonOffset (Standard_ShortReal &AFactor, Standard_ShortReal &AUnits) const
75 AFactor = myOffsetFactor;
76 AUnits = myOffsetUnits;
79 Standard_Integer AntiAliasingMode () const { return myAntiAliasingMode; }
83 void InitAttributes ();
85 void SetTypeOfLine (const Aspect_TypeOfLine AType) const;
87 void SetTypeOfHatch (const int AType) const;
89 friend class OpenGl_Window;
93 DEFINE_STANDARD_RTTI(OpenGl_Display)
99 void ExportText (const wchar_t *text, const int is2d, const float x, const float y, const float z, const OpenGl_AspectText *aspect, const OpenGl_TextParam *param, const short height);
102 static void getGL2PSFontName(const char *src_font, char *ps_font);
105 Aspect_Display myDisplay;
106 OpenGl_Facilities myFacilities;
108 Standard_Boolean myDBuffer;
109 Standard_Boolean myDither;
110 Standard_Boolean myBackDither;
111 Standard_Boolean myWalkthrough;
112 Standard_Boolean mySymPerspective;
113 Standard_ShortReal myOffsetFactor;
114 Standard_ShortReal myOffsetUnits;
115 Standard_Integer myAntiAliasingMode;
117 #if (defined(_WIN32) || defined(__WIN32__))
118 NCollection_DataMap<Aspect_Drawable, Handle(OpenGl_Window)> myMapOfWindows;
120 NCollection_DataMap<Standard_Integer, Handle(OpenGl_Window)> myMapOfWindows;
123 unsigned int myLinestyleBase;
124 unsigned int myPatternBase;
127 DEFINE_STANDARD_ALLOC
130 extern Handle(OpenGl_Display) openglDisplay;
132 #endif //OpenGl_Workspace_Header