2 File OpenGl_togl_parray.c
3 Created 16/06/2000 : ATS : G005
6 #include <OpenGl_tgl_all.hxx>
7 #include <InterfaceGraphic_Graphic3d.hxx>
8 #include <OpenGl_tgl.hxx>
9 #include <OpenGl_tgl_funcs.hxx>
10 #include <OpenGl_tgl_subrs.hxx>
11 #include <OpenGl_tgl_utilgr.hxx>
13 void EXPORT call_togl_parray
15 CALL_DEF_GROUP *agroup,
16 CALL_DEF_PARRAY *parray
19 if (! agroup->IsOpen) call_togl_opengroup (agroup);
20 call_subr_parray (parray);
21 if (! agroup->IsOpen) call_togl_closegroup (agroup);
25 //=======================================================================
26 //function : call_togl_parray_remove
27 //purpose : Remove the driver's element corresponding to the primitives
28 // array <thePArray> and clean its visualization data. The driver
29 // clears all its references to array and stops displaying it.
30 // <theGroup> is the group that has added <thePArray> to driver.
31 //=======================================================================
33 void EXPORT call_togl_parray_remove (CALL_DEF_GROUP* theGroup,
34 CALL_DEF_PARRAY* thePArray)
36 CALL_DEF_PARRAY* anElData;
37 Tint aBegId, aEndId, aCurId;
40 // set edit mode and open struct
41 call_func_set_edit_mode (CALL_PHIGS_EDIT_REPLACE);
42 call_func_open_struct (theGroup->Struct->Id);
45 call_func_set_elem_ptr (0);
46 if (call_func_set_elem_ptr_label (theGroup->LabelBegin) == TFailure)
48 call_func_inq_elem_ptr (&aBegId);
51 if (call_func_set_elem_ptr_label (theGroup->LabelEnd) == TFailure)
53 call_func_inq_elem_ptr (&aEndId);
55 // iterate between labels and search for the array
58 // move one element back
59 if (call_func_offset_elem_ptr (-1) == TFailure ||
60 call_func_inq_elem_ptr (&aCurId) == TFailure)
63 // iterate from end label to begin label
64 while (aCurId > aBegId)
66 call_func_inq_elem (&anElem);
68 // compare element with the array
69 if (anElem.el == TelParray && anElem.data.pdata == (void* )thePArray)
71 anElData = (CALL_DEF_PARRAY* )anElem.data.pdata;
73 // validate for correct pointer
74 if (anElData->num_bounds == thePArray->num_bounds &&
75 anElData->num_edges == thePArray->num_edges &&
76 anElData->num_vertexs == thePArray->num_vertexs &&
77 anElData->type == thePArray->type)
85 call_func_offset_elem_ptr (-1);
86 call_func_inq_elem_ptr (&aCurId);
91 call_func_close_struct();