1 /***********************************************************************
10 Le main TestOfDesktop.c permet de tester cette classe.
17 HISTORIQUE DES MODIFICATIONS :
18 --------------------------------
19 xx-xx-xx : xxx ; Creation.
20 07-02-96 : FMN ; Suppression code inutile:
21 - TxglLink() et TxglUnlink()
22 19-03-96 : CAL ; Ajout de la fonction subr_resize.
23 appele par togl_ratio_window
24 21-03-96 : CAL ; Dans subr_doublebuffer et subr_open_ws
25 retrait des lignes qui donnaient un background
27 01-04-96 : CAL ; Integration MINSK portage WNT
28 02-07-96 : FMN ; Suppression WSWSHeight, WSWSWidth et WSType
29 17-07-96 : FMN ; Modification de call_subr_hlhsr().
30 18-07-96 : FMN ; Ajout appel TxglWinset() pour le Resize.
31 01-08-96 : FMN ; Ajout appel reaffichage dans le resize.
32 25-11-96 : FMN ; PRO6577: Ajout WSUpdateState pour call_subr_set_background.
33 29-01-97 : FMN ; Suppression de call_subr_doublebuffer().
34 05-02-97 : FMN ; Suppression variables inutiles.
35 12-02-97 : FMN ; Suppression de call_facilities_list.DepthCueing
36 14-02-97 : FMN ; Ajout WSUpdateState pour call_subr_transparency.
37 30-06-97 : FMN ; Appel de la toolkit OpenGl_LightBox.
38 02-07-97 : FMN ; Ajout init generale par contexte.
39 (GL_POLYGON_OFFSET_EXT, glLightModelf, glHint).
40 03-07-97 : FMN ; Test Headlight.
41 08-09-97 : CAL ; subr_open_ws retourne 0 si pb. (gere par togl_view)
42 07-10-97 : FMN ; Simplification WNT
43 03-10-97 : FMN ; Meilleure gestion des EXT, ajout QueryExtension
44 17-11-97 : FMN ; Suppression redraw sur le resize.
45 05-12-97 : FMN ; Double gestion du glPolygonOffsetEXT
46 17-12-97 : FMN ; Probleme compilation SGI
47 03-03-98 : FMN ; Simplification gestion du glPolygonOffsetEXT
48 15-03-98 : FMN ; Suppression variable WSNeedsClear
49 17-03-98 : FMN ; Ajout mode animation
50 08-07-98 : FMN ; Changement du nom de la primitive call_togl_erase_immediat_mode()
51 -> call_togl_erase_animation_mode.
52 22-10-98 : FMN ; Amelioration des perfs: glHint utilise GL_FASTEST.
53 14-12-98 : BGN; Developpement (S3989, Phase "triedre")
54 29-03-01 : GG; glPolygonOffsetEXT is no more available
56 20-08-01 : GG ; Add functions call_subr_enable_polygon_offset ()
57 and call_subr_disable_polygon_offset ()
59 ************************************************************************/
62 #define BUC60579 /*GG_240999 Under WNT,resets the ws attributes for each
63 // created view-manager and not only for the first
67 #define IMP190100 /*GG Reverse the front & back depth cueing planes
71 #define RIC120302 /*GG Use TxglSetWindow instead TxglCreateWindow
72 // when a GLXContext is given
73 // Add call_subr_displayCB function
76 #define BUC61044 /* 25/10/01 SAV ; added functionality to control gl depth testing
78 #define BUC61045 /* 25/10/01 SAV ; added functionality to control gl lighting
81 #define OCC1188 /*SAV added control of the background image*/
83 /*----------------------------------------------------------------------*/
90 #include <OpenGl_tgl_all.hxx>
93 #include <InterfaceGraphic.hxx>
94 #include <InterfaceGraphic_Labels.hxx>
95 #include <InterfaceGraphic_Graphic3d.hxx>
96 #include <InterfaceGraphic_Visual3d.hxx>
98 #include <OpenGl_inquire.hxx>
100 #include <OpenGl_Extension.hxx>
102 #include <OpenGl_cmn_varargs.hxx>
103 #include <OpenGl_tsm.hxx>
104 #include <OpenGl_tsm_ws.hxx>
105 #include <OpenGl_telem_view.hxx>
106 #include <OpenGl_telem_util.hxx>
107 #include <OpenGl_telem_pick.hxx>
108 #include <OpenGl_LightBox.hxx>
109 #include <OpenGl_telem_highlight.hxx>
110 #include <OpenGl_telem_depthcue.hxx>
111 #include <OpenGl_txgl.hxx>
112 #include <OpenGl_tgl_subrvis.hxx>
113 #include <OpenGl_tgl_pick.hxx>
114 #include <OpenGl_tgl_funcs.hxx>
115 #include <OpenGl_telem_filters.hxx>
116 #include <OpenGl_tgl_tox.hxx>
117 #include <OpenGl_tgl.hxx>
118 #include <OpenGl_animation.hxx>
119 #include <OpenGl_triedron.hxx>
120 #include <OpenGl_tgl_util.hxx>
121 #include <OpenGl_Memory.hxx>
122 #include <OpenGl_graduatedtrihedron.hxx>
123 #include <OpenGl_ResourceCleaner.hxx>
124 #include <OpenGl_ResourceTexture.hxx>
126 /*----------------------------------------------------------------------*/
131 static Tint attri_init = 0;
133 /*----------------------------------------------------------------------*/
136 static Bool WaitForNotify(Display *d, XEvent *e, char *arg) {
137 return (e->type == MapNotify) && (e->xmap.window == (Window)arg);
141 /*----------------------------------------------------------------------*/
143 static int offsetStatus=0;
144 #ifdef GL_EXT_polygon_offset
145 static GLfloat offsetFactor=1.0,offsetUnits=0.0;
146 #elif GL_POLYGON_OFFSET_EXT
147 static GLfloat offsetFactor=0.5,offsetUnits=0.0005;
149 void call_subr_enable_polygon_offset( )
151 if( offsetStatus < 0 ) return;
153 #ifdef GL_EXT_polygon_offset
154 if( offsetStatus == 0 ) {
155 if (QueryExtension("GL_EXT_polygon_offset")) {
157 if( call_util_osd_getenv ("CALL_OPENGL_POLYGON_OFFSET",
158 svalue,sizeof(svalue)) ) {
160 int n = sscanf(svalue,"%f %f",&v1,&v2);
161 if( n > 0 ) offsetFactor = v1;
162 if( n > 1 ) offsetUnits = v2;
163 printf(" $$$ CALL_OPENGL_POLYGON_OFFSET %f %f\n",
164 offsetFactor,offsetUnits);
172 if( offsetStatus > 0 ) {
173 #ifdef GL_POLYGON_OFFSET_FILL
174 glPolygonOffset(offsetFactor,offsetUnits);
175 glEnable(GL_POLYGON_OFFSET_FILL);
176 #elif GL_POLYGON_OFFSET_EXT
177 glPolygonOffsetEXT(offsetFactor,offsetUnits);
178 glEnable(GL_POLYGON_OFFSET_EXT);
183 #endif /* GL_EXT_polygon_offset */
187 call_subr_disable_polygon_offset( )
189 if( offsetStatus > 0 ) {
190 #ifdef GL_POLYGON_OFFSET_FILL
191 glDisable(GL_POLYGON_OFFSET_FILL);
192 #elif GL_POLYGON_OFFSET_EXT
193 glDisable(GL_POLYGON_OFFSET_EXT);
198 /*----------------------------------------------------------------------*/
201 call_subr_open_ws( CALL_DEF_VIEW * aview )
205 TEL_HIGHLIGHT hrep = { TelHLForcedColour, {{ ( float )1.0, ( float )1.0, ( float )1.0 }} };
206 TEL_DEPTHCUE dcrep = { TelDCSuppressed, {( float )0.0, ( float )1.0}, {( float )1.0, ( float )0.0}, {{( float )0.0, ( float )0.0, ( float )0.0}} };
208 Tfloat bgcolr, bgcolg, bgcolb; /* background color */
210 TSM_BG_TEXTURE bgTexture;
217 unsigned int newwidth, newheight, newbw, newdepth;
222 width = ( Tint )aview->DefWindow.dx;
223 height = ( Tint )aview->DefWindow.dy;
225 /* background color */
226 bgcolr = aview->DefWindow.Background.r,
227 bgcolg = aview->DefWindow.Background.g,
228 bgcolb = aview->DefWindow.Background.b;
231 if( aview->GContext )
232 win = TxglSetWindow( call_thedisplay, /*(HWND)*/(WINDOW)aview->DefWindow.XWindow,
233 /*(HGLRC)*/(GLCONTEXT)aview->GContext );
236 win = TxglCreateWindow( call_thedisplay, /*(HWND)*/(WINDOW)aview->DefWindow.XWindow,
237 0, 0, width, height, 0, bgcolr, bgcolg, bgcolb );
239 if( win != aview->DefWindow.XWindow ) {
240 XMapWindow( call_thedisplay, win );
241 XIfEvent(call_thedisplay, &event, WaitForNotify, (char *) win);
245 if( TxglWinset( call_thedisplay, (WINDOW) win ) == TFailure )
248 TsmRegisterWsid( aview->WsId );
249 data.ldata = (Tint) win;
250 TsmSetWSAttri( aview->WsId, WSWindow, &data );
253 call_thedisplay, win, &root,
254 &newx, &newy,&newwidth, &newheight, &newbw, &newdepth
259 GetClientRect ( win, &cr );
265 data.pdata = &bgTexture;
266 TsmSetWSAttri( aview->WsId, WSBgTexture, &data );
269 TsmSetWSAttri( aview->WsId, WSWidth, &data );
271 TsmSetWSAttri( aview->WsId, WSHeight, &data );
273 TsmSetWSAttri( aview->WsId, WSViewStid, &data );
275 TsmSetWSAttri( aview->WsId, WSDbuff, &data );
276 data.ldata = TNotDone;
277 TsmSetWSAttri( aview->WsId, WSUpdateState, &data );
279 TsmSetWSAttri( aview->WsId, WSTransparency, &data );
280 TelSetHighlightRep( aview->WsId, 0, &hrep );
281 TelSetDepthCueRep( aview->WsId, 0, &dcrep );
282 TelInitWS( aview->WsId, width, height, bgcolr, bgcolg, bgcolb );
285 /* 24/10/01 : SAV ; setting OGL depth testing enabled by default */
287 TsmSetWSAttri( aview->WsId, WSDepthTest, &data );
290 /* 24/10/01 : SAV ; setting flag to control GL_LIGHTING (used in triedron) */
292 TsmSetWSAttri( aview->WsId, WSGLLight, &data );
305 * Init generale du contexte
308 /* Eviter d'avoir les faces mal orientees en noir. */
309 /* Pourrait etre utiliser pour detecter les problemes d'orientation */
310 glLightModeli((GLenum)GL_LIGHT_MODEL_TWO_SIDE, GL_TRUE);
312 /* Optimisation pour le Fog et l'antialiasing */
313 glHint( GL_FOG_HINT, GL_FASTEST );
314 glHint( GL_POINT_SMOOTH_HINT, GL_FASTEST );
315 glHint( GL_LINE_SMOOTH_HINT, GL_FASTEST );
316 glHint( GL_POLYGON_SMOOTH_HINT, GL_FASTEST );
319 call_subr_enable_polygon_offset();
326 /*----------------------------------------------------------------------*/
329 call_subr_resize (CALL_DEF_VIEW * aview)
334 Tfloat bgcolr, bgcolg, bgcolb;
335 Tint wswidth, wsheight;
337 /* Tint swap = 1;*/ /* swap buffers ? yes */
343 unsigned int newwidth, newheight, newbw, newdepth;
349 printf("call_subr_resize \n");
351 /* Recuperation de la definition precedente de la ws */
352 TsmGetWSAttri (aview->WsId, WSWidth, &data);
353 wswidth = data.ldata;
354 TsmGetWSAttri (aview->WsId, WSHeight, &data);
355 wsheight = data.ldata;
356 TsmGetWSAttri (aview->WsId, WSViewStid, &data);
357 wsviewstid = data.ldata;
359 /* S'il s'agit du togl_ratio_window initial alors on ne fait rien */
360 if (wsviewstid == -1) return;
363 * Si l'on resize une fenetre qui a la meme taille que la taille
364 * precedente alors on ne fait rien
366 if ((wswidth == (Tint) aview->DefWindow.dx) &&
367 (wsheight == (Tint) aview->DefWindow.dy)) return;
370 TsmGetWSAttri (aview->WsId, WSWindow, &data);
373 XResizeWindow (call_thedisplay, win,
374 (unsigned int) aview->DefWindow.dx,
375 (unsigned int) aview->DefWindow.dy);
377 XSync (call_thedisplay, False);
379 /* Mettre a jour ses attributs */
380 XGetGeometry (call_thedisplay, win, &root,
381 &newx, &newy,&newwidth, &newheight, &newbw, &newdepth);
385 /* background color */
386 bgcolr = aview->DefWindow.Background.r,
387 bgcolg = aview->DefWindow.Background.g,
388 bgcolb = aview->DefWindow.Background.b;
390 /* Rendre courant le Drawable et le Context */
391 if (TxglWinset (call_thedisplay, (Window) win) == TSuccess) {
394 TsmSetWSAttri (aview->WsId, WSWidth, &data);
396 TsmSetWSAttri (aview->WsId, WSHeight, &data);
397 TelInitWS (aview->WsId, width, height, bgcolr, bgcolg, bgcolb);
402 /* On detruit l'ancienne sous-fenetre de la window graphique */
403 TsmGetWSAttri (aview->WsId, WSWindow, &data);
404 win = (WINDOW) data.ldata;
406 * On recree une nouvelle sous-fenetre de la window graphique
407 * avec la nouvelle dimension
409 /* background color */
410 bgcolr = aview->DefWindow.Background.r,
411 bgcolg = aview->DefWindow.Background.g,
412 bgcolb = aview->DefWindow.Background.b;
413 /* Rendre courant le Drawable et le Context */
414 if (TxglWinset (call_thedisplay, win) == TSuccess) {
415 //if (TxglWinset (call_thedisplay, GET_GL_CONTEXT()) == TSuccess) {
416 /* Mettre a jour la sous-fenetre associee */
417 /* Mettre a jour ses attributs */
418 GetClientRect ( win, &cr );
422 TsmSetWSAttri (aview->WsId, WSWidth, &data);
424 TsmSetWSAttri (aview->WsId, WSHeight, &data);
425 TelInitWS (aview->WsId, width, height, bgcolr, bgcolg, bgcolb);
432 /*----------------------------------------------------------------------*/
435 call_subr_antialiasing( CALL_DEF_VIEW * aview, Tint tag )
438 Tint fl = tag ? TOn : TOff;
440 call_func_set_edit_mode( TEditReplace );
441 call_func_open_struct( aview->ViewId );
442 call_func_set_elem_ptr(0);
443 call_func_set_elem_ptr_label(View_LABAliasing);
444 call_func_offset_elem_ptr(1);
446 TsmAddToStructure( TelAntiAliasing, 1, &k );
447 call_func_close_struct();
451 /*----------------------------------------------------------------------*/
454 call_subr_hlhsr( CALL_DEF_VIEW * aview, int tag )
458 data.ldata = (tag ? TOn : TOff);
459 TsmSetWSAttri( aview->WsId, WSZbuffer, &data );
464 /*----------------------------------------------------------------------*/
467 call_subr_depthcueing( CALL_DEF_VIEW * aview, Tint tag )
470 # define CALL_DEF_DEPTH_CUEING_INDEX 1
474 call_func_set_edit_mode(CALL_PHIGS_EDIT_REPLACE);
475 call_func_open_struct(aview->ViewId);
476 call_func_set_elem_ptr(0);
477 call_func_set_elem_ptr_label(View_LABDepthCueing);
478 call_func_offset_elem_ptr(1);
479 call_func_appl_data(0);
480 call_func_close_struct();
484 rep.mode = CALL_PHIGS_ALLOWED;
485 rep.planes[0] = aview->Context.DepthBackPlane;
486 rep.planes[1] = aview->Context.DepthFrontPlane;
488 printf(" $$$ DepthFrontPlane %f DepthBackPlane %f FrontPlaneDistance %f BackPlaneDistance %f\n",aview->Context.DepthFrontPlane,aview->Context.DepthBackPlane,aview->Mapping.FrontPlaneDistance,aview->Mapping.BackPlaneDistance);
492 (aview->Context.DepthFrontPlane -
493 aview->Mapping.BackPlaneDistance) /
495 (aview->Mapping.FrontPlaneDistance -
496 aview->Context.DepthFrontPlane) /
498 (aview->Mapping.FrontPlaneDistance -
499 aview->Mapping.BackPlaneDistance);
503 (aview->Context.DepthBackPlane -
504 aview->Mapping.BackPlaneDistance) /
506 (aview->Mapping.FrontPlaneDistance -
507 aview->Context.DepthBackPlane) /
509 (aview->Mapping.FrontPlaneDistance -
510 aview->Mapping.BackPlaneDistance);
512 if(rep.planes[0] < 0.)
513 rep.planes[0] = ( float )0.0;
514 else if(rep.planes[0] > 1.)
515 rep.planes[0] = ( float )1.0;
516 if(rep.planes[1] < 0.)
517 rep.planes[1] = ( float )0.0;
518 else if(rep.planes[1] > 1.)
519 rep.planes[1] = ( float )1.0;
521 if(rep.planes[1] > rep.planes[0])
523 rep.planes[1] = ( float )0.0;
524 rep.planes[0] = ( float )1.0;
527 if(rep.planes[0] > rep.planes[1])
529 rep.planes[0] = ( float )0.0;
530 rep.planes[1] = ( float )1.0;
535 printf(" plane[0] %f plane[1] %f\n",rep.planes[0],rep.planes[1]);
537 rep.scales[0] = ( float )1.;
538 rep.scales[1] = ( float )0.;
539 rep.col.rgb[0] = aview->DefWindow.Background.r;
540 rep.col.rgb[1] = aview->DefWindow.Background.g;
541 rep.col.rgb[2] = aview->DefWindow.Background.b;
542 TelSetDepthCueRep(aview->WsId, CALL_DEF_DEPTH_CUEING_INDEX, &rep);
544 call_func_set_edit_mode(CALL_PHIGS_EDIT_REPLACE);
545 call_func_open_struct(aview->ViewId);
546 call_func_set_elem_ptr(0);
547 call_func_set_elem_ptr_label(View_LABDepthCueing);
548 call_func_offset_elem_ptr(1);
549 call_func_dcue_ind(CALL_DEF_DEPTH_CUEING_INDEX);
550 call_func_close_struct();
555 /*----------------------------------------------------------------------*/
558 call_subr_get_view_index( Tint stid, Tint *ind )
563 if( TsmGetStructure( stid, &num, &node ) == TSuccess )
565 for( i = 0; i < num; i++ )
567 if( node->elem.el == TelViewIndex )
569 *ind = node->elem.data.ldata;
577 /*----------------------------------------------------------------------*/
580 call_subr_pick( CALL_DEF_PICK *apick )
586 static int *listid, *listelem, *listpickid;
588 TEL_PICK_PATH path_list[CALL_MAX_DEPTH_LENGTH];
595 //cmn_freemem( listid );
597 //cmn_freemem( listelem );
599 //cmn_freemem( listpickid );
601 listid = listelem = listpickid = 0;
604 order = apick->Context.order == 0 ? PTOP_FIRST : PBOTTOM_FIRST;
606 depth = apick->Context.depth < CALL_MAX_DEPTH_LENGTH ?
607 apick->Context.depth : CALL_MAX_DEPTH_LENGTH ;
609 rep.pick_path = path_list;
611 stat = TPick( apick->WsId, apick->x, apick->y, apick->Context.aperture,
612 apick->Context.aperture, order, depth, &rep );
614 if( stat == TSuccess )
616 apick->Pick.depth = rep.depth;
619 printf( "\n\n\tPICK REPORT FOLLOWS" );
620 printf( "\n\t*******************\n" );
621 printf( "\ndepth = %d\torder = %s\n", rep.depth,
622 order == PTOP_FIRST ? "TopFirst" : "BottomFirst" );
625 //cmn_memreserve( listid, rep.depth, 0 );
626 listid = new int[rep.depth];
627 //cmn_memreserve( listelem, rep.depth, 0 );
628 listelem = new int[rep.depth];
629 //cmn_memreserve( listpickid, rep.depth, 0 );
630 listpickid = new int[rep.depth];
631 if( !listid || !listelem || !listpickid )
633 apick->Pick.listid = listid;
634 apick->Pick.listelem = listelem;
635 apick->Pick.listpickid = listpickid;
637 for( i = 0; i < rep.depth; i++ )
639 listelem[i] = path_list[i].el_num;
640 listpickid[i] = path_list[i].pick_id;
641 listid[i] = path_list[i].struct_id;
643 printf( "\n\tSTRUCTURE ID [%d] = %ld", i, listid[i] );
644 printf( "\n\tPICK ID [%d] = %ld", i, listpickid[i] );
645 printf( "\n\tELEMENT ID [%d] = %ld", i, listelem[i] );
657 /*----------------------------------------------------------------------*/
660 call_subr_set_light_src_rep( CALL_DEF_LIGHT * alight )
664 switch( alight->LightType )
666 case 0 : /* TOLS_AMBIENT */
667 rep.type = CALL_PHIGS_LIGHT_AMBIENT;
668 rep.col.rgb[0] = alight->Color.r;
669 rep.col.rgb[1] = alight->Color.g;
670 rep.col.rgb[2] = alight->Color.b;
673 case 1 : /* TOLS_DIRECTIONAL */
674 rep.type = CALL_PHIGS_LIGHT_DIRECTIONAL;
675 rep.col.rgb[0] = alight->Color.r;
676 rep.col.rgb[1] = alight->Color.g;
677 rep.col.rgb[2] = alight->Color.b;
678 rep.dir[0] = alight->Direction.x;
679 rep.dir[1] = alight->Direction.y;
680 rep.dir[2] = alight->Direction.z;
683 case 2 : /* TOLS_POSITIONAL */
684 rep.type = CALL_PHIGS_LIGHT_POSITIONAL;
685 rep.col.rgb[0] = alight->Color.r;
686 rep.col.rgb[1] = alight->Color.g;
687 rep.col.rgb[2] = alight->Color.b;
688 rep.pos[0] = alight->Position.x;
689 rep.pos[1] = alight->Position.y;
690 rep.pos[2] = alight->Position.z;
691 rep.atten[0] = alight->Attenuation[0];
692 rep.atten[1] = alight->Attenuation[1];
695 case 3 : /* TOLS_SPOT */
696 rep.type = CALL_PHIGS_LIGHT_SPOT;
697 rep.col.rgb[0] = alight->Color.r;
698 rep.col.rgb[1] = alight->Color.g;
699 rep.col.rgb[2] = alight->Color.b;
700 rep.pos[0] = alight->Position.x;
701 rep.pos[1] = alight->Position.y;
702 rep.pos[2] = alight->Position.z;
703 rep.dir[0] = alight->Direction.x;
704 rep.dir[1] = alight->Direction.y;
705 rep.dir[2] = alight->Direction.z;
706 rep.shine = alight->Concentration;
707 rep.atten[0] = alight->Attenuation[0];
708 rep.atten[1] = alight->Attenuation[1];
709 rep.angle = alight->Angle;
713 rep.HeadLight = alight->Headlight;
714 AddLight( alight->WsId, alight->LightId, &rep );
719 /*----------------------------------------------------------------------*/
722 call_subr_set_background( Tint ws, tel_colour rgb )
727 /* Mise a jour de l'update_mode */
728 key.ldata = TNotDone;
729 TsmSetWSAttri( ws, WSUpdateState, &key );
731 data.pdata = rgb->rgb;
732 TsmSetWSAttri( ws, WSBackground, &data );
736 /*----------------------------------------------------------------------*/
739 call_subr_set_gradient_background( Tint ws, Tint type, tel_colour color1, tel_colour color2 )
743 TSM_BG_GRADIENT bgGradient;
745 /* Mise a jour de l'update_mode */
746 key.ldata = TNotDone;
747 TsmSetWSAttri( ws, WSUpdateState, &key );
749 bgGradient.type = (TSM_GradientType)type;
750 bgGradient.color1 = *color1;
751 bgGradient.color2 = *color2;
752 data.pdata = &bgGradient;
753 TsmSetWSAttri( ws, WSBgGradient, &data );
758 /*----------------------------------------------------------------------*/
761 call_subr_close_ws( CALL_DEF_VIEW * aview )
764 CMN_KEY_DATA textureKey;
766 TsmGetWSAttri( aview->WsId, WSWindow, &key );
769 tsm_bg_texture texture;
770 WINDOW aWnd = (WINDOW) key.ldata;
772 TsmGetWSAttri( aview->WsId, WSBgTexture, &textureKey );
773 texture = (tsm_bg_texture)textureKey.pdata;
775 if ( texture != 0 && texture->texId != 0 )
777 OpenGl_ResourceCleaner* anCleaner = OpenGl_ResourceCleaner::GetInstance();
779 // Delete the texture with ResourceCleaner; if it is not possible
780 // do this directly with proper context selected
781 if ( !anCleaner->AddResource( TxglGetContext(aWnd),
782 new OpenGl_ResourceTexture(texture->texId) ) )
784 GLCONTEXT cur_context = GET_GL_CONTEXT();
785 GLDRAWABLE cur_drawable = GET_GLDEV_CONTEXT();
787 if ( TxglWinset( call_thedisplay, aWnd ) == TSuccess )
788 glDeleteTextures( 1,(GLuint *)&(texture->texId) );
790 // activate the previous context for this thread
791 GL_MAKE_CURRENT( call_thedisplay, cur_drawable, cur_context );
798 if( !aview->GContext )
800 TxglDestroyWindow( call_thedisplay, (WINDOW) key.ldata );
802 TglDeleteFiltersForWS( aview->WsId );
803 RemoveWksLight( aview->WsId );
804 call_triedron_erase (aview); /* BGN 09-12-98 */
805 call_graduatedtrihedron_erase( aview->WsId );
806 TelDeleteViewsForWS( aview->WsId );
807 TelDeleteHighlightsForWS( aview->WsId );
808 TelDeleteDepthCuesForWS( aview->WsId );
810 TsmUnregisterWsid( aview->WsId );
814 /*----------------------------------------------------------------------*/
817 call_subr_transparency (int wsid, int viewid, int tag)
822 /* Est-il necessaire de faire de la transparence ? */
823 TsmGetWSAttri( wsid, WSTransparency, &data );
824 if (data.ldata != tag)
826 data.ldata = (tag ? TOn : TOff);
827 TsmSetWSAttri( wsid, WSTransparency, &data );
829 /* Mise a jour de l'update_mode */
830 key.ldata = TNotDone;
831 TsmSetWSAttri( wsid, WSUpdateState, &key );
832 (void) call_togl_erase_animation_mode();
837 /*----------------------------------------------------------------------*/
839 call_subr_displayCB( CALL_DEF_VIEW * aview, int reason )
842 if( aview->GDisplayCB ) {
843 Aspect_GraphicCallbackStruct callData;
847 TsmGetWSAttri (aview->WsId, WSWindow, &data);
848 win = (WINDOW) data.ldata;
850 callData.reason = reason;
851 callData.display = call_thedisplay;
852 callData.window = win;
853 callData.wsID = aview->WsId;
854 callData.viewID = aview->ViewId;
855 callData.gcontext = TxglGetContext(win);
857 status = (*aview->GDisplayCB)
858 ( aview->DefWindow.XWindow, aview->GClientData, &callData );