1 /***********************************************************************
5 file OpenGl_undefined :
12 HISTORIQUE DES MODIFICATIONS :
13 --------------------------------
14 xx-xx-xx : xxx ; Creation.
15 20-02-96 : FMN ; Suppression code inutile:
16 01-04-96 : CAL ; Integration MINSK portage WNT
17 22-04-96 : FMN ; Suppression prototype inutile.
18 25-06-96 : FMN ; Suppression utilisation de glScissor.
19 02-07-96 : FMN ; Modification parametre glViewport.
20 21-10-96 : FMN ; Suppression LMC_COLOR fait dans OpenGl_execstruct.c
21 04-02-97 : FMN ; Suppression call_togl_ps, call_togl_xwd ...
22 02-04-97 : FMN ; Correction call_tox_rect, on repasse en GL_BACK a la fin.call_tox_rect
23 05-01-98 : FMN ; Suppression WNT inutile
24 Suppression call_tox_set_colormap_mapping()
26 ************************************************************************/
28 /*----------------------------------------------------------------------*/
36 #include <OpenGl_tgl_all.hxx>
42 # include <InterfaceGraphic_WNT.hxx>
45 #include <InterfaceGraphic_Aspect.hxx>
46 #include <InterfaceGraphic_Graphic3d.hxx>
47 #include <InterfaceGraphic_Visual3d.hxx>
49 #include <OpenGl_txgl.hxx>
50 #include <OpenGl_tgl_tox.hxx>
51 #include <OpenGl_tsm.hxx>
52 #include <OpenGl_tsm_ws.hxx>
53 #include <OpenGl_telem_view.hxx>
54 #include <OpenGl_telem_util.hxx>
55 #include <OpenGl_telem_inquire.hxx>
56 #include <OpenGl_tgl_elems.hxx>
57 #include <OpenGl_tgl_funcs.hxx>
59 /*static GLboolean lighting_mode;*/
60 extern DISPLAY *call_thedisplay;
66 /*----------------------------------------------------------------------*/
73 #define CALL_DEF_BUFFER_SIZE 1024
74 #define CALL_DEF_STRING_LENGTH 132
76 /*----------------------------------------------------------------------*/
77 EXPORT void call_togl_build_matrix (
78 CALL_DEF_VIEW * aview,
79 CALL_DEF_MATRIX4X4 gl_ori_matrix, CALL_DEF_MATRIX4X4 gl_map_matrix,
80 CALL_DEF_MATRIX4X4 eval_ori_matrix, CALL_DEF_MATRIX4X4 eval_map_matrix )
86 gl_ori_matrix[i][j] = ( float )1.0;
87 gl_map_matrix[i][j] = ( float )1.0;
88 eval_ori_matrix[i][j] = ( float )1.0;
89 eval_map_matrix[i][j] = ( float )1.0;
92 gl_ori_matrix[i][j] = ( float )0.0;
93 gl_map_matrix[i][j] = ( float )0.0;
94 eval_ori_matrix[i][j] = ( float )0.0;
95 eval_map_matrix[i][j] = ( float )0.0;
99 /*----------------------------------------------------------------------*/
100 EXPORT void call_togl_element_type (
106 Pint err_ind; /* OUT error indicator */
107 Pint size; /* OUT element size */
108 Pint type; /* OUT element type */
109 Pint cur_index; /* OUT element pointer value */
112 call_func_open_struct (Id);
113 call_func_set_elem_ptr (elem_num);
114 call_func_inq_elem_ptr (&err_ind, &cur_index);
115 /* it is not the end */
116 if ((elem_num==cur_index) && (! err_ind)) {
117 call_func_inq_cur_elem_type_size
118 (&err_ind, &type, &size);
119 if (err_ind) type = 0;
121 call_func_close_struct ();
125 case CALL_PHIGS_ELEM_POLYLINE3 :
126 case CALL_PHIGS_ELEM_POLYLINE :
127 case CALL_PHIGS_ELEM_POLYLINE_SET3_DATA :
131 case CALL_PHIGS_ELEM_FILL_AREA3 :
132 case CALL_PHIGS_ELEM_FILL_AREA :
133 case CALL_PHIGS_ELEM_FILL_AREA_SET3 :
134 case CALL_PHIGS_ELEM_FILL_AREA_SET :
135 case CALL_PHIGS_ELEM_FILL_AREA_SET3_DATA :
136 case CALL_PHIGS_ELEM_SET_OF_FILL_AREA_SET3_DATA :
140 case CALL_PHIGS_ELEM_TRI_STRIP3_DATA :
144 case CALL_PHIGS_ELEM_QUAD_MESH3_DATA :
148 case CALL_PHIGS_ELEM_TEXT3 :
149 case CALL_PHIGS_ELEM_TEXT :
150 case CALL_PHIGS_ELEM_ANNO_TEXT_REL3 :
151 case CALL_PHIGS_ELEM_ANNO_TEXT_REL :
155 case CALL_PHIGS_ELEM_POLYMARKER3 :
156 case CALL_PHIGS_ELEM_POLYMARKER :
172 call_func_open_struct (Id);
173 call_func_set_elem_ptr (elem_num);
174 if( TsmGetCurElemPtr( &cur_index ) == TFailure )
176 /* it is not the end */
177 if ((elem_num==cur_index) && (! err_ind))
178 TelInqCurElemTypeSize( &type, &size );
179 call_func_close_struct ();
183 case CALL_PHIGS_ELEM_POLYLINE_SET3_DATA :
187 case CALL_PHIGS_ELEM_FILL_AREA3 :
188 case CALL_PHIGS_ELEM_FILL_AREA_SET3 :
192 case CALL_PHIGS_ELEM_TRI_STRIP3_DATA :
196 case CALL_PHIGS_ELEM_QUAD_MESH3_DATA :
200 case CALL_PHIGS_ELEM_ANNO_TEXT_REL3 :
205 case CALL_PHIGS_ELEM_POLYMARKER3 :
216 /*----------------------------------------------------------------------*/
217 EXPORT int call_togl_inquiremat (
218 CALL_DEF_VIEW * aview,
219 CALL_DEF_MATRIX4X4 ori_matrix,
220 CALL_DEF_MATRIX4X4 map_matrix )
226 TelGetViewRepresentation( aview->WsId, aview->ViewId, &rep );
227 if(aview->Orientation.IsCustomMatrix) {
228 /* OCC18942: Trying to return the current matrices instead of calculating them anew.
229 This in particular allows using application-defined matrices. */
231 memcpy( &map.win, &rep.extra.map.window, sizeof( Tlimit ) );
232 memcpy( &map.proj_vp, &rep.extra.map.viewport, sizeof( Tlimit3 ) );
233 switch(rep.extra.map.proj){
235 case TelParallel : map.proj_type = TYPE_PARAL; break;
236 case TelPerspective : map.proj_type = TYPE_PERSPECT; break;
238 map.proj_ref_point.x = rep.extra.map.prp[0];
239 map.proj_ref_point.y = rep.extra.map.prp[1];
240 map.proj_ref_point.z = rep.extra.map.prp[2];
241 map.view_plane = rep.extra.map.vpd;
242 map.back_plane = rep.extra.map.bpd;
243 map.front_plane = rep.extra.map.fpd;
245 call_func_eval_ori_matrix3( (point3 *)rep.extra.vrp,
246 (vec3 *)rep.extra.vpn,
247 (vec3 *)rep.extra.vup,
248 &error, rep.orientation_matrix );
252 call_func_eval_map_matrix3( &map, &error, rep.mapping_matrix );
257 for( i = 0; i < 4; i++ )
258 for( j = 0; j < 4; j++ )
260 ori_matrix[i][j] = rep.orientation_matrix[j][i];
261 map_matrix[i][j] = rep.mapping_matrix[j][i];
267 /*----------------------------------------------------------------------*/
268 int call_tox_window_exists ( WINDOW w )
273 /*----------------------------------------------------------------------*/
275 call_tox_rect( int wsid, WINDOW win, int u, int v )
281 float r[3] = { ( float )0.0, ( float )1.0, ( float )1.0 };
283 TsmGetWSAttri( wsid, WSWidth, &k );
285 TsmGetWSAttri( wsid, WSHeight, &k );
288 TxglWinset( call_thedisplay, win );
289 glViewport( 0, 0, w, h);
290 glMatrixMode( GL_MODELVIEW );
292 glMatrixMode(GL_PROJECTION);
294 glOrtho( 0.0, ( GLdouble ) w, 0.0, ( GLdouble ) h, -100000.0, 100000.0 );
296 p[0] = ( float )(u-STEP);
297 p[1] = ( float )(v-STEP);
298 p[2] = ( float )(-9999.0);
299 glDrawBuffer(GL_FRONT) ;
303 p[0] = ( float )(u+STEP);
305 p[1] = ( float )(v+STEP);
307 p[0] = ( float )(u-STEP);
313 glDrawBuffer(GL_BACK) ;
316 /*----------------------------------------------------------------------*/
318 #if !defined(GLU_VERSION_1_2)
319 void gluTessBeginContour() {
320 printf(" UNIMPLEMENTED function gluTessBeginContour()\n");
322 void gluTessBeginPolygon() {
323 printf(" UNIMPLEMENTED function gluTessBeginPolygon()\n");
325 void gluTessEndPolygon() {
326 printf(" UNIMPLEMENTED function gluTessEndPolygon()\n");
328 void gluTessEndContour() {
329 printf(" UNIMPLEMENTED function gluTessEndContour()\n");
333 /*----------------------------------------------------------------------*/