OCC22354 Bug in Overlay Text rendering
[occt.git] / src / OpenGl / OpenGl_GraphicDriver_710.cxx
CommitLineData
7fd59977 1
2#define NOVIRTUAL
3
4// File OpenGl_GraphicDriver_710.cxx
5// Created Mardi 28 janvier 1997
6// Author CAL
7
8//-Copyright MatraDatavision 1997
9
10//-Version
11
12//-Design Declaration des variables specifiques aux Drivers
13
14//-Warning Un driver encapsule les Pex et OpenGl drivers
15
16//-References
17
18//-Language C++ 2.0
19
20//-Declarations
21
22// for the class
23#include <OpenGl_GraphicDriver.jxx>
24#include <TCollection_AsciiString.hxx>
25
26#include <Aspect_DriverDefinitionError.hxx>
27
28#include <OpenGl_tgl_funcs.hxx>
29
30//-Aliases
31
32//-Global data definitions
33
34//-Methods, in order
35
36void OpenGl_GraphicDriver::Text
37(
38 const Graphic3d_CGroup& ACGroup,
39 const Standard_CString AText,
40 const Graphic3d_Vertex& APoint,
41 const Standard_Real AHeight,
42 const Quantity_PlaneAngle AAngle,
43 const Graphic3d_TextPath ATp,
44 const Graphic3d_HorizontalTextAlignment AHta,
45 const Graphic3d_VerticalTextAlignment AVta,
46 const Standard_Boolean
47 )
48{
49
50
51 Graphic3d_CGroup MyCGroup = ACGroup;
52
53 Standard_Real X, Y, Z;
54
55 CALL_DEF_TEXT atext;
56 APoint.Coord (X, Y, Z);
57 atext.Position.x = float (X);
58 atext.Position.y = float (Y);
59 atext.Position.z = float (Z);
60 atext.Height = float (AHeight);
61 if (atext.Height < 0)
62 atext.Height = DefaultTextHeight();
63 atext.Angle = float (AAngle);
64 atext.Path = int (ATp);
65 atext.HAlign = int (AHta);
66 atext.VAlign = int (AVta);
67 atext.string = (char *) AText;
68
69 if (MyTraceLevel) {
70 PrintFunction ("call_togl_text");
71 PrintCGroup (MyCGroup, 1);
72 }
73 call_togl_text (&MyCGroup, &atext);
74
75}
76
77void OpenGl_GraphicDriver::Text
78(
79 const Graphic3d_CGroup& ACGroup,
80 const Standard_CString AText,
81 const Graphic3d_Vertex& APoint,
82 const Standard_Real AHeight,
83 const Standard_Boolean
84 )
85{
86
87
88 Graphic3d_CGroup MyCGroup = ACGroup;
89
90 Standard_Real X, Y, Z;
91
92 CALL_DEF_TEXT atext;
93 APoint.Coord (X, Y, Z);
94 atext.Position.x = float (X);
95 atext.Position.y = float (Y);
96 atext.Position.z = float (Z);
97 atext.Height = float (AHeight);
98 if (atext.Height < 0)
99 atext.Height = DefaultTextHeight();
100 atext.Angle = float (Standard_PI / 2.);
101 atext.Path = int (Graphic3d_TP_RIGHT);
102 atext.HAlign = int (Graphic3d_HTA_LEFT);
103 atext.VAlign = int (Graphic3d_VTA_BOTTOM);
104 atext.string = (char *) AText;
105
106 if (MyTraceLevel) {
107 PrintFunction ("call_togl_text");
108 PrintCGroup (MyCGroup, 1);
109 }
110 call_togl_text (&MyCGroup, &atext);
111
112}
113
114void OpenGl_GraphicDriver::Text
115(
116 const Graphic3d_CGroup& ACGroup,
117 const TCollection_ExtendedString& AText,
118 const Graphic3d_Vertex& APoint,
119 const Standard_Real AHeight,
120 const Quantity_PlaneAngle AAngle,
121 const Graphic3d_TextPath ATp,
122 const Graphic3d_HorizontalTextAlignment AHta,
123 const Graphic3d_VerticalTextAlignment AVta,
124 const Standard_Boolean
125 )
126{
127
128
129 Graphic3d_CGroup MyCGroup = ACGroup;
130
131 Standard_Real X, Y, Z;
132 CALL_DEF_TEXT atext;
133 TCollection_AsciiString ascii (AText,'?');
134
135 APoint.Coord (X, Y, Z);
136 atext.Position.x = float (X);
137 atext.Position.y = float (Y);
138 atext.Position.z = float (Z);
139 atext.Height = float (AHeight);
140 if (atext.Height < 0)
141 atext.Height = DefaultTextHeight();
142 atext.Angle = float (AAngle);
143 atext.Path = int (ATp);
144 atext.HAlign = int (AHta);
145 atext.VAlign = int (AVta);
146 atext.string = (Standard_PCharacter)ascii.ToCString ();
147
148 if (MyTraceLevel) {
149 PrintFunction ("call_togl_text");
150 PrintCGroup (MyCGroup, 1);
151 }
152 call_togl_text (&MyCGroup, &atext);
153 ascii.Clear ();
154
155}
156
157void OpenGl_GraphicDriver::Text
158(
159 const Graphic3d_CGroup& ACGroup,
160 const TCollection_ExtendedString& AText,
161 const Graphic3d_Vertex& APoint,
162 const Standard_Real AHeight,
163 const Standard_Boolean
164 ) {
165
166
167 Graphic3d_CGroup MyCGroup = ACGroup;
168
169 Standard_Real X, Y, Z;
170 CALL_DEF_TEXT atext;
171 TCollection_AsciiString ascii (AText, '?');
172
173 APoint.Coord (X, Y, Z);
174 atext.Position.x = float (X);
175 atext.Position.y = float (Y);
176 atext.Position.z = float (Z);
177 atext.Height = float (AHeight);
178 if (atext.Height < 0)
179 atext.Height = DefaultTextHeight();
180 atext.Angle = float (Standard_PI / 2.);
181 atext.Path = int (Graphic3d_TP_RIGHT);
182 atext.HAlign = int (Graphic3d_HTA_LEFT);
183 atext.VAlign = int (Graphic3d_VTA_BOTTOM);
184 atext.string = (Standard_PCharacter)ascii.ToCString ();
185
186 if (MyTraceLevel) {
187 PrintFunction ("call_togl_text");
188 PrintCGroup (MyCGroup, 1);
189 }
190 call_togl_text (&MyCGroup, &atext);
191 ascii.Clear ();
192
193 }