0022792: Globally defined symbol PI conflicts with VTK definition (Intel compiler)
[occt.git] / src / OpenGl / OpenGl_GraphicDriver_3.cxx
CommitLineData
7fd59977 1
2
3// File OpenGl_GraphicDriver_3.cxx
4// Created Mardi 28 janvier 1997
5// Author CAL
6
7//-Copyright MatraDatavision 1997
8
9//-Version
10
11//-Design Declaration des variables specifiques aux Drivers
12
13//-Warning Un driver encapsule les Pex et OpenGl drivers
14
15//-References
16
17//-Language C++ 2.0
18
19//-Declarations
20
21// for the class
22#include <OpenGl_GraphicDriver.jxx>
23
24#include <Aspect_DriverDefinitionError.hxx>
25
26
27#include <OpenGl_tgl_funcs.hxx>
28
29int GenerateMarkerBitmap( int theId, unsigned int theWidth, unsigned int theHeight, unsigned char* theArray);
30
31//-Aliases
32
33//-Global data definitions
34
35//-Methods, in order
36
37void OpenGl_GraphicDriver::ClearGroup (const Graphic3d_CGroup& ACGroup) {
38
39 Graphic3d_CGroup MyCGroup = ACGroup;
40
41 if (MyTraceLevel)
42 {
43 PrintFunction ("call_togl_cleargroup");
44 PrintCGroup (MyCGroup, 1);
45 }
46 call_togl_cleargroup (&MyCGroup);
47
48}
49
50void OpenGl_GraphicDriver::CloseGroup (const Graphic3d_CGroup& ACGroup) {
51
52 Graphic3d_CGroup MyCGroup = ACGroup;
53
54 if (MyTraceLevel) {
55 PrintFunction ("call_togl_closegroup");
56 PrintCGroup (MyCGroup, 1);
57 }
58 call_togl_closegroup (&MyCGroup);
59
60}
61
62void OpenGl_GraphicDriver::FaceContextGroup (const Graphic3d_CGroup& ACGroup, const Standard_Integer NoInsert) {
63
64 Graphic3d_CGroup MyCGroup = ACGroup;
65
66 if (MyTraceLevel) {
67 PrintFunction ("call_togl_facecontextgroup");
68 PrintCGroup (MyCGroup, 1);
69 PrintInteger ("NoInsert", NoInsert);
70 }
71 call_togl_facecontextgroup (&MyCGroup, int (NoInsert));
72
73}
74
75void OpenGl_GraphicDriver::Group (Graphic3d_CGroup& ACGroup) {
76
77 Graphic3d_CGroup MyCGroup = ACGroup;
78
79 if (MyTraceLevel) {
80 PrintFunction ("call_togl_group");
81 PrintCGroup (MyCGroup, 1);
82 }
83 call_togl_group (&MyCGroup);
84
85}
86
87void OpenGl_GraphicDriver::LineContextGroup (const Graphic3d_CGroup& ACGroup, const Standard_Integer NoInsert) {
88
89 Graphic3d_CGroup MyCGroup = ACGroup;
90
91 if (MyTraceLevel) {
92 PrintFunction ("call_togl_linecontextgroup");
93 PrintCGroup (MyCGroup, 1);
94 PrintInteger ("NoInsert", NoInsert);
95 }
96 call_togl_linecontextgroup (&MyCGroup, int (NoInsert));
97
98}
99
100void OpenGl_GraphicDriver::MarkerContextGroup (const Graphic3d_CGroup& ACGroup, const Standard_Integer NoInsert) {
101
102 Graphic3d_CGroup MyCGroup = ACGroup;
103
104 if (MyTraceLevel) {
105 PrintFunction ("call_togl_markercontextgroup");
106 PrintCGroup (MyCGroup, 1);
107 PrintInteger ("NoInsert", NoInsert);
108 }
109 call_togl_markercontextgroup (&MyCGroup, int (NoInsert));
110
111}
112
113void OpenGl_GraphicDriver::MarkerContextGroup (const Graphic3d_CGroup& ACGroup,
114 const Standard_Integer NoInsert,
115 const Standard_Integer AMarkWidth,
116 const Standard_Integer AMarkHeight,
117 const Handle(TColStd_HArray1OfByte)& ATexture )
118{
119
120 Graphic3d_CGroup MyCGroup = ACGroup;
121
122 int aByteWidth = AMarkWidth / 8;
123
124 unsigned char *anArray = (unsigned char*) malloc(ATexture->Length());
125 for( int anIndex = ATexture->Upper() - ATexture->Lower() - aByteWidth + 1; anIndex >= 0; anIndex -= aByteWidth )
126 for( int i = 0; i < aByteWidth; i++ )
127 anArray[ATexture->Upper() - ATexture->Lower() - aByteWidth + 1 - anIndex + i ] = ATexture->Value( anIndex + i + 1 );
128
129 GenerateMarkerBitmap( (int)ACGroup.ContextMarker.Scale, AMarkWidth, AMarkHeight, anArray );
130 if (MyTraceLevel) {
131 PrintFunction ("call_togl_markercontextgroup");
132 PrintCGroup (MyCGroup, 1);
133 PrintInteger ("NoInsert", NoInsert);
134 }
135 call_togl_markercontextgroup (&MyCGroup, int (NoInsert));
136
137 free(anArray);
138}
139
140
141void OpenGl_GraphicDriver::OpenGroup (const Graphic3d_CGroup& ACGroup) {
142
143 Graphic3d_CGroup MyCGroup = ACGroup;
144
145 if (MyTraceLevel) {
146 PrintFunction ("call_togl_opengroup");
147 PrintCGroup (MyCGroup, 1);
148 }
149 call_togl_opengroup (&MyCGroup);
150
151}
152
153void OpenGl_GraphicDriver::RemoveGroup (const Graphic3d_CGroup& ACGroup) {
154
155 Graphic3d_CGroup MyCGroup = ACGroup;
156
157 if (MyTraceLevel) {
158 PrintFunction ("call_togl_removegroup");
159 PrintCGroup (MyCGroup, 1);
160 }
161 call_togl_removegroup (&MyCGroup);
162
163}
164
165void OpenGl_GraphicDriver::TextContextGroup (const Graphic3d_CGroup& ACGroup, const Standard_Integer NoInsert) {
166
167 Graphic3d_CGroup MyCGroup = ACGroup;
168
169 if (MyTraceLevel) {
170 PrintFunction ("call_togl_textcontextgroup");
171 PrintCGroup (MyCGroup, 1);
172 PrintInteger ("NoInsert", NoInsert);
173 }
174 call_togl_textcontextgroup (&MyCGroup, int (NoInsert));
175
176}