00001
00002
00003
00004
00005 #include <GL/gl.h>
00006 #include <GL/glu.h>
00007 #include <GL/glx.h>
00008 #include "util.h"
00009
00010 struct tessinfo {
00011 GLdouble vert[3];
00012 GLint tp;
00013 GLdouble tcoord[2];
00014 GLint np;
00015 GLdouble ncoord[3];
00016 };
00017
00018 void glClearColorfv(v)
00019 eusfloat_t v[4];
00020 {
00021 glClearColor((GLclampf)v[0], (GLclampf)v[1], (GLclampf)v[2], (GLclampf)v[3]);
00022 }
00023
00024 void glOrtho6f(left, right, bottom, top, near, far)
00025 eusfloat_t left;
00026 eusfloat_t right;
00027 eusfloat_t bottom;
00028 eusfloat_t top;
00029 eusfloat_t near;
00030 eusfloat_t far;
00031 {
00032 glOrtho((GLdouble)left, (GLdouble)right, (GLdouble)bottom, (GLdouble)top,
00033 (GLdouble)near, (GLdouble)far);
00034 }
00035
00036 void glOrthofv(v)
00037 eusfloat_t v[6];
00038 {
00039 glOrtho((GLdouble)v[0], (GLdouble)v[1], (GLdouble)v[2], (GLdouble)v[3],
00040 (GLdouble)v[4], (GLdouble)v[5]);
00041 }
00042
00043 void glRotatefv(v)
00044 eusfloat_t v[4];
00045 {
00046 glRotatef((GLfloat)v[0], (GLfloat)v[1], (GLfloat)v[2], (GLfloat)v[3]);
00047 }
00048
00049 void glTranslatefv(v)
00050 eusfloat_t v[3];
00051 {
00052 glTranslatef((GLfloat)v[0], (GLfloat)v[1], (GLfloat)v[2]);
00053 }
00054
00055
00056 void glClipPlanef(pl, eqn)
00057 eusinteger_t pl;
00058 eusfloat_t eqn[4];
00059 {
00060 GLdouble d_eqn[4];
00061
00062 d_eqn[0] = eqn[0];
00063 d_eqn[1] = eqn[1];
00064 d_eqn[2] = eqn[2];
00065 d_eqn[3] = eqn[3];
00066
00067 glClipPlane((GLenum)pl, d_eqn);
00068 }
00069
00070 void gluPerspectivefv(v)
00071 eusfloat_t v[4];
00072 {
00073 gluPerspective((GLdouble)v[0], (GLdouble)v[1],
00074 (GLdouble)v[2], (GLdouble)v[3]);
00075 }
00076
00077 void gluLookAtfv(v)
00078 eusfloat_t v[9];
00079 {
00080 gluLookAt((GLdouble)v[0], (GLdouble)v[1], (GLdouble)v[2],
00081 (GLdouble)v[3], (GLdouble)v[4], (GLdouble)v[5],
00082 (GLdouble)v[6], (GLdouble)v[7], (GLdouble)v[8]);
00083 }
00084
00085 void gluTessCallbackl(tobj, which, fn)
00086 eusinteger_t *tobj;
00087 eusinteger_t which;
00088 eusinteger_t fn;
00089 {
00090 gluTessCallback((GLUtriangulatorObj *)tobj, (GLenum)which,
00091 (void (*)()) ( (fn << 2)));
00092 }
00093
00094 void glClearAccumfv(v)
00095 eusfloat_t v[4];
00096 {
00097 glClearAccum((GLfloat)v[0], (GLfloat)v[1], (GLfloat)v[2], (GLfloat)v[3]);
00098 }
00099
00100 void glAccumfv(op, v)
00101 eusinteger_t op;
00102 eusfloat_t v[1];
00103 {
00104 glAccum((GLenum)op, (GLfloat)v[0]);
00105 }
00106
00107 void gluDiskfv(qobj, v)
00108 eusinteger_t qobj;
00109 eusfloat_t v[4];
00110 {
00111 gluDisk((GLUquadricObj *)qobj, (GLdouble)v[0], (GLdouble)v[1],
00112 (GLint)v[2], (GLint)v[3]);
00113 }
00114
00115 void gluPartialDiskfv(qobj, v)
00116 eusinteger_t *qobj;
00117 eusfloat_t v[6];
00118 {
00119 gluPartialDisk((GLUquadricObj *)qobj, (GLdouble)v[0], (GLdouble)v[1],
00120 (GLint)v[2], (GLint)v[3], (GLdouble)v[4], (GLdouble)v[5]);
00121 }
00122
00123 void glScalefv(v)
00124 eusfloat_t v[3];
00125 {
00126 glScalef((GLfloat)v[0], (GLfloat)v[1], (GLfloat)v[2]);
00127 }
00128
00129 void gluNurbsPropertyfv(nobj, property, value)
00130 eusinteger_t nobj;
00131 eusinteger_t property;
00132 eusfloat_t *value;
00133 {
00134 gluNurbsProperty((GLUnurbsObj *)nobj, (GLenum)property, (GLfloat)*value);
00135 }
00136
00137 void glMapGrid2fv(v)
00138 eusfloat_t v[6];
00139 {
00140 glMapGrid2f((GLint)v[0], (GLfloat)v[1], (GLfloat)v[2],
00141 (GLint)v[3], (GLfloat)v[4], (GLfloat)v[5]);
00142 }
00143
00144 void glBitmapfv(w, h, v, b)
00145 eusinteger_t w;
00146 eusinteger_t h;
00147 eusfloat_t v[4];
00148 eusinteger_t b;
00149 {
00150 glBitmap((GLsizei)w, (GLsizei)h,
00151 (GLfloat)v[0], (GLfloat)v[1], (GLfloat)v[2], (GLfloat)v[3],
00152 (GLubyte *)b);
00153 }
00154
00155 void glMap1fv(target, args, points)
00156 eusinteger_t target;
00157 eusfloat_t args[4];
00158 eusinteger_t points;
00159 {
00160 glMap1f((GLenum)target, (GLfloat)args[0], (GLfloat)args[1],
00161 (GLint)args[2], (GLint)args[3], (GLfloat *)points);
00162 }
00163
00164 void glMap2fv(target, args, points)
00165 eusinteger_t target;
00166 eusfloat_t args[8];
00167 eusinteger_t points;
00168 {
00169 glMap2f((GLenum)target,
00170 (GLfloat)args[0], (GLfloat)args[1], (GLint)args[2], (GLint)args[3],
00171 (GLfloat)args[4], (GLfloat)args[5], (GLint)args[6], (GLint)args[7],
00172 (GLfloat *)points);
00173 }
00174
00175 void glFrustumfv(v)
00176 eusfloat_t v[6];
00177 {
00178 glFrustum((GLdouble)v[0], (GLdouble)v[1], (GLdouble)v[2],
00179 (GLdouble)v[3], (GLdouble)v[4], (GLdouble)v[5]);
00180 }
00181
00182 void gluOrtho2Dfv(v)
00183 eusfloat_t v[4];
00184 {
00185 gluOrtho2D((GLdouble)v[0], (GLdouble)v[1], (GLdouble)v[2], (GLdouble)v[3]);
00186 }
00187
00188 void glPointSizefv(v)
00189 eusfloat_t v[1];
00190 {
00191 glPointSize((GLfloat)v[0]);
00192 }
00193
00194 void glClearIndexfv(v)
00195 eusfloat_t v[1];
00196 {
00197 glClearIndex((GLfloat)v[0]);
00198 }
00199
00200 eusinteger_t alloctessinfo(vert, tp, tcoord, np, ncoord)
00201 eusfloat_t vert[3];
00202 eusinteger_t tp;
00203 eusfloat_t tcoord[2];
00204 eusinteger_t np;
00205 eusfloat_t ncoord[2];
00206 {
00207 struct tessinfo *i;
00208 int len = sizeof (struct tessinfo);
00209
00210 if (!(i = (void *) malloc(len))) {
00211 perror("alloctessinfo: malloc");
00212 exit(1);
00213 }
00214
00215 #if 0
00216 printf("alloctessinfo: received vert: %05.3f %05.3f %05.3f tcoord[%d]: %05.3f %05.3f ncoord[%d]: %05.3f %05.3f %05.3f\n",
00217 vert[0], vert[1], vert[2],
00218 tp, tcoord[0], tcoord[1],
00219 np, ncoord[0], ncoord[1], ncoord[2]);
00220 #endif
00221
00222 bzero(i, len);
00223
00224 i->vert[0] = (GLdouble)vert[0];
00225 i->vert[1] = (GLdouble)vert[1];
00226 i->vert[2] = (GLdouble)vert[2];
00227
00228 if (i->tp = tp) {
00229 i->tcoord[0] = (GLdouble)tcoord[0];
00230 i->tcoord[1] = (GLdouble)tcoord[1];
00231 }
00232
00233 if (i->np = np) {
00234 i->ncoord[0] = (GLdouble)ncoord[0];
00235 i->ncoord[1] = (GLdouble)ncoord[1];
00236 i->ncoord[2] = (GLdouble)ncoord[2];
00237 }
00238
00239 return (eusinteger_t)i;
00240 }
00241
00242 void tess_vertex_cb(i)
00243 eusinteger_t i;
00244 {
00245 glVertex3dv(((struct tessinfo *)i)->vert);
00246 if (((struct tessinfo *)i)->tp)
00247 glTexCoord2dv(((struct tessinfo *)i)->tcoord);
00248 }
00249
00250 void glDepthRangefv(clamp)
00251 eusfloat_t clamp[2];
00252 {
00253 glDepthRange((GLclampd)clamp[0], (GLclampd)clamp[1]);
00254 }
00255
00256 #if 0
00257 void glPolygonOffsetEXTfv(v)
00258 eusfloat_t v[2];
00259 {
00260 glPolygonOffsetEXT((GLfloat)v[0], (GLfloat)v[1]);
00261 }
00262 #endif
00263
00264 #if x86_64
00265 void glPointSized (double d) {
00266 glPointSize((float)d);
00267 }
00268 void glLineWidthd (double d) {
00269 glLineWidth((float)d);
00270 }
00271 void gluNurbsPropertyd(GLUnurbs* nurb, GLenum property, double value) {
00272 gluNurbsProperty(nurb, property, (GLfloat)value);
00273 }
00274 #endif