2 // File OpenGl_GraphicDriver_Layer.cxx
3 // Created Mardi 3 novembre 1998
6 //-Copyright MatraDatavision 1998
10 //-Design Declaration des variables specifiques aux Drivers
12 //-Warning Un driver encapsule les Pex et OpenGl drivers
21 #include <OpenGl_GraphicDriver.jxx>
23 #include <Aspect_DriverDefinitionError.hxx>
25 #include <OpenGl_tgl_funcs.hxx>
30 //-Global data definitions
34 void OpenGl_GraphicDriver::Layer (Aspect_CLayer2d& ACLayer) {
35 Aspect_CLayer2d MyCLayer = ACLayer;
38 PrintFunction ("call_togl_layer2d");
39 PrintInteger ("ALayerType", int (ACLayer.layerType));
41 call_togl_layer2d (&MyCLayer);
44 cout << "OpenGl_GraphicDriver::Layer" << endl;
45 call_def_ptrLayer ptrLayer;
46 ptrLayer = (call_def_ptrLayer) MyCLayer.ptrLayer;
48 cout << "\tptrLayer == NULL" << endl;
50 cout << "\tptrLayer->listIndex = " << ptrLayer->listIndex << endl;
54 void OpenGl_GraphicDriver::RemoveLayer (const Aspect_CLayer2d& ACLayer) {
55 Aspect_CLayer2d MyCLayer = ACLayer;
58 PrintFunction ("call_togl_removelayer2d");
59 PrintInteger ("ALayerType", int (ACLayer.layerType));
61 call_togl_removelayer2d (&MyCLayer);
64 void OpenGl_GraphicDriver::BeginLayer (const Aspect_CLayer2d& ACLayer) {
65 Aspect_CLayer2d MyCLayer = ACLayer;
68 PrintFunction ("call_togl_begin_layer2d");
69 PrintInteger ("ALayerType", int (ACLayer.layerType));
71 call_togl_begin_layer2d (&MyCLayer);
74 void OpenGl_GraphicDriver::BeginPolygon2d () {
76 PrintFunction ("call_togl_begin_polygon2d");
78 call_togl_begin_polygon2d ();
81 void OpenGl_GraphicDriver::BeginPolyline2d () {
83 PrintFunction ("call_togl_begin_polyline2d");
85 call_togl_begin_polyline2d ();
88 void OpenGl_GraphicDriver::ClearLayer (const Aspect_CLayer2d& ACLayer) {
89 Aspect_CLayer2d MyCLayer = ACLayer;
92 PrintFunction ("call_togl_clear_layer2d");
93 PrintInteger ("ALayerType", int (ACLayer.layerType));
95 call_togl_clear_layer2d (&MyCLayer);
98 void OpenGl_GraphicDriver::Draw (const Standard_ShortReal X, const Standard_ShortReal Y) {
100 PrintFunction ("call_togl_draw2d");
101 PrintShortReal ("X", X);
102 PrintShortReal ("Y", Y);
104 call_togl_draw2d (X, Y);
107 void OpenGl_GraphicDriver::Edge (const Standard_ShortReal X, const Standard_ShortReal Y) {
109 PrintFunction ("call_togl_edge2d");
110 PrintShortReal ("X", X);
111 PrintShortReal ("Y", Y);
113 call_togl_edge2d (X, Y);
116 void OpenGl_GraphicDriver::EndLayer () {
118 PrintFunction ("call_togl_end_layer2d");
120 call_togl_end_layer2d ();
123 void OpenGl_GraphicDriver::EndPolygon2d () {
125 PrintFunction ("call_togl_end_polygon2d");
127 call_togl_end_polygon2d ();
130 void OpenGl_GraphicDriver::EndPolyline2d () {
132 PrintFunction ("call_togl_end_polyline2d");
134 call_togl_end_polyline2d ();
137 void OpenGl_GraphicDriver::Move (const Standard_ShortReal X, const Standard_ShortReal Y) {
139 PrintFunction ("call_togl_move2d");
140 PrintShortReal ("X", X);
141 PrintShortReal ("Y", Y);
143 call_togl_move2d (X, Y);
146 void OpenGl_GraphicDriver::Rectangle (const Standard_ShortReal X, const Standard_ShortReal Y, const Standard_ShortReal Width, const Standard_ShortReal Height) {
148 PrintFunction ("call_togl_rectangle2d");
149 PrintShortReal ("X", X);
150 PrintShortReal ("Y", Y);
151 PrintShortReal ("Width", Width);
152 PrintShortReal ("Height", Height);
154 call_togl_rectangle2d (X, Y, Width, Height);
157 void OpenGl_GraphicDriver::SetColor (const Standard_ShortReal R, const Standard_ShortReal G, const Standard_ShortReal B) {
159 PrintFunction ("call_togl_set_color");
160 PrintShortReal ("R", R);
161 PrintShortReal ("G", G);
162 PrintShortReal ("B", B);
164 call_togl_set_color (R, G, B);
167 void OpenGl_GraphicDriver::SetTransparency (const Standard_ShortReal ATransparency) {
169 PrintFunction ("call_togl_set_transparency");
170 PrintShortReal ("Transparency", ATransparency);
172 call_togl_set_transparency (ATransparency);
175 void OpenGl_GraphicDriver::UnsetTransparency () {
177 PrintFunction ("call_togl_unset_transparency");
179 call_togl_unset_transparency ();
182 void OpenGl_GraphicDriver::SetLineAttributes (const Standard_Integer Type, const Standard_ShortReal Width) {
184 PrintFunction ("call_togl_set_line_attributes");
185 PrintInteger ("Type", Type);
186 PrintShortReal ("Width", Width);
188 call_togl_set_line_attributes (Type, Width);
191 void OpenGl_GraphicDriver::SetTextAttributes (const Standard_CString Font, const Standard_Integer AType, const Standard_ShortReal R, const Standard_ShortReal G, const Standard_ShortReal B) {
193 PrintFunction ("call_togl_set_text_attributes");
194 PrintString ("Font", Font);
195 PrintInteger ("Type", AType);
196 PrintShortReal ("R", R);
197 PrintShortReal ("G", G);
198 PrintShortReal ("B", B);
200 call_togl_set_text_attributes ((Tchar*)Font, AType, R, G, B);
203 void OpenGl_GraphicDriver::Text (const Standard_CString AText, const Standard_ShortReal X, const Standard_ShortReal Y, const Standard_ShortReal Height) {
205 PrintFunction ("call_togl_text2d");
206 PrintString ("Text", AText);
207 PrintShortReal ("X", X);
208 PrintShortReal ("Y", Y);
209 PrintShortReal ("Height", Height);
211 Standard_ShortReal h = Height;
213 h = DefaultTextHeight();
214 call_togl_text2d ((char *)AText, X, Y, h);
217 void OpenGl_GraphicDriver::TextSize (const Standard_CString AText, const Standard_ShortReal AHeight, Standard_ShortReal& AWidth, Standard_ShortReal& AnAscent, Standard_ShortReal& ADescent) const {
218 call_togl_textsize2d ((char *) AText, AHeight, &AWidth, &AnAscent, &ADescent);
220 PrintFunction ("call_togl_textsize2d");
221 PrintString ("Text", AText);
222 PrintShortReal ("AHeight", AHeight);
223 PrintShortReal ("AWidth", AWidth);
224 PrintShortReal ("AnAscent", AnAscent);
225 PrintShortReal ("ADescent", ADescent);