81 |
|
|
82 |
|
|
83 |
|
static |
84 |
< |
glu_error(en) /* report a tessellation error as a warning */ |
84 |
> |
glu_error(en) /* report an error as a warning */ |
85 |
|
GLenum en; |
86 |
|
{ |
87 |
|
sprintf(errmsg, "GLU error %s: %s", glu_rout, gluErrorString(en)); |
89 |
|
} |
90 |
|
|
91 |
|
|
92 |
+ |
static void |
93 |
+ |
myCombine(coords, vertex_data, weight, dataOut) |
94 |
+ |
register GLdouble coords[3]; |
95 |
+ |
GLdouble *vertex_data[4]; |
96 |
+ |
GLfloat weight[4]; |
97 |
+ |
GLdouble **dataOut; |
98 |
+ |
{ |
99 |
+ |
register GLdouble *newvert; |
100 |
+ |
|
101 |
+ |
newvert = (GLdouble *)malloc(3*sizeof(GLdouble)); |
102 |
+ |
if (newvert == NULL) |
103 |
+ |
error(SYSTEM, "out of memory in myCombine"); |
104 |
+ |
VCOPY(newvert, coords); /* no data, just coordinates */ |
105 |
+ |
*dataOut = newvert; |
106 |
+ |
} |
107 |
+ |
|
108 |
+ |
|
109 |
|
static |
110 |
|
newtess() /* allocate GLU tessellation object */ |
111 |
|
{ |
114 |
|
gluTessCallback(gluto, GLU_TESS_BEGIN, glBegin); |
115 |
|
gluTessCallback(gluto, GLU_TESS_VERTEX, glVertex3dv); |
116 |
|
gluTessCallback(gluto, GLU_TESS_END, glEnd); |
117 |
+ |
gluTessCallback(gluto, GLU_TESS_COMBINE, myCombine); |
118 |
|
gluTessCallback(gluto, GLU_TESS_ERROR, glu_error); |
119 |
|
gluTessProperty(gluto, GLU_TESS_WINDING_RULE, GLU_TESS_WINDING_NONZERO); |
120 |
|
} |
220 |
|
(GLdouble)o->oargs.farg[2]); |
221 |
|
gluSphere(gluqo, (GLdouble)o->oargs.farg[3], NSLICES, NSTACKS); |
222 |
|
glPopMatrix(); |
205 |
– |
rgl_checkerr("creating sphere"); |
223 |
|
} |
224 |
|
|
225 |
|
|
247 |
|
objerror(o, USER, "illegal radii"); |
248 |
|
if (o->oargs.farg[6] <= FTINY && (iscyl || o->oargs.farg[7] <= FTINY)) |
249 |
|
return; |
250 |
< |
if (o->oargs.farg[6] < 0.) /* complains for tiny neg's */ |
251 |
< |
o->oargs.farg[6] = 0.; |
252 |
< |
if (!iscyl && o->oargs.farg[7] < 0.) |
253 |
< |
o->oargs.farg[7] = 0.; |
250 |
> |
if (!iscyl) { |
251 |
> |
if (o->oargs.farg[6] < 0.) /* complains for tiny neg's */ |
252 |
> |
o->oargs.farg[6] = 0.; |
253 |
> |
if (o->oargs.farg[7] < 0.) |
254 |
> |
o->oargs.farg[7] = 0.; |
255 |
> |
} |
256 |
|
cent[0] = .5*(o->oargs.farg[0] + o->oargs.farg[3]); |
257 |
|
cent[1] = .5*(o->oargs.farg[1] + o->oargs.farg[4]); |
258 |
|
cent[2] = .5*(o->oargs.farg[2] + o->oargs.farg[5]); |
282 |
|
gluCylinder(gluqo, o->oargs.farg[6], o->oargs.farg[iscyl ? 6 : 7], |
283 |
|
h, NSLICES, 1); |
284 |
|
glPopMatrix(); |
266 |
– |
rgl_checkerr("creating cone"); |
285 |
|
} |
286 |
|
|
287 |
|
|
330 |
|
glRotated(d, (GLdouble)x1, (GLdouble)y1, 0.); |
331 |
|
gluDisk(gluqo, o->oargs.farg[6], o->oargs.farg[7], NSLICES, 1); |
332 |
|
glPopMatrix(); |
315 |
– |
rgl_checkerr("creating ring"); |
333 |
|
} |