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, fn2)
00086 eusinteger_t *tobj;
00087 eusinteger_t which;
00088 eusinteger_t fn;
00089 eusinteger_t fn2;
00090 {
00091 eusinteger_t addr = fn << 2;
00092 if ( fn2 != 0 ) addr = addr | (fn2 & 0x0000ffff);
00093 gluTessCallback((GLUtriangulatorObj *)tobj, (GLenum)which,
00094 (void (*)()) ( addr ));
00095 }
00096
00097 void glClearAccumfv(v)
00098 eusfloat_t v[4];
00099 {
00100 glClearAccum((GLfloat)v[0], (GLfloat)v[1], (GLfloat)v[2], (GLfloat)v[3]);
00101 }
00102
00103 void glAccumfv(op, v)
00104 eusinteger_t op;
00105 eusfloat_t v[1];
00106 {
00107 glAccum((GLenum)op, (GLfloat)v[0]);
00108 }
00109
00110 void gluDiskfv(qobj, v)
00111 eusinteger_t qobj;
00112 eusfloat_t v[4];
00113 {
00114 gluDisk((GLUquadricObj *)qobj, (GLdouble)v[0], (GLdouble)v[1],
00115 (GLint)v[2], (GLint)v[3]);
00116 }
00117
00118 void gluPartialDiskfv(qobj, v)
00119 eusinteger_t *qobj;
00120 eusfloat_t v[6];
00121 {
00122 gluPartialDisk((GLUquadricObj *)qobj, (GLdouble)v[0], (GLdouble)v[1],
00123 (GLint)v[2], (GLint)v[3], (GLdouble)v[4], (GLdouble)v[5]);
00124 }
00125
00126 void glScalefv(v)
00127 eusfloat_t v[3];
00128 {
00129 glScalef((GLfloat)v[0], (GLfloat)v[1], (GLfloat)v[2]);
00130 }
00131
00132 void gluNurbsPropertyfv(nobj, property, value)
00133 eusinteger_t nobj;
00134 eusinteger_t property;
00135 eusfloat_t *value;
00136 {
00137 gluNurbsProperty((GLUnurbsObj *)nobj, (GLenum)property, (GLfloat)*value);
00138 }
00139
00140 void glMapGrid2fv(v)
00141 eusfloat_t v[6];
00142 {
00143 glMapGrid2f((GLint)v[0], (GLfloat)v[1], (GLfloat)v[2],
00144 (GLint)v[3], (GLfloat)v[4], (GLfloat)v[5]);
00145 }
00146
00147 void glBitmapfv(w, h, v, b)
00148 eusinteger_t w;
00149 eusinteger_t h;
00150 eusfloat_t v[4];
00151 eusinteger_t b;
00152 {
00153 glBitmap((GLsizei)w, (GLsizei)h,
00154 (GLfloat)v[0], (GLfloat)v[1], (GLfloat)v[2], (GLfloat)v[3],
00155 (GLubyte *)b);
00156 }
00157
00158 void glMap1fv(target, args, points)
00159 eusinteger_t target;
00160 eusfloat_t args[4];
00161 eusinteger_t points;
00162 {
00163 glMap1f((GLenum)target, (GLfloat)args[0], (GLfloat)args[1],
00164 (GLint)args[2], (GLint)args[3], (GLfloat *)points);
00165 }
00166
00167 void glMap2fv(target, args, points)
00168 eusinteger_t target;
00169 eusfloat_t args[8];
00170 eusinteger_t points;
00171 {
00172 glMap2f((GLenum)target,
00173 (GLfloat)args[0], (GLfloat)args[1], (GLint)args[2], (GLint)args[3],
00174 (GLfloat)args[4], (GLfloat)args[5], (GLint)args[6], (GLint)args[7],
00175 (GLfloat *)points);
00176 }
00177
00178 void glFrustumfv(v)
00179 eusfloat_t v[6];
00180 {
00181 glFrustum((GLdouble)v[0], (GLdouble)v[1], (GLdouble)v[2],
00182 (GLdouble)v[3], (GLdouble)v[4], (GLdouble)v[5]);
00183 }
00184
00185 void gluOrtho2Dfv(v)
00186 eusfloat_t v[4];
00187 {
00188 gluOrtho2D((GLdouble)v[0], (GLdouble)v[1], (GLdouble)v[2], (GLdouble)v[3]);
00189 }
00190
00191 void glPointSizefv(v)
00192 eusfloat_t v[1];
00193 {
00194 glPointSize((GLfloat)v[0]);
00195 }
00196
00197 void glClearIndexfv(v)
00198 eusfloat_t v[1];
00199 {
00200 glClearIndex((GLfloat)v[0]);
00201 }
00202
00203 eusinteger_t alloctessinfo(vert, tp, tcoord, np, ncoord)
00204 eusfloat_t vert[3];
00205 eusinteger_t tp;
00206 eusfloat_t tcoord[2];
00207 eusinteger_t np;
00208 eusfloat_t ncoord[2];
00209 {
00210 struct tessinfo *i;
00211 int len = sizeof (struct tessinfo);
00212
00213 if (!(i = (void *) malloc(len))) {
00214 perror("alloctessinfo: malloc");
00215 exit(1);
00216 }
00217
00218 #if 0
00219 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",
00220 vert[0], vert[1], vert[2],
00221 tp, tcoord[0], tcoord[1],
00222 np, ncoord[0], ncoord[1], ncoord[2]);
00223 #endif
00224
00225 bzero(i, len);
00226
00227 i->vert[0] = (GLdouble)vert[0];
00228 i->vert[1] = (GLdouble)vert[1];
00229 i->vert[2] = (GLdouble)vert[2];
00230
00231 if (i->tp = tp) {
00232 i->tcoord[0] = (GLdouble)tcoord[0];
00233 i->tcoord[1] = (GLdouble)tcoord[1];
00234 }
00235
00236 if (i->np = np) {
00237 i->ncoord[0] = (GLdouble)ncoord[0];
00238 i->ncoord[1] = (GLdouble)ncoord[1];
00239 i->ncoord[2] = (GLdouble)ncoord[2];
00240 }
00241
00242 return (eusinteger_t)i;
00243 }
00244
00245 void tess_vertex_cb(i)
00246 eusinteger_t i;
00247 {
00248 glVertex3dv(((struct tessinfo *)i)->vert);
00249 if (((struct tessinfo *)i)->tp)
00250 glTexCoord2dv(((struct tessinfo *)i)->tcoord);
00251 }
00252
00253 void glDepthRangefv(clamp)
00254 eusfloat_t clamp[2];
00255 {
00256 glDepthRange((GLclampd)clamp[0], (GLclampd)clamp[1]);
00257 }
00258
00259 #if 0
00260 void glPolygonOffsetEXTfv(v)
00261 eusfloat_t v[2];
00262 {
00263 glPolygonOffsetEXT((GLfloat)v[0], (GLfloat)v[1]);
00264 }
00265 #endif
00266
00267 #if (WORD_SIZE == 64)
00268 void glPointSized (double d) {
00269 glPointSize((float)d);
00270 }
00271 void glLineWidthd (double d) {
00272 glLineWidth((float)d);
00273 }
00274 void gluNurbsPropertyd(GLUnurbs* nurb, GLenum property, double value) {
00275 gluNurbsProperty(nurb, property, (GLfloat)value);
00276 }
00277 #endif