1 /* TraingleDraw.c */
2 /**********************************************************************************************************
3 Copyright (c) 2002-2013 Abdul-Rahman Allouche. All rights reserved
4
5 Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
6 documentation files (the Gabedit), to deal in the Software without restriction, including without limitation
7 the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software,
8 and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
9
10 The above copyright notice and this permission notice shall be included in all copies or substantial portions
11 of the Software.
12
13 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED
14 TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
15 THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
16 CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
17 DEALINGS IN THE SOFTWARE.
18 ************************************************************************************************************/
19
20 #include "../../Config.h"
21 #include "GlobalOrb.h"
22 #include "Textures.h"
23 #include "../Utils/Vector3d.h"
24 #include "../Utils/Transformation.h"
25 #include "../Display/ColorMap.h"
26 #include "../Display/UtilsOrb.h"
27 #include "../Display/GLArea.h"
28 #include "../Utils/UtilsInterface.h"
29 #include "../Utils/UtilsGL.h"
30
31 static V4d color_positive = {0.0, 0.0,0.8,1.0};
32 static V4d color_negative = {0.8, 0.0,0.0,1.0};
33 static V4d color_density = {0.0, 0.8,0.8,1.0};
34
35 /*********************************************************************************************/
get_color_surface(gint num,gdouble v[])36 void get_color_surface(gint num,gdouble v[])
37 {
38 gint i;
39 switch(num)
40 {
41 case 0 :
42 for(i=0;i<3;i++)
43 v[i] = color_positive[i];
44 break;
45 case 1 :
46 for(i=0;i<3;i++)
47 v[i] = color_negative[i];
48 break;
49 case 2 :
50 for(i=0;i<3;i++)
51 v[i] = color_density[i];
52 break;
53 }
54 }
55 /*********************************************************************************************/
set_color_surface(gint num,gdouble v[])56 void set_color_surface(gint num,gdouble v[])
57 {
58 gint i;
59 switch(num)
60 {
61 case 0 :
62 for(i=0;i<3;i++)
63 color_positive[i] = v[i];
64 break;
65 case 1 :
66 for(i=0;i<3;i++)
67 color_negative[i] = v[i];
68 break;
69 case 2 :
70 for(i=0;i<3;i++)
71 color_density[i] = v[i];
72 break;
73 }
74 }
75 /********************************************************************************/
TriangleShow(V3d V1,V3d V2,V3d V3,V3d N1,V3d N2,V3d N3)76 void TriangleShow(V3d V1,V3d V2,V3d V3,V3d N1,V3d N2,V3d N3)
77 {
78 glBegin(GL_TRIANGLES);
79
80 if(TypeTexture != GABEDIT_TYPETEXTURE_NONE)
81 glTexCoord2f(V1[0],V1[1]);
82 glNormal3d(N1[0],N1[1],N1[2]);
83 glVertex3d(V1[0],V1[1],V1[2]);
84
85 if(TypeTexture != GABEDIT_TYPETEXTURE_NONE)
86 glTexCoord2f(V2[0],V2[1]);
87 glNormal3d(N2[0],N2[1],N2[2]);
88 glVertex3d(V2[0],V2[1],V2[2]);
89
90 if(TypeTexture != GABEDIT_TYPETEXTURE_NONE)
91 glTexCoord2f(V3[0],V3[1]);
92 glNormal3d(N3[0],N3[1],N3[2]);
93 glVertex3d(V3[0],V3[1],V3[2]);
94
95 /*
96 glNormal3d(-N1[0],-N1[1],-N1[2]);
97 glVertex3d(V1[0],V1[1],V1[2]);
98 glNormal3d(-N2[0],-N2[1],-N2[2]);
99 glVertex3d(V2[0],V2[1],V2[2]);
100 glNormal3d(-N3[0],-N3[1],-N3[2]);
101 glVertex3d(V3[0],V3[1],V3[2]);
102 */
103 glEnd();
104
105 }
106 /********************************************************************************/
IsoDrawNoMapped(IsoSurface * iso)107 void IsoDrawNoMapped(IsoSurface* iso)
108 {
109 gint i;
110 gint j;
111 gint k;
112 gint n=0;;
113 gint nBoundary = 2;
114
115 /* glBegin(GL_TRIANGLES);*/
116 for(i=nBoundary;i<iso->N[0]-nBoundary-1;i++)
117 {
118 for(j=nBoundary;j<iso->N[1]-nBoundary-1;j++)
119 {
120 for(k=nBoundary;k<iso->N[2]-nBoundary-1;k++)
121 {
122 for(n=0;n<iso->cube[i][j][k].Ntriangles;n++)
123 {
124 TriangleShow
125 (
126 iso->cube[i][j][k].triangles[n].vertex[0]->C,
127 iso->cube[i][j][k].triangles[n].vertex[1]->C,
128 iso->cube[i][j][k].triangles[n].vertex[2]->C,
129 iso->cube[i][j][k].triangles[n].Normal[0].C,
130 iso->cube[i][j][k].triangles[n].Normal[1].C,
131 iso->cube[i][j][k].triangles[n].Normal[2].C
132 );
133
134 }
135 }
136 }
137 }
138 /* glEnd();*/
139 }
140 /********************************************************************************/
TriangleShowColorMap(V3d V1,V3d V2,V3d V3,V3d N1,V3d N2,V3d N3,V4d color1,V4d color2,V4d color3)141 void TriangleShowColorMap(V3d V1,V3d V2,V3d V3,V3d N1,V3d N2,V3d N3, V4d color1,V4d color2,V4d color3)
142 {
143 glBegin(GL_TRIANGLES);
144
145 if(TypeTexture != GABEDIT_TYPETEXTURE_NONE) glTexCoord2f(V1[0],V1[1]);
146 glMaterialdv(GL_FRONT_AND_BACK,GL_DIFFUSE,color1);
147 glNormal3d(N1[0],N1[1],N1[2]);
148 glVertex3d(V1[0],V1[1],V1[2]);
149
150 if(TypeTexture != GABEDIT_TYPETEXTURE_NONE) glTexCoord2f(V2[0],V2[1]);
151 glMaterialdv(GL_FRONT_AND_BACK,GL_DIFFUSE,color2);
152 glNormal3d(N2[0],N2[1],N2[2]);
153 glVertex3d(V2[0],V2[1],V2[2]);
154
155 if(TypeTexture != GABEDIT_TYPETEXTURE_NONE) glTexCoord2f(V3[0],V3[1]);
156 glMaterialdv(GL_FRONT_AND_BACK,GL_DIFFUSE,color3);
157 glNormal3d(N3[0],N3[1],N3[2]);
158 glVertex3d(V3[0],V3[1],V3[2]);
159
160 glEnd();
161
162 }
163 /**************************************************************************/
get_colorMap_mapping_cube()164 static ColorMap* get_colorMap_mapping_cube()
165 {
166 GtkWidget* handleBoxColorMapGrid = g_object_get_data(G_OBJECT(PrincipalWindow), "HandleboxColorMapGrid ");
167 ColorMap* colorMap = g_object_get_data(G_OBJECT(handleBoxColorMapGrid),"ColorMap");
168
169 return colorMap;
170 }
171 /********************************************************************************/
IsoDrawMapped(IsoSurface * iso)172 void IsoDrawMapped(IsoSurface* iso)
173 {
174 GLdouble alpha = get_alpha_opacity();
175 gint i;
176 gint j;
177 gint k;
178 gint n=0;
179 V4d Diffuse = {0.5,0.5,0.5,1.0};
180 V4d Specular = {0.8,0.8,0.8,1.0 };
181 V4d Ambiant = {0.2,0.2,0.2,alpha};
182 gdouble value;
183 V4d color1 = {0.5,0.5,0.5,alpha};
184 V4d color2 = {0.5,0.5,0.5,alpha};
185 V4d color3 = {0.5,0.5,0.5,alpha};
186 ColorMap* colorMap = get_colorMap_mapping_cube();
187
188 if(TypeBlend == GABEDIT_BLEND_NO) alpha = 1.0;
189
190 glMaterialdv(GL_FRONT_AND_BACK,GL_SPECULAR,Specular);
191 glMaterialdv(GL_FRONT_AND_BACK,GL_DIFFUSE,Diffuse);
192 glMaterialdv(GL_FRONT_AND_BACK,GL_AMBIENT,Ambiant);
193 glMateriali(GL_FRONT_AND_BACK,GL_SHININESS,120);
194
195 for(i=1;i<iso->N[0]-2;i++)
196 {
197 for(j=1;j<iso->N[1]-2;j++)
198 {
199 for(k=1;k<iso->N[2]-2;k++)
200 {
201 for(n=0;n<iso->cube[i][j][k].Ntriangles;n++)
202 {
203 value = iso->cube[i][j][k].triangles[n].vertex[0]->C[3];
204 set_Color_From_colorMap(colorMap, color1, value);
205 value = iso->cube[i][j][k].triangles[n].vertex[1]->C[3];
206 set_Color_From_colorMap(colorMap, color2, value);
207 value = iso->cube[i][j][k].triangles[n].vertex[2]->C[3];
208 set_Color_From_colorMap(colorMap, color3, value);
209 TriangleShowColorMap
210 (
211 iso->cube[i][j][k].triangles[n].vertex[0]->C,
212 iso->cube[i][j][k].triangles[n].vertex[1]->C,
213 iso->cube[i][j][k].triangles[n].vertex[2]->C,
214 iso->cube[i][j][k].triangles[n].Normal[0].C,
215 iso->cube[i][j][k].triangles[n].Normal[1].C,
216 iso->cube[i][j][k].triangles[n].Normal[2].C,
217 color1,color2,color3
218 );
219
220 }
221 }
222 }
223 }
224 }
225 /********************************************************************************/
IsoDraw(IsoSurface * iso)226 void IsoDraw( IsoSurface* iso)
227 {
228 if(iso->grid->mapped)
229 IsoDrawMapped(iso);
230 else
231 IsoDrawNoMapped(iso);
232 }
233 /*********************************************************************************************/
IsoGenOneList(IsoSurface * isosurface,gint type)234 GLuint IsoGenOneList(IsoSurface* isosurface,gint type)
235 {
236 GLuint isolist;
237 GLdouble alpha = get_alpha_opacity();
238
239 if(!isosurface) return 0;
240 if(TypeBlend == GABEDIT_BLEND_NO) alpha = 1.0;
241
242 isolist = glGenLists(1);
243 glNewList(isolist, GL_COMPILE);
244
245 /* glEnable (GL_POLYGON_SMOOTH);*/
246 if(type==1)
247 if(TypeNegWireFrame == GABEDIT_NEG_WIREFRAME_YES)
248 {
249 glLineWidth(2);
250 glPolygonMode(GL_FRONT_AND_BACK,GL_LINE);
251 }
252 else
253 {
254 glLineWidth(1.5);
255 glPolygonMode(GL_FRONT_AND_BACK,GL_FILL);
256 }
257 else
258 if(TypePosWireFrame == GABEDIT_POS_WIREFRAME_YES)
259 {
260 glLineWidth(2);
261 glPolygonMode(GL_FRONT_AND_BACK,GL_LINE);
262 }
263 else
264 {
265 glLineWidth(1.5);
266 glPolygonMode(GL_FRONT_AND_BACK,GL_FILL);
267 }
268
269
270 if(TypeBlend == GABEDIT_BLEND_YES)
271 glEnable(GL_BLEND);
272 else
273 glDisable(GL_BLEND);
274
275 glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
276 /*glDepthMask(FALSE);*/
277
278 if(TypeTexture != GABEDIT_TYPETEXTURE_NONE)
279 activate_texture(type);
280 else
281 disable_texture();
282
283 switch(type)
284 {
285 case 0 : /* positive */
286 {
287 gdouble* Diffuse = color_positive;
288 V4d Specular = {0.8,0.8,0.8,alpha};
289 V4d Ambiant = {0.2,0.2,0.2,alpha};
290 color_positive[3] = alpha;
291
292 glMaterialdv(GL_FRONT_AND_BACK,GL_SPECULAR,Specular);
293 glMaterialdv(GL_FRONT_AND_BACK,GL_DIFFUSE,Diffuse);
294 glMaterialdv(GL_FRONT_AND_BACK,GL_AMBIENT,Ambiant);
295 glMateriali(GL_FRONT_AND_BACK,GL_SHININESS,120);
296 IsoDraw(isosurface);
297 break;
298 }
299 case 1 :/* negative */
300 {
301
302 gdouble* Diffuse = color_negative;
303 V4d Specular = {0.8,0.8,0.8,alpha};
304 V4d Ambiant = {0.2,0.2,0.2,alpha};
305 color_negative[3] = alpha;
306
307 glMaterialdv(GL_FRONT_AND_BACK,GL_SPECULAR,Specular);
308 glMaterialdv(GL_FRONT_AND_BACK,GL_DIFFUSE,Diffuse);
309 glMaterialdv(GL_FRONT_AND_BACK,GL_AMBIENT,Ambiant);
310 glMateriali(GL_FRONT_AND_BACK,GL_SHININESS,120);
311 IsoDraw(isosurface);
312 break;
313 }
314 case 2:
315 {
316 gdouble* Diffuse = color_density;
317 V4d Specular = {0.8,0.8,0.8,alpha};
318 V4d Ambiant = {0.2,0.2,0.2,alpha};
319 color_density[3] = alpha;
320 glMaterialdv(GL_FRONT_AND_BACK,GL_SPECULAR,Specular);
321 glMaterialdv(GL_FRONT_AND_BACK,GL_DIFFUSE,Diffuse);
322 glMaterialdv(GL_FRONT_AND_BACK,GL_AMBIENT,Ambiant);
323 glMateriali(GL_FRONT_AND_BACK,GL_SHININESS,120);
324 IsoDraw(isosurface);
325 }
326 }/*end switch*/
327
328 if(TypeBlend == GABEDIT_BLEND_YES)
329 {
330 /*glDepthMask(TRUE);*/
331 glDisable(GL_BLEND);
332 }
333
334 glLineWidth(1.5);
335 glPolygonMode(GL_FRONT_AND_BACK,GL_FILL);
336
337 if(TypeTexture != GABEDIT_TYPETEXTURE_NONE)
338 disable_texture();
339 glEndList();
340 return isolist;
341
342 }
343 /********************************************************************************/
IsoGenLists(GLuint * positiveSurface,GLuint * negativeSurface,GLuint * nullSurface,IsoSurface * isopositive,IsoSurface * isonegative,IsoSurface * isonull)344 void IsoGenLists(GLuint *positiveSurface, GLuint *negativeSurface, GLuint *nullSurface, IsoSurface* isopositive,IsoSurface* isonegative,IsoSurface* isonull)
345 {
346 if (glIsList(*positiveSurface) == GL_TRUE) glDeleteLists(*positiveSurface,1);
347 if (glIsList(*negativeSurface) == GL_TRUE) glDeleteLists(*negativeSurface,1);
348 if (glIsList(*nullSurface) == GL_TRUE) glDeleteLists(*nullSurface,1);
349
350 if( TypeGrid == GABEDIT_TYPEGRID_EDENSITY) *positiveSurface = IsoGenOneList(isopositive,2);
351 else
352 {
353 *positiveSurface = IsoGenOneList(isopositive,0);
354 *negativeSurface = IsoGenOneList(isonegative,1);
355 *nullSurface = IsoGenOneList(isonull,3);
356 }
357 }
358 /********************************************************************************/
IsoShowLists(GLuint positiveSurface,GLuint negativeSurface,GLuint nullSurface)359 void IsoShowLists(GLuint positiveSurface, GLuint negativeSurface, GLuint nullSurface)
360 {
361 if(SurfShow == GABEDIT_SURFSHOW_NO) return;
362
363 if(SurfShow == GABEDIT_SURFSHOW_POSNEG ||SurfShow == GABEDIT_SURFSHOW_POSITIVE)
364 {
365 if (glIsList(positiveSurface) == GL_TRUE) glCallList(positiveSurface);
366 }
367 if(SurfShow == GABEDIT_SURFSHOW_POSNEG ||SurfShow == GABEDIT_SURFSHOW_NEGATIVE)
368 {
369 if (glIsList(negativeSurface) == GL_TRUE) glCallList(negativeSurface);
370 }
371 if (glIsList(nullSurface) == GL_TRUE) glCallList(nullSurface);
372
373 }
374 /*********************************************************************************************/
CubeDraw(Grid * grid)375 void CubeDraw(Grid* grid)
376 {
377 gint ix,iy,iz;
378 gint ix1,iy1,iz1;
379 gdouble x,y,z;
380 if(!grid) return;
381
382 glLineWidth(3);
383 ix1 = grid->N[0]-1;
384 iy1 = grid->N[1]-1;
385 iz1 = grid->N[2]-1;
386 glPolygonMode(GL_FRONT_AND_BACK,GL_LINE);
387 glBegin(GL_POLYGON);
388 ix = 0; iy = 0; iz = 0;
389 x = grid->point[ix][iy][iz].C[0];
390 y = grid->point[ix][iy][iz].C[1];
391 z = grid->point[ix][iy][iz].C[2];
392 glVertex3f(x,y,z);
393 ix = ix1; iy = 0; iz = 0;
394 x = grid->point[ix][iy][iz].C[0];
395 y = grid->point[ix][iy][iz].C[1];
396 z = grid->point[ix][iy][iz].C[2];
397 glVertex3f(x,y,z);
398 ix = ix1; iy = iy1; iz = 0;
399 x = grid->point[ix][iy][iz].C[0];
400 y = grid->point[ix][iy][iz].C[1];
401 z = grid->point[ix][iy][iz].C[2];
402 glVertex3f(x,y,z);
403 ix = 0; iy = iy1; iz = 0;
404 x = grid->point[ix][iy][iz].C[0];
405 y = grid->point[ix][iy][iz].C[1];
406 z = grid->point[ix][iy][iz].C[2];
407 glVertex3f(x,y,z);
408 ix = 0; iy = 0; iz = 0;
409 x = grid->point[ix][iy][iz].C[0];
410 y = grid->point[ix][iy][iz].C[1];
411 z = grid->point[ix][iy][iz].C[2];
412 glVertex3f(x,y,z);
413 glEnd();
414
415 glBegin(GL_POLYGON);
416 ix = 0; iy = 0; iz = 0;
417 x = grid->point[ix][iy][iz].C[0];
418 y = grid->point[ix][iy][iz].C[1];
419 z = grid->point[ix][iy][iz].C[2];
420 glVertex3f(x,y,z);
421 ix = ix1; iy = 0; iz = 0;
422 x = grid->point[ix][iy][iz].C[0];
423 y = grid->point[ix][iy][iz].C[1];
424 z = grid->point[ix][iy][iz].C[2];
425 glVertex3f(x,y,z);
426 ix = ix1; iy = 0; iz = iz1;
427 x = grid->point[ix][iy][iz].C[0];
428 y = grid->point[ix][iy][iz].C[1];
429 z = grid->point[ix][iy][iz].C[2];
430 glVertex3f(x,y,z);
431 ix = 0; iy = 0; iz = iz1;
432 x = grid->point[ix][iy][iz].C[0];
433 y = grid->point[ix][iy][iz].C[1];
434 z = grid->point[ix][iy][iz].C[2];
435 glVertex3f(x,y,z);
436 ix = 0; iy = 0; iz = 0;
437 x = grid->point[ix][iy][iz].C[0];
438 y = grid->point[ix][iy][iz].C[1];
439 z = grid->point[ix][iy][iz].C[2];
440 glVertex3f(x,y,z);
441 glEnd();
442
443 glBegin(GL_POLYGON);
444 ix = 0; iy = 0; iz = 0;
445 x = grid->point[ix][iy][iz].C[0];
446 y = grid->point[ix][iy][iz].C[1];
447 z = grid->point[ix][iy][iz].C[2];
448 glVertex3f(x,y,z);
449 ix = 0; iy = iy1; iz = 0;
450 x = grid->point[ix][iy][iz].C[0];
451 y = grid->point[ix][iy][iz].C[1];
452 z = grid->point[ix][iy][iz].C[2];
453 glVertex3f(x,y,z);
454 ix = 0; iy = iy1; iz = iz1;
455 x = grid->point[ix][iy][iz].C[0];
456 y = grid->point[ix][iy][iz].C[1];
457 z = grid->point[ix][iy][iz].C[2];
458 glVertex3f(x,y,z);
459 ix = 0; iy = 0; iz = iz1;
460 x = grid->point[ix][iy][iz].C[0];
461 y = grid->point[ix][iy][iz].C[1];
462 z = grid->point[ix][iy][iz].C[2];
463 glVertex3f(x,y,z);
464 ix = 0; iy = 0; iz = 0;
465 x = grid->point[ix][iy][iz].C[0];
466 y = grid->point[ix][iy][iz].C[1];
467 z = grid->point[ix][iy][iz].C[2];
468 glVertex3f(x,y,z);
469 glEnd();
470 glBegin(GL_POLYGON);
471 ix = ix1; iy = iy1; iz = iz1;
472 x = grid->point[ix][iy][iz].C[0];
473 y = grid->point[ix][iy][iz].C[1];
474 z = grid->point[ix][iy][iz].C[2];
475 glVertex3f(x,y,z);
476 ix = 0; iy = iy1; iz = iz1;
477 x = grid->point[ix][iy][iz].C[0];
478 y = grid->point[ix][iy][iz].C[1];
479 z = grid->point[ix][iy][iz].C[2];
480 glVertex3f(x,y,z);
481 ix = 0; iy = 0; iz = iz1;
482 x = grid->point[ix][iy][iz].C[0];
483 y = grid->point[ix][iy][iz].C[1];
484 z = grid->point[ix][iy][iz].C[2];
485 glVertex3f(x,y,z);
486 ix = ix1; iy = 0; iz = iz1;
487 x = grid->point[ix][iy][iz].C[0];
488 y = grid->point[ix][iy][iz].C[1];
489 z = grid->point[ix][iy][iz].C[2];
490 glVertex3f(x,y,z);
491 ix = ix1; iy = iy1; iz = iz1;
492 x = grid->point[ix][iy][iz].C[0];
493 y = grid->point[ix][iy][iz].C[1];
494 z = grid->point[ix][iy][iz].C[2];
495 glVertex3f(x,y,z);
496 glEnd();
497 glBegin(GL_POLYGON);
498 ix = ix1; iy = iy1; iz = iz1;
499 x = grid->point[ix][iy][iz].C[0];
500 y = grid->point[ix][iy][iz].C[1];
501 z = grid->point[ix][iy][iz].C[2];
502 glVertex3f(x,y,z);
503 ix = ix1; iy = iy1; iz = 0;
504 x = grid->point[ix][iy][iz].C[0];
505 y = grid->point[ix][iy][iz].C[1];
506 z = grid->point[ix][iy][iz].C[2];
507 glVertex3f(x,y,z);
508 ix = ix1; iy = 0; iz = 0;
509 x = grid->point[ix][iy][iz].C[0];
510 y = grid->point[ix][iy][iz].C[1];
511 z = grid->point[ix][iy][iz].C[2];
512 glVertex3f(x,y,z);
513 ix = ix1; iy = 0; iz = iz1;
514 x = grid->point[ix][iy][iz].C[0];
515 y = grid->point[ix][iy][iz].C[1];
516 z = grid->point[ix][iy][iz].C[2];
517 glVertex3f(x,y,z);
518 ix = ix1; iy = iy1; iz = iz1;
519 x = grid->point[ix][iy][iz].C[0];
520 y = grid->point[ix][iy][iz].C[1];
521 z = grid->point[ix][iy][iz].C[2];
522 glVertex3f(x,y,z);
523 glEnd();
524
525 glLineWidth(1.5);
526 glPolygonMode(GL_FRONT_AND_BACK,GL_FILL);
527 }
528 /*********************************************************************************************/
BoxGenLists(GLuint * box)529 void BoxGenLists(GLuint *box)
530 {
531 V4d Color = {1.0,1.0,1.0,0.8};
532 if (glIsList(*box) == GL_TRUE) glDeleteLists(*box,1);
533 *box = glGenLists(1);
534 glNewList(*box, GL_COMPILE);
535
536 glDisable ( GL_LIGHTING ) ;
537 glColor4dv(Color);
538 CubeDraw(grid);
539 glEnable ( GL_LIGHTING ) ;
540 glEndList();
541 }
542 /********************************************************************************/
BoxShowLists(GLuint box)543 void BoxShowLists(GLuint box)
544 {
545 if (glIsList(box) == GL_TRUE) glCallList(box);
546 }
547