3 // File OpenGl_GraphicDriver_3.cxx
4 // Created Mardi 28 janvier 1997
7 //-Copyright MatraDatavision 1997
11 //-Design Declaration des variables specifiques aux Drivers
13 //-Warning Un driver encapsule les Pex et OpenGl drivers
22 #include <OpenGl_GraphicDriver.jxx>
24 #include <Aspect_DriverDefinitionError.hxx>
27 #include <OpenGl_tgl_funcs.hxx>
29 int GenerateMarkerBitmap( int theId, unsigned int theWidth, unsigned int theHeight, unsigned char* theArray);
33 //-Global data definitions
37 void OpenGl_GraphicDriver::ClearGroup (const Graphic3d_CGroup& ACGroup) {
39 Graphic3d_CGroup MyCGroup = ACGroup;
43 PrintFunction ("call_togl_cleargroup");
44 PrintCGroup (MyCGroup, 1);
46 call_togl_cleargroup (&MyCGroup);
50 void OpenGl_GraphicDriver::CloseGroup (const Graphic3d_CGroup& ACGroup) {
52 Graphic3d_CGroup MyCGroup = ACGroup;
55 PrintFunction ("call_togl_closegroup");
56 PrintCGroup (MyCGroup, 1);
58 call_togl_closegroup (&MyCGroup);
62 void OpenGl_GraphicDriver::FaceContextGroup (const Graphic3d_CGroup& ACGroup, const Standard_Integer NoInsert) {
64 Graphic3d_CGroup MyCGroup = ACGroup;
67 PrintFunction ("call_togl_facecontextgroup");
68 PrintCGroup (MyCGroup, 1);
69 PrintInteger ("NoInsert", NoInsert);
71 call_togl_facecontextgroup (&MyCGroup, int (NoInsert));
75 void OpenGl_GraphicDriver::Group (Graphic3d_CGroup& ACGroup) {
77 Graphic3d_CGroup MyCGroup = ACGroup;
80 PrintFunction ("call_togl_group");
81 PrintCGroup (MyCGroup, 1);
83 call_togl_group (&MyCGroup);
87 void OpenGl_GraphicDriver::LineContextGroup (const Graphic3d_CGroup& ACGroup, const Standard_Integer NoInsert) {
89 Graphic3d_CGroup MyCGroup = ACGroup;
92 PrintFunction ("call_togl_linecontextgroup");
93 PrintCGroup (MyCGroup, 1);
94 PrintInteger ("NoInsert", NoInsert);
96 call_togl_linecontextgroup (&MyCGroup, int (NoInsert));
100 void OpenGl_GraphicDriver::MarkerContextGroup (const Graphic3d_CGroup& ACGroup, const Standard_Integer NoInsert) {
102 Graphic3d_CGroup MyCGroup = ACGroup;
105 PrintFunction ("call_togl_markercontextgroup");
106 PrintCGroup (MyCGroup, 1);
107 PrintInteger ("NoInsert", NoInsert);
109 call_togl_markercontextgroup (&MyCGroup, int (NoInsert));
113 void 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 )
120 Graphic3d_CGroup MyCGroup = ACGroup;
122 int aByteWidth = AMarkWidth / 8;
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 );
129 GenerateMarkerBitmap( (int)ACGroup.ContextMarker.Scale, AMarkWidth, AMarkHeight, anArray );
131 PrintFunction ("call_togl_markercontextgroup");
132 PrintCGroup (MyCGroup, 1);
133 PrintInteger ("NoInsert", NoInsert);
135 call_togl_markercontextgroup (&MyCGroup, int (NoInsert));
141 void OpenGl_GraphicDriver::OpenGroup (const Graphic3d_CGroup& ACGroup) {
143 Graphic3d_CGroup MyCGroup = ACGroup;
146 PrintFunction ("call_togl_opengroup");
147 PrintCGroup (MyCGroup, 1);
149 call_togl_opengroup (&MyCGroup);
153 void OpenGl_GraphicDriver::RemoveGroup (const Graphic3d_CGroup& ACGroup) {
155 Graphic3d_CGroup MyCGroup = ACGroup;
158 PrintFunction ("call_togl_removegroup");
159 PrintCGroup (MyCGroup, 1);
161 call_togl_removegroup (&MyCGroup);
165 void OpenGl_GraphicDriver::TextContextGroup (const Graphic3d_CGroup& ACGroup, const Standard_Integer NoInsert) {
167 Graphic3d_CGroup MyCGroup = ACGroup;
170 PrintFunction ("call_togl_textcontextgroup");
171 PrintCGroup (MyCGroup, 1);
172 PrintInteger ("NoInsert", NoInsert);
174 call_togl_textcontextgroup (&MyCGroup, int (NoInsert));