Addons updated to new doc format
[io.git] / addons / OpenGL / source / IoGLU.c
blobc5ae131b617aebbe67f01be28900ea9df57df4a0
2 //metadoc GLU copyright Steve Dekorte 2002
3 //metadoc GLU license BSD revised
4 //metadoc GLU category Graphics
6 #include "IoGLU.h"
8 #include "List.h"
9 #include "IoState.h"
10 #include "IoNumber.h"
11 #include "IoCFunction.h"
12 #include "IoSeq.h"
13 #include "IoList.h"
14 #include "List.h"
15 #include "IoGLUQuadric.h"
16 #include <time.h>
18 #define DATA(self) ((IoGLUData *)IoObject_dataPointer(self))
20 IoTag *IoGLU_newTag(void *state)
22 IoTag *tag = IoTag_newWithName_("GLU");
23 IoTag_state_(tag, state);
24 IoTag_cloneFunc_(tag, (IoTagCloneFunc *)IoGLU_rawClone);
25 IoTag_freeFunc_(tag, (IoTagFreeFunc *)IoGLU_free);
26 IoTag_markFunc_(tag, (IoTagMarkFunc *)IoGLU_mark);
27 return tag;
30 IoGLU *IoGLU_proto(void *state)
32 IoObject *self = IoObject_new(state);
33 IoObject_tag_(self, IoGLU_newTag(state));
35 IoState_registerProtoWithFunc_(state, self, IoGLU_proto);
36 IoGLU_protoInit(self);
37 return self;
40 IoGLU *IoGLU_new(void *state)
41 { return IoState_protoWithInitFunction_(state, IoGLU_proto); }
43 void IoGLU_free(IoGLU *self)
45 /* add code to shut down GLU */
46 /*free(IoObject_dataPointer(self));*/
49 void IoGLU_mark(IoGLU *self)
52 /* ----------------------------------------------------------- */
54 IoObject *IoGLU_rawClone(IoGLU *self)
55 { return IoState_protoWithInitFunction_(IOSTATE, IoGLU_proto); }
57 /* --- GLU -------------------------------------------------------- */
59 void GLU_getDoubleVector(IoGLU *self, IoObject *locals, IoMessage *m, List *list, GLdouble **v, int max, char *desc)
61 int i;
63 if (max == 0)
65 *v=(GLdouble *)malloc(List_size(list)*sizeof(GLdouble));
68 for (i = 0; i < List_size(list) && ((max==0) || (i<max)); i ++)
70 IoNumber *num = List_at_(list, i);
72 if (!ISNUMBER(num))
74 char fname[48];
75 snprintf(fname, 48, "Io GL %s", desc);
76 IoState_error_(IOSTATE, m, "%s parameter List item #%i must be a Number", fname, i);
79 *v[i] = IoNumber_asDouble(num);
83 void GLU_getIntVector(IoGLU *self, IoObject *locals, IoMessage *m, List *list, GLint **v, int max, char *desc)
85 int i;
87 if (max==0)
89 *v=(GLint *)malloc(List_size(list)*sizeof(GLint));
92 for (i = 0; i < List_size(list) && ((max==0) || (i<max)); i ++)
94 IoNumber *num = List_at_(list, i);
96 if (!ISNUMBER(num))
98 char fname[48];
99 snprintf(fname, 48, "Io GL %s", desc);
100 IoState_error_(IOSTATE, m, "%s parameter List item #%i must be a Number", fname, i);
102 *v[i] = (GLint)IoNumber_asInt(num);
106 IoObject *IoGLU_gluLookAt(IoGLU *self, IoObject *locals, IoMessage *m)
108 GLdouble eyeX = IoMessage_locals_doubleArgAt_(m, locals, 0);
109 GLdouble eyeY = IoMessage_locals_doubleArgAt_(m, locals, 1);
110 GLdouble eyeZ = IoMessage_locals_doubleArgAt_(m, locals, 2);
111 GLdouble centerX = IoMessage_locals_doubleArgAt_(m, locals, 3);
112 GLdouble centerY = IoMessage_locals_doubleArgAt_(m, locals, 4);
113 GLdouble centerZ = IoMessage_locals_doubleArgAt_(m, locals, 5);
114 GLdouble upX = IoMessage_locals_doubleArgAt_(m, locals, 6);
115 GLdouble upY = IoMessage_locals_doubleArgAt_(m, locals, 7);
116 GLdouble upZ = IoMessage_locals_doubleArgAt_(m, locals, 8);
118 gluLookAt(eyeX, eyeY, eyeZ, centerX, centerY, centerZ, upX, upY, upZ);
119 return self;
122 IoObject *IoGLU_gluPerspective(IoGLU *self, IoObject *locals, IoMessage *m)
124 GLdouble fovy = IoMessage_locals_doubleArgAt_(m, locals, 0);
125 GLdouble aspect = IoMessage_locals_doubleArgAt_(m, locals, 1);
126 GLdouble zNear = IoMessage_locals_doubleArgAt_(m, locals, 2);
127 GLdouble zFar = IoMessage_locals_doubleArgAt_(m, locals, 3);
129 gluPerspective(fovy, aspect, zNear, zFar);
130 return self;
133 IoObject *IoGLU_gluOrtho2D(IoGLU *self, IoObject *locals, IoMessage *m)
135 GLdouble l = IoMessage_locals_doubleArgAt_(m, locals, 0);
136 GLdouble r = IoMessage_locals_doubleArgAt_(m, locals, 1);
137 GLdouble b = IoMessage_locals_doubleArgAt_(m, locals, 2);
138 GLdouble t = IoMessage_locals_doubleArgAt_(m, locals, 3);
140 gluOrtho2D(l, r, b, t);
141 return self;
144 IoObject *IoGLU_gluBuild1DMipmaps(IoGLU *self, IoObject *locals, IoMessage *m)
146 GLenum target = IoMessage_locals_intArgAt_(m, locals, 0);
147 GLint internalFormat = IoMessage_locals_intArgAt_(m, locals, 1);
148 GLsizei width = IoMessage_locals_intArgAt_(m, locals, 2);
149 GLenum format = IoMessage_locals_intArgAt_(m, locals, 3);
150 GLenum type = IoMessage_locals_intArgAt_(m, locals, 4);
151 IoSeq *data = IoMessage_locals_seqArgAt_(m, locals, 5);
152 GLvoid *pointer = (GLvoid *)IoSeq_rawBytes(data);
153 GLint r;
155 r = gluBuild1DMipmaps(target,internalFormat,width,format,type,pointer);
156 return IONUMBER(r);
159 IoObject *IoGLU_gluBuild2DMipmaps(IoGLU *self, IoObject *locals, IoMessage *m)
161 GLenum target = IoMessage_locals_intArgAt_(m, locals, 0);
162 GLint internalFormat = IoMessage_locals_intArgAt_(m, locals, 1);
163 GLsizei width = IoMessage_locals_intArgAt_(m, locals, 2);
164 GLsizei height = IoMessage_locals_intArgAt_(m, locals, 3);
165 GLenum format = IoMessage_locals_intArgAt_(m, locals, 4);
166 GLenum type = IoMessage_locals_intArgAt_(m, locals, 5);
167 IoSeq *data = IoMessage_locals_seqArgAt_(m, locals, 6);
168 GLvoid *pointer = (GLvoid *)IoSeq_rawBytes(data);
169 GLint r;
171 r = gluBuild2DMipmaps(target,internalFormat,width,height,format,type,pointer);
172 return IONUMBER(r);
175 IoObject *IoGLU_gluErrorString(IoGLU *self, IoObject *locals, IoMessage *m)
177 GLenum name = IoMessage_locals_intArgAt_(m, locals, 0);
178 GLubyte *r;
180 r = (GLubyte *)gluErrorString(name);
181 return IOSYMBOL(r);
184 IoObject *IoGLU_gluGetString(IoGLU *self, IoObject *locals, IoMessage *m)
186 GLenum name = IoMessage_locals_intArgAt_(m, locals, 0);
187 GLubyte *r;
189 r = (GLubyte *)gluGetString(name);
190 return IOSYMBOL(r);
193 IoObject *IoGLU_gluPickMatrix(IoGLU *self, IoObject *locals, IoMessage *m)
195 GLdouble x = IoMessage_locals_doubleArgAt_(m, locals, 0);
196 GLdouble y = IoMessage_locals_doubleArgAt_(m, locals, 1);
197 GLdouble delX = IoMessage_locals_doubleArgAt_(m, locals, 2);
198 GLdouble delY = IoMessage_locals_doubleArgAt_(m, locals, 3);
199 GLint viewport = IoMessage_locals_intArgAt_(m, locals, 4);
201 gluPickMatrix(x,y,delX,delY,&viewport);
202 return self;
205 IoObject *IoGLU_gluProject(IoGLU *self, IoObject *locals, IoMessage *m)
207 GLdouble objX = IoMessage_locals_doubleArgAt_(m, locals, 0);
208 GLdouble objY = IoMessage_locals_doubleArgAt_(m, locals, 1);
209 GLdouble objZ = IoMessage_locals_doubleArgAt_(m, locals, 2);
210 List *list1 = IoList_rawList(IoMessage_locals_listArgAt_(m, locals, 3));
211 List *list2 = IoList_rawList(IoMessage_locals_listArgAt_(m, locals, 4));
212 List *list3 = IoList_rawList(IoMessage_locals_listArgAt_(m, locals, 5));
213 IoList *list4 = IoMessage_locals_listArgAt_(m, locals, 6);
214 IoList *list5 = IoMessage_locals_listArgAt_(m, locals, 7);
215 IoList *list6 = IoMessage_locals_listArgAt_(m, locals, 8);
216 GLdouble model[16] = {
217 0.0,0.0,0.0,0.0,
218 0.0,0.0,0.0,0.0,
219 0.0,0.0,0.0,0.0,
220 0.0,0.0,0.0,0.0,
222 GLdouble proj[16] = {
223 0.0,0.0,0.0,0.0,
224 0.0,0.0,0.0,0.0,
225 0.0,0.0,0.0,0.0,
226 0.0,0.0,0.0,0.0,
228 GLint view[1]={0};
229 GLdouble winX[1]={0.0};
230 GLdouble winY[1]={0.0};
231 GLdouble winZ[1]={0.0};
232 GLint r;
234 GLU_getDoubleVector(self,locals,m,list1,(GLdouble **)&model,16,"gluProject");
235 GLU_getDoubleVector(self,locals,m,list2,(GLdouble **)&proj,16,"gluProject");
236 GLU_getIntVector(self,locals,m,list3,(GLint **)&view,1,"gluProject");
237 r = gluProject(objX,objY,objZ,model,proj,view,winX,winY,winZ);
238 IoList_rawAt_put_(list4,0,IONUMBER(winX[0]));
239 IoList_rawAt_put_(list5,0,IONUMBER(winY[0]));
240 IoList_rawAt_put_(list6,0,IONUMBER(winZ[0]));
241 return IONUMBER(r);
244 IoObject *IoGLU_gluUnProject(IoGLU *self, IoObject *locals, IoMessage *m)
246 GLdouble winX = IoMessage_locals_doubleArgAt_(m, locals, 0);
247 GLdouble winY = IoMessage_locals_doubleArgAt_(m, locals, 1);
248 GLdouble winZ = IoMessage_locals_doubleArgAt_(m, locals, 2);
249 List *list1 = IoList_rawList(IoMessage_locals_listArgAt_(m, locals, 3));
250 List *list2 = IoList_rawList(IoMessage_locals_listArgAt_(m, locals, 4));
251 List *list3 = IoList_rawList(IoMessage_locals_listArgAt_(m, locals, 5));
252 IoList *list4 = IoMessage_locals_listArgAt_(m, locals, 6);
253 IoList *list5 = IoMessage_locals_listArgAt_(m, locals, 7);
254 IoList *list6 = IoMessage_locals_listArgAt_(m, locals, 8);
255 GLdouble model[16] = {
256 0.0,0.0,0.0,0.0,
257 0.0,0.0,0.0,0.0,
258 0.0,0.0,0.0,0.0,
259 0.0,0.0,0.0,0.0,
261 GLdouble proj[16] = {
262 0.0,0.0,0.0,0.0,
263 0.0,0.0,0.0,0.0,
264 0.0,0.0,0.0,0.0,
265 0.0,0.0,0.0,0.0,
267 GLint view[1]={0};
268 GLdouble objX[1]={0.0};
269 GLdouble objY[1]={0.0};
270 GLdouble objZ[1]={0.0};
271 GLint r;
273 GLU_getDoubleVector(self,locals,m,list1,(GLdouble **)&model,16,"gluUnproject");
274 GLU_getDoubleVector(self,locals,m,list2,(GLdouble **)&proj,16,"gluUnproject");
275 GLU_getIntVector(self,locals,m,list3,(GLint **)&view,1,"gluUnproject");
276 r = gluUnProject(winX,winY,winZ,model,proj,view,objX,objY,objZ);
277 IoList_rawAt_put_(list4,0,IONUMBER(objX[0]));
278 IoList_rawAt_put_(list5,0,IONUMBER(objY[0]));
279 IoList_rawAt_put_(list6,0,IONUMBER(objZ[0]));
280 return IONUMBER(r);
283 IoObject *IoGLU_gluUnProjectOrigin(IoGLU *self, IoObject *locals, IoMessage *m)
285 GLdouble winX = 0;
286 GLdouble winY = 0;
287 GLdouble winZ = 0;
289 GLdouble model[16];
290 GLdouble proj[16];
291 GLint view[4];
293 GLdouble objX, objY, objZ;
294 GLint r;
296 glGetDoublev(GL_MODELVIEW_MATRIX, model);
297 glGetDoublev(GL_PROJECTION_MATRIX, proj);
298 glGetIntegerv(GL_VIEWPORT, view);
300 r = gluUnProject(winX, winY, winZ,
301 model, proj, view,
302 &objX, &objY, &objZ);
305 UArray *rv = UArray_new();
306 UArray_setSize_(rv, 3);
307 UArray_setEncoding_(rv, CENCODING_NUMBER);
308 UArray_setItemType_(rv, CTYPE_float64_t);
309 UArray_at_putDouble_(rv, 0, objX);
310 UArray_at_putDouble_(rv, 1, objY);
311 UArray_at_putDouble_(rv, 2, objZ);
312 return IoSeq_newWithUArray_copy_(IOSTATE, rv, 0);
316 IoObject *IoGLU_gluProjectOrigin(IoGLU *self, IoObject *locals, IoMessage *m)
318 GLdouble winX = 0;
319 GLdouble winY = 0;
320 GLdouble winZ = 0;
322 GLdouble model[16];
323 GLdouble proj[16];
324 GLint view[4];
326 GLdouble objX, objY, objZ;
327 GLint r;
329 glGetDoublev(GL_MODELVIEW_MATRIX, model);
330 glGetDoublev(GL_PROJECTION_MATRIX, proj);
331 glGetIntegerv(GL_VIEWPORT, view);
333 r = gluProject(winX, winY, winZ,
334 model, proj, view,
335 &objX, &objY, &objZ);
338 UArray *rv = UArray_new();
339 UArray_setSize_(rv, 3);
340 UArray_setEncoding_(rv, CENCODING_NUMBER);
341 UArray_setItemType_(rv, CTYPE_float64_t);
342 UArray_at_putDouble_(rv, 0, objX);
343 UArray_at_putDouble_(rv, 1, objY);
344 UArray_at_putDouble_(rv, 2, objZ);
345 return IoSeq_newWithUArray_copy_(IOSTATE, rv, 0);
349 IoObject *IoGLU_gluScaleImage(IoGLU *self, IoObject *locals, IoMessage *m)
351 GLenum format = IoMessage_locals_intArgAt_(m, locals, 0);
352 GLsizei wIn = IoMessage_locals_intArgAt_(m, locals, 1);
353 GLsizei hIn = IoMessage_locals_intArgAt_(m, locals, 2);
354 GLenum typeIn = IoMessage_locals_intArgAt_(m, locals, 3);
355 IoSeq *dataIn = IoMessage_locals_seqArgAt_(m, locals, 4);
356 GLsizei wOut = IoMessage_locals_intArgAt_(m, locals, 5);
357 GLsizei hOut = IoMessage_locals_intArgAt_(m, locals, 6);
358 GLenum typeOut = IoMessage_locals_intArgAt_(m, locals, 7);
359 IoSeq *dataOut = IoMessage_locals_seqArgAt_(m, locals, 8);
360 GLvoid *pointerIn = (GLvoid *)IoSeq_rawBytes(dataIn);
361 GLvoid *pointerOut = (GLvoid *)IoSeq_rawBytes(dataOut);
362 GLint r;
364 r = gluScaleImage(format,wIn,hIn,typeIn,pointerIn,wOut,hOut,typeOut,pointerOut);
365 return IONUMBER(r);
368 /* --- Quadrics ----------------------------------------------------------------*/
370 IoObject *IoGLU_gluNewQuadric(IoGLU *self, IoObject *locals, IoMessage *m)
372 IoObject *obj = IoGLUQuadric_new(IOSTATE);
373 IoGLUQuadric_quadric(obj);
374 return obj;
377 IoObject *IoGLU_gluDeleteQuadric(IoGLU *self, IoObject *locals, IoMessage *m)
379 /* this gets done automatically when it's garbage collected */
380 return self;
383 IoObject *IoGLU_gluDisk(IoGLU *self, IoObject *locals, IoMessage *m)
385 IoGLUQuadric *q = IoMessage_locals_gluQuadricArgAt_(m, locals, 0);
386 GLdouble inner = IoMessage_locals_doubleArgAt_(m, locals, 1);
387 GLdouble outer = IoMessage_locals_doubleArgAt_(m, locals, 2);
388 GLint slices = IoMessage_locals_intArgAt_(m, locals, 3);
389 GLint stacks = IoMessage_locals_intArgAt_(m, locals, 4);
391 gluDisk(IoGLUQuadric_quadric(q), inner, outer, slices, stacks);
392 return self;
395 IoObject *IoGLU_gluPartialDisk(IoGLU *self, IoObject *locals, IoMessage *m)
397 IoGLUQuadric *q = IoMessage_locals_gluQuadricArgAt_(m, locals, 0);
398 GLdouble inner = IoMessage_locals_doubleArgAt_(m, locals, 1);
399 GLdouble outer = IoMessage_locals_doubleArgAt_(m, locals, 2);
400 GLint slices = IoMessage_locals_intArgAt_(m, locals, 3);
401 GLint stacks = IoMessage_locals_intArgAt_(m, locals, 4);
402 GLdouble start = IoMessage_locals_doubleArgAt_(m, locals, 5);
403 GLdouble sweep = IoMessage_locals_doubleArgAt_(m, locals, 6);
405 gluPartialDisk(IoGLUQuadric_quadric(q), inner, outer, slices, stacks, start, sweep);
406 return self;
409 IoObject *IoGLU_gluCylinder(IoGLU *self, IoObject *locals, IoMessage *m)
411 IoGLUQuadric *q = IoMessage_locals_gluQuadricArgAt_(m, locals, 0);
412 GLdouble base = IoMessage_locals_doubleArgAt_(m, locals, 1);
413 GLdouble top = IoMessage_locals_doubleArgAt_(m, locals, 2);
414 GLdouble height = IoMessage_locals_doubleArgAt_(m, locals, 3);
415 GLint slices = IoMessage_locals_intArgAt_(m, locals, 4);
416 GLint stacks = IoMessage_locals_intArgAt_(m, locals, 5);
418 gluCylinder(IoGLUQuadric_quadric(q), base, top, height, slices, stacks);
419 return self;
422 IoObject *IoGLU_gluQuadricDrawStyle(IoGLU *self, IoObject *locals, IoMessage *m)
424 IoGLUQuadric *q = IoMessage_locals_gluQuadricArgAt_(m, locals, 0);
425 GLenum draw = IoMessage_locals_intArgAt_(m, locals, 1);
427 gluQuadricDrawStyle(IoGLUQuadric_quadric(q), draw);
428 return self;
431 IoObject *IoGLU_gluQuadricNormals(IoGLU *self, IoObject *locals, IoMessage *m)
433 IoGLUQuadric *q = IoMessage_locals_gluQuadricArgAt_(m, locals, 0);
434 GLenum draw = IoMessage_locals_intArgAt_(m, locals, 1);
436 gluQuadricNormals(IoGLUQuadric_quadric(q), draw);
437 return self;
440 IoObject *IoGLU_gluQuadricOrientation(IoGLU *self, IoObject *locals, IoMessage *m)
442 IoGLUQuadric *q = IoMessage_locals_gluQuadricArgAt_(m, locals, 0);
443 GLenum or = IoMessage_locals_intArgAt_(m, locals, 1);
445 gluQuadricOrientation(IoGLUQuadric_quadric(q), or);
446 return self;
449 IoObject *IoGLU_gluQuadricTexture(IoGLU *self, IoObject *locals, IoMessage *m)
451 IoGLUQuadric *q = IoMessage_locals_gluQuadricArgAt_(m, locals, 0);
452 GLboolean t = IoMessage_locals_intArgAt_(m, locals, 1);
454 gluQuadricTexture(IoGLUQuadric_quadric(q), t);
455 return self;
458 IoObject *IoGLU_gluSphere(IoGLU *self, IoObject *locals, IoMessage *m)
460 IoGLUQuadric *q = IoMessage_locals_gluQuadricArgAt_(m, locals, 0);
461 GLdouble radius = IoMessage_locals_doubleArgAt_(m, locals, 1);
462 GLint slices = IoMessage_locals_intArgAt_(m, locals, 2);
463 GLint stacks = IoMessage_locals_intArgAt_(m, locals, 3);
465 gluSphere(IoGLUQuadric_quadric(q), radius, slices, stacks);
466 return self;
469 void gluRoundedBox(GLUquadricObj *quadric, GLdouble w, GLdouble h, GLdouble r, GLint slices)
471 if (r * 2.0 > w) r = w / 2.0;
472 if (r * 2.0 > h) r = h / 2.0;
474 glRectd(r, r, w - r, h - r); // middle
475 glRectd(0, r, r, h - r); // left
476 glRectd(w - r, r, w, h - r); // right
477 glRectd(r, h-r, w - r, h); // top
478 glRectd(r, 0, w-r, r); // bottom
480 gluQuadricDrawStyle(quadric, GLU_FILL);
482 glPushMatrix();
483 glTranslated(r, r, 0);
484 gluPartialDisk(quadric, 0, r, slices, 1, 180, 90);
485 glPopMatrix();
487 glPushMatrix();
488 glTranslated(r, h-r, 0);
489 gluPartialDisk(quadric, 0, r, slices, 1, 0, -90);
490 glPopMatrix();
492 glPushMatrix();
493 glTranslated(w-r, h-r, 0);
494 gluPartialDisk(quadric, 0, r, slices, 1, 0, 90);
495 glPopMatrix();
497 glPushMatrix();
498 glTranslated(w-r, r, 0);
499 gluPartialDisk(quadric, 0, r, slices, 1, 90, 90);
500 glPopMatrix();
503 void gluRoundedBoxOutline(GLUquadricObj *quadric, GLdouble w, GLdouble h, GLdouble r, GLint slices)
505 if (r * 2.0 > w) r = w / 2.0;
506 if (r * 2.0 > h) r = h / 2.0;
508 glBegin(GL_LINES);
510 // left
511 glVertex2d(0, r);
512 glVertex2d(0, h - r);
514 // right
515 glVertex2d(w, r);
516 glVertex2d(w, h - r);
518 // top
519 glVertex2d(r, h);
520 glVertex2d(w-r, h);
522 // bottom
523 glVertex2d(r, 0);
524 glVertex2d(w-r, 0);
526 glEnd();
528 gluQuadricDrawStyle(quadric, GLU_LINE);
530 glPushMatrix();
531 glTranslated(r, r, 0);
532 gluPartialDisk(quadric, r, r, slices, 1, 180, 90);
533 glPopMatrix();
535 glPushMatrix();
536 glTranslated(r, h-r, 0);
537 gluPartialDisk(quadric, r, r, slices, 1, 0, -90);
538 glPopMatrix();
540 glPushMatrix();
541 glTranslated(w-r, h-r, 0);
542 gluPartialDisk(quadric, r, r, slices, 1, 0, 90);
543 glPopMatrix();
545 glPushMatrix();
546 glTranslated(w-r, r, 0);
547 gluPartialDisk(quadric, r, r, slices, 1, 90, 90);
548 glPopMatrix();
551 IoObject *IoGLU_gluRoundedBox(IoGLU *self, IoObject *locals, IoMessage *m)
553 GLUquadricObj *q = IoGLUQuadric_quadric(IoMessage_locals_gluQuadricArgAt_(m, locals, 0));
554 GLdouble w = IoMessage_locals_doubleArgAt_(m, locals, 1);
555 GLdouble h = IoMessage_locals_doubleArgAt_(m, locals, 2);
556 GLdouble r = IoMessage_locals_doubleArgAt_(m, locals, 3);
557 GLint slices = IoMessage_locals_intArgAt_(m, locals, 4);
559 gluRoundedBox(q, w, h, r, slices);
561 return self;
565 IoObject *IoGLU_gluRoundedBoxOutline(IoGLU *self, IoObject *locals, IoMessage *m)
567 GLUquadricObj *q = IoGLUQuadric_quadric(IoMessage_locals_gluQuadricArgAt_(m, locals, 0));
568 GLdouble w = IoMessage_locals_doubleArgAt_(m, locals, 1);
569 GLdouble h = IoMessage_locals_doubleArgAt_(m, locals, 2);
570 GLdouble r = IoMessage_locals_doubleArgAt_(m, locals, 3);
571 GLint slices = IoMessage_locals_intArgAt_(m, locals, 4);
573 gluRoundedBoxOutline(q, w, h, r, slices);
575 return self;
579 /* -------------------------------------------------------------------*/
581 #include "IoGLUconst.h"
582 #include "IoGLUfunc.h"
584 void IoGLU_protoInit(IoGLU *self)
586 IoObject_setSlot_to_(self, IOSYMBOL("clone"), IOCFUNCTION(IoObject_self, NULL));
588 /* GLU Constants */
590 t_ioGLU_constTable *curpos=ioGLU_constTable;
592 while (curpos->name)
594 IoObject_setSlot_to_(self, IOSYMBOL(curpos->name), IONUMBER(curpos->value));
595 curpos++;
599 /* GLU Functions */
601 t_ioGLU_funcTable *curpos=ioGLU_funcTable;
603 while (curpos->name)
605 IoCFunction *f = IoCFunction_newWithFunctionPointer_tag_name_(IOSTATE, curpos->func, NULL, curpos->name);
607 IoObject_setSlot_to_(self, IOSYMBOL(curpos->name), f);
608 curpos++;