0022650: Exception in Primitive Array during Redisplay of Presentable Object
[occt.git] / src / OpenGl / OpenGl_texture.cxx
1 /***********************************************************************
2
3 FONCTION :
4 ----------
5 File OpenGl_texture.c :
6
7
8 REMARQUES:
9 ---------- 
10
11
12 HISTORIQUE DES MODIFICATIONS   :
13 --------------------------------
14 05-08-97 : PCT ; Support texture mapping
15
16 ************************************************************************/
17
18 /*----------------------------------------------------------------------*/
19 /*
20 * Includes
21 */
22
23 #include <OpenGl_tgl_all.hxx>
24
25 #include <stddef.h>
26 #include <stdio.h>
27 #include <GL/gl.h>
28 #include <GL/glu.h>
29
30 #include <OpenGl_cmn_varargs.hxx>
31 #include <OpenGl_telem_attri.hxx>
32 #include <OpenGl_tsm.hxx>
33 #include <OpenGl_telem.hxx>
34 #include <OpenGl_telem_inquire.hxx>
35 #include <OpenGl_Memory.hxx>
36
37 static  TStatus  TextureIdMethodAdd( TSM_ELEM_DATA, Tint, cmn_key* );
38 static  TStatus  TextureIdMethodDisplay( TSM_ELEM_DATA, Tint, cmn_key* );
39 static  TStatus  TextureIdMethodPrint( TSM_ELEM_DATA, Tint, cmn_key* );
40 static  TStatus  TextureIdMethodInquire( TSM_ELEM_DATA, Tint, cmn_key* );
41
42 static  TStatus  (*MtdTbl[])( TSM_ELEM_DATA, Tint, cmn_key* ) =
43 {
44   0,             /* PickTraverse */
45   TextureIdMethodDisplay,
46   TextureIdMethodAdd,
47   0,             /* Delete */
48   TextureIdMethodPrint,
49   TextureIdMethodInquire
50 };
51
52
53 MtblPtr
54 TelTextureIdInitClass( TelType *el )
55 {
56   *el = TelTextureId;
57   return MtdTbl;
58 }
59
60 static  TStatus
61 TextureIdMethodAdd( TSM_ELEM_DATA d, Tint n, cmn_key *k )
62 {
63   ((tsm_elem_data)(d.pdata))->ldata = k[0]->data.ldata;
64
65   return TSuccess;
66 }
67
68
69 static  TStatus
70 TextureIdMethodDisplay( TSM_ELEM_DATA d, Tint n, cmn_key *k )
71 {
72   CMN_KEY  key;
73
74   key.id = TelTextureId;
75   key.data.ldata = d.ldata;
76   TsmSetAttri( 1, &key );
77   return TSuccess;
78 }
79
80
81 static  TStatus
82 TextureIdMethodPrint( TSM_ELEM_DATA data, Tint n, cmn_key *k )
83 {
84
85   return TSuccess;
86 }
87
88
89 static TStatus
90 TextureIdMethodInquire( TSM_ELEM_DATA data, Tint n, cmn_key *k )
91 {
92   Tint i;
93
94   for( i = 0; i < n; i++ )
95   {
96     switch( k[i]->id )
97     {
98     case INQ_GET_SIZE_ID:
99       {
100         k[i]->data.ldata = sizeof( Tint );
101         break;
102       }
103     case INQ_GET_CONTENT_ID:
104       {
105         TEL_INQ_CONTENT *c;
106         Teldata         *w;
107
108         c = (TEL_INQ_CONTENT*)k[i]->data.pdata;
109         w = c->data;
110         c->act_size = 0;
111         w->idata = data.ldata;
112         break;
113       }
114     }
115   }
116
117   return TSuccess;
118 }