| 1 | /* $Id: glu32.cpp,v 1.1 2000-01-27 21:49:12 sandervl Exp $ */
|
|---|
| 2 | /*****************************************************************************/
|
|---|
| 3 | /* */
|
|---|
| 4 | /* GLU32 Toolkit */
|
|---|
| 5 | /* */
|
|---|
| 6 | /*****************************************************************************/
|
|---|
| 7 | #define INCL_BASE
|
|---|
| 8 | #include <os2.h>
|
|---|
| 9 | #include <os2wrap.h>
|
|---|
| 10 | #include <misc.h>
|
|---|
| 11 | #include <malloc.h>
|
|---|
| 12 | #include <memory.h>
|
|---|
| 13 |
|
|---|
| 14 | #include "glos2.h"
|
|---|
| 15 | #include "gluos2.h"
|
|---|
| 16 | #include "glucb32.h"
|
|---|
| 17 |
|
|---|
| 18 | /*****************************************************************************/
|
|---|
| 19 | /* */
|
|---|
| 20 | /* glu Functions */
|
|---|
| 21 | /* */
|
|---|
| 22 | /*****************************************************************************/
|
|---|
| 23 |
|
|---|
| 24 | void WIN32API gluBeginCurve(GLUnurbs* nurb)
|
|---|
| 25 | {
|
|---|
| 26 | OS2gluBeginCurve(nurb);
|
|---|
| 27 | }
|
|---|
| 28 |
|
|---|
| 29 | void WIN32API gluBeginPolygon(GLUtesselator* tess)
|
|---|
| 30 | {
|
|---|
| 31 | OS2gluBeginPolygon(tess);
|
|---|
| 32 | }
|
|---|
| 33 |
|
|---|
| 34 | void WIN32API gluBeginSurface(GLUnurbs* nurb)
|
|---|
| 35 | {
|
|---|
| 36 | OS2gluBeginSurface(nurb);
|
|---|
| 37 | }
|
|---|
| 38 |
|
|---|
| 39 | void WIN32API gluBeginTrim(GLUnurbs* nurb)
|
|---|
| 40 | {
|
|---|
| 41 | OS2gluBeginTrim(nurb);
|
|---|
| 42 | }
|
|---|
| 43 |
|
|---|
| 44 | GLint WIN32API gluBuild1DMipmaps(GLenum target,
|
|---|
| 45 | GLint component,
|
|---|
| 46 | GLsizei width,
|
|---|
| 47 | GLenum format,
|
|---|
| 48 | GLenum type,
|
|---|
| 49 | const void *data)
|
|---|
| 50 | {
|
|---|
| 51 | return OS2gluBuild1DMipmaps(target,component,width,format,type,data);
|
|---|
| 52 | }
|
|---|
| 53 |
|
|---|
| 54 | GLint WIN32API gluBuild2DMipmaps(GLenum target,
|
|---|
| 55 | GLint component,
|
|---|
| 56 | GLsizei width,
|
|---|
| 57 | GLsizei height,
|
|---|
| 58 | GLenum format,
|
|---|
| 59 | GLenum type,
|
|---|
| 60 | const void *data)
|
|---|
| 61 | {
|
|---|
| 62 | return OS2gluBuild2DMipmaps(target,component,width,height,format,type,data);
|
|---|
| 63 | }
|
|---|
| 64 |
|
|---|
| 65 | void WIN32API gluCylinder(GLUquadric* quad,
|
|---|
| 66 | GLdouble base,
|
|---|
| 67 | GLdouble top,
|
|---|
| 68 | GLdouble height,
|
|---|
| 69 | GLint slices,
|
|---|
| 70 | GLint stacks)
|
|---|
| 71 | {
|
|---|
| 72 | OS2gluCylinder(quad,base,top,height,slices,stacks);
|
|---|
| 73 | }
|
|---|
| 74 |
|
|---|
| 75 | void WIN32API gluDeleteNurbsRenderer(GLUnurbs* nurb)
|
|---|
| 76 | {
|
|---|
| 77 | OS2gluDeleteNurbsRenderer(nurb);
|
|---|
| 78 |
|
|---|
| 79 | OS2glucbDestroyCallbackForObject(GLUCB_NURBS,(void *)nurb);
|
|---|
| 80 | }
|
|---|
| 81 |
|
|---|
| 82 | void WIN32API gluDeleteQuadric (GLUquadric* quad)
|
|---|
| 83 | {
|
|---|
| 84 | OS2gluDeleteQuadric(quad);
|
|---|
| 85 |
|
|---|
| 86 | OS2glucbDestroyCallbackForObject(GLUCB_QUADRIC,(void *)quad);
|
|---|
| 87 | }
|
|---|
| 88 |
|
|---|
| 89 | void WIN32API gluDeleteTess(GLUtesselator* tess)
|
|---|
| 90 | {
|
|---|
| 91 | OS2gluDeleteTess(tess);
|
|---|
| 92 |
|
|---|
| 93 | OS2glucbDestroyCallbackForObject(GLUCB_TESS,(void *)tess);
|
|---|
| 94 | }
|
|---|
| 95 |
|
|---|
| 96 | void WIN32API gluDisk(GLUquadric* quad,
|
|---|
| 97 | GLdouble inner,
|
|---|
| 98 | GLdouble outer,
|
|---|
| 99 | GLint slices,
|
|---|
| 100 | GLint loops)
|
|---|
| 101 | {
|
|---|
| 102 | OS2gluDisk(quad,inner,outer,slices,loops);
|
|---|
| 103 | }
|
|---|
| 104 |
|
|---|
| 105 | void WIN32API gluEndCurve(GLUnurbs* nurb)
|
|---|
| 106 | {
|
|---|
| 107 | OS2gluEndCurve(nurb);
|
|---|
| 108 | }
|
|---|
| 109 |
|
|---|
| 110 | void WIN32API gluEndPolygon(GLUtesselator* tess)
|
|---|
| 111 | {
|
|---|
| 112 | OS2gluEndPolygon(tess);
|
|---|
| 113 | }
|
|---|
| 114 |
|
|---|
| 115 | void WIN32API gluEndSurface(GLUnurbs* nurb)
|
|---|
| 116 | {
|
|---|
| 117 | OS2gluEndSurface(nurb);
|
|---|
| 118 | }
|
|---|
| 119 |
|
|---|
| 120 | void WIN32API gluEndTrim(GLUnurbs* nurb)
|
|---|
| 121 | {
|
|---|
| 122 | OS2gluEndTrim(nurb);
|
|---|
| 123 | }
|
|---|
| 124 |
|
|---|
| 125 | const GLubyte * WIN32API gluErrorString(GLenum error)
|
|---|
| 126 | {
|
|---|
| 127 | return OS2gluErrorString(error);
|
|---|
| 128 | }
|
|---|
| 129 |
|
|---|
| 130 | void WIN32API gluGetNurbsProperty(GLUnurbs* nurb,
|
|---|
| 131 | GLenum property,
|
|---|
| 132 | GLfloat* data)
|
|---|
| 133 | {
|
|---|
| 134 | OS2gluGetNurbsProperty(nurb,property,data);
|
|---|
| 135 | }
|
|---|
| 136 |
|
|---|
| 137 | const GLubyte * WIN32API gluGetString(GLenum name)
|
|---|
| 138 | {
|
|---|
| 139 | return OS2gluGetString(name);
|
|---|
| 140 | }
|
|---|
| 141 |
|
|---|
| 142 | void WIN32API gluGetTessProperty(GLUtesselator* tess,
|
|---|
| 143 | GLenum which,
|
|---|
| 144 | GLdouble* data)
|
|---|
| 145 | {
|
|---|
| 146 | OS2gluGetTessProperty(tess,which,data);
|
|---|
| 147 | }
|
|---|
| 148 |
|
|---|
| 149 | void WIN32API gluLoadSamplingMatrices(GLUnurbs* nurb,
|
|---|
| 150 | const GLfloat *model,
|
|---|
| 151 | const GLfloat *perspective,
|
|---|
| 152 | const GLint *view)
|
|---|
| 153 | {
|
|---|
| 154 | OS2gluLoadSamplingMatrices(nurb,model,perspective,view);
|
|---|
| 155 | }
|
|---|
| 156 |
|
|---|
| 157 | void WIN32API gluLookAt(GLdouble eyeX,
|
|---|
| 158 | GLdouble eyeY,
|
|---|
| 159 | GLdouble eyeZ,
|
|---|
| 160 | GLdouble centerX,
|
|---|
| 161 | GLdouble centerY,
|
|---|
| 162 | GLdouble centerZ,
|
|---|
| 163 | GLdouble upX,
|
|---|
| 164 | GLdouble upY,
|
|---|
| 165 | GLdouble upZ)
|
|---|
| 166 | {
|
|---|
| 167 | OS2gluLookAt(eyeX,eyeY,eyeZ,centerX,centerY,centerZ,upX,upY,upZ);
|
|---|
| 168 | }
|
|---|
| 169 |
|
|---|
| 170 | GLUnurbs * WIN32API gluNewNurbsRenderer(void)
|
|---|
| 171 | {
|
|---|
| 172 | return OS2gluNewNurbsRenderer();
|
|---|
| 173 | }
|
|---|
| 174 |
|
|---|
| 175 | GLUquadric * WIN32API gluNewQuadric(void)
|
|---|
| 176 | {
|
|---|
| 177 | return OS2gluNewQuadric();
|
|---|
| 178 | }
|
|---|
| 179 |
|
|---|
| 180 | GLUtesselator * WIN32API gluNewTess(void)
|
|---|
| 181 | {
|
|---|
| 182 | return OS2gluNewTess();
|
|---|
| 183 | }
|
|---|
| 184 |
|
|---|
| 185 | void WIN32API gluNextContour(GLUtesselator* tess,
|
|---|
| 186 | GLenum type)
|
|---|
| 187 | {
|
|---|
| 188 | OS2gluNextContour(tess,type);
|
|---|
| 189 | }
|
|---|
| 190 |
|
|---|
| 191 | void WIN32API gluNurbsCallback(GLUnurbs* nurb,
|
|---|
| 192 | GLenum which,
|
|---|
| 193 | GLvoid (* WIN32API CallBackFunc)())
|
|---|
| 194 | {
|
|---|
| 195 | GLUOS2CALLBACK pfn=OS2glucbRegisterCallback(GLUCB_NURBS,nurb,which,CallBackFunc);
|
|---|
| 196 |
|
|---|
| 197 | OS2gluNurbsCallback(nurb,which,pfn);
|
|---|
| 198 | }
|
|---|
| 199 |
|
|---|
| 200 | void WIN32API gluNurbsCurve(GLUnurbs* nurb,
|
|---|
| 201 | GLint knotCount,
|
|---|
| 202 | GLfloat *knots,
|
|---|
| 203 | GLint stride,
|
|---|
| 204 | GLfloat *control,
|
|---|
| 205 | GLint order,
|
|---|
| 206 | GLenum type)
|
|---|
| 207 | {
|
|---|
| 208 | OS2gluNurbsCurve(nurb,knotCount,knots,stride,control,order,type);
|
|---|
| 209 | }
|
|---|
| 210 |
|
|---|
| 211 | void WIN32API gluNurbsProperty(GLUnurbs* nurb,
|
|---|
| 212 | GLenum property,
|
|---|
| 213 | GLfloat value)
|
|---|
| 214 | {
|
|---|
| 215 | OS2gluNurbsProperty(nurb,property,value);
|
|---|
| 216 | }
|
|---|
| 217 |
|
|---|
| 218 | void WIN32API gluNurbsSurface(GLUnurbs* nurb,
|
|---|
| 219 | GLint sKnotCount,
|
|---|
| 220 | GLfloat* sKnots,
|
|---|
| 221 | GLint tKnotCount,
|
|---|
| 222 | GLfloat* tKnots,
|
|---|
| 223 | GLint sStride,
|
|---|
| 224 | GLint tStride,
|
|---|
| 225 | GLfloat* control,
|
|---|
| 226 | GLint sOrder,
|
|---|
| 227 | GLint tOrder,
|
|---|
| 228 | GLenum type)
|
|---|
| 229 | {
|
|---|
| 230 | OS2gluNurbsSurface(nurb,sKnotCount,sKnots,tKnotCount,tKnots,sStride,tStride,control,sOrder,tOrder,type);
|
|---|
| 231 | }
|
|---|
| 232 |
|
|---|
| 233 | void WIN32API gluOrtho2D(GLdouble left,
|
|---|
| 234 | GLdouble right,
|
|---|
| 235 | GLdouble bottom,
|
|---|
| 236 | GLdouble top)
|
|---|
| 237 | {
|
|---|
| 238 | OS2gluOrtho2D(left,right,bottom,top);
|
|---|
| 239 | }
|
|---|
| 240 |
|
|---|
| 241 | void WIN32API gluPartialDisk(GLUquadric* quad,
|
|---|
| 242 | GLdouble inner,
|
|---|
| 243 | GLdouble outer,
|
|---|
| 244 | GLint slices,
|
|---|
| 245 | GLint loops,
|
|---|
| 246 | GLdouble start,
|
|---|
| 247 | GLdouble sweep)
|
|---|
| 248 | {
|
|---|
| 249 | OS2gluPartialDisk(quad,inner,outer,slices,loops,start,sweep);
|
|---|
| 250 | }
|
|---|
| 251 |
|
|---|
| 252 | void WIN32API gluPerspective(GLdouble fovy,
|
|---|
| 253 | GLdouble aspect,
|
|---|
| 254 | GLdouble zNear,
|
|---|
| 255 | GLdouble zFar)
|
|---|
| 256 | {
|
|---|
| 257 | OS2gluPerspective(fovy,aspect,zNear,zFar);
|
|---|
| 258 | }
|
|---|
| 259 |
|
|---|
| 260 | void WIN32API gluPickMatrix(GLdouble x,
|
|---|
| 261 | GLdouble y,
|
|---|
| 262 | GLdouble delX,
|
|---|
| 263 | GLdouble delY,
|
|---|
| 264 | GLint *viewport)
|
|---|
| 265 | {
|
|---|
| 266 | OS2gluPickMatrix(x,y,delX,delY,viewport);
|
|---|
| 267 | }
|
|---|
| 268 |
|
|---|
| 269 | GLint WIN32API gluProject(GLdouble objX,
|
|---|
| 270 | GLdouble objY,
|
|---|
| 271 | GLdouble objZ,
|
|---|
| 272 | const GLdouble *model,
|
|---|
| 273 | const GLdouble *proj,
|
|---|
| 274 | const GLint *view,
|
|---|
| 275 | GLdouble* winX,
|
|---|
| 276 | GLdouble* winY,
|
|---|
| 277 | GLdouble* winZ)
|
|---|
| 278 | {
|
|---|
| 279 | return OS2gluProject(objX,objY,objZ,model,proj,view,winX,winY,winZ);
|
|---|
| 280 | }
|
|---|
| 281 |
|
|---|
| 282 | void WIN32API gluPwlCurve(GLUnurbs* nurb,
|
|---|
| 283 | GLint count,
|
|---|
| 284 | GLfloat* data,
|
|---|
| 285 | GLint stride,
|
|---|
| 286 | GLenum type)
|
|---|
| 287 | {
|
|---|
| 288 | OS2gluPwlCurve(nurb,count,data,stride,type);
|
|---|
| 289 | }
|
|---|
| 290 |
|
|---|
| 291 | void WIN32API gluQuadricCallback(GLUquadric* quad,
|
|---|
| 292 | GLenum which,
|
|---|
| 293 | GLvoid (* WIN32API CallBackFunc)())
|
|---|
| 294 | {
|
|---|
| 295 | GLUOS2CALLBACK pfn=OS2glucbRegisterCallback(GLUCB_QUADRIC,(void *)quad,which,CallBackFunc);
|
|---|
| 296 |
|
|---|
| 297 | OS2gluQuadricCallback(quad,which,pfn);
|
|---|
| 298 | }
|
|---|
| 299 |
|
|---|
| 300 | void WIN32API gluQuadricDrawStyle(GLUquadric* quad,
|
|---|
| 301 | GLenum draw)
|
|---|
| 302 | {
|
|---|
| 303 | OS2gluQuadricDrawStyle(quad,draw);
|
|---|
| 304 | }
|
|---|
| 305 |
|
|---|
| 306 | void WIN32API gluQuadricNormals(GLUquadric* quad,
|
|---|
| 307 | GLenum normal)
|
|---|
| 308 | {
|
|---|
| 309 | OS2gluQuadricNormals(quad,normal);
|
|---|
| 310 | }
|
|---|
| 311 |
|
|---|
| 312 | void WIN32API gluQuadricOrientation(GLUquadric* quad,
|
|---|
| 313 | GLenum orientation)
|
|---|
| 314 | {
|
|---|
| 315 | OS2gluQuadricOrientation(quad,orientation);
|
|---|
| 316 | }
|
|---|
| 317 |
|
|---|
| 318 | void WIN32API gluQuadricTexture(GLUquadric* quad,
|
|---|
| 319 | GLboolean texture)
|
|---|
| 320 | {
|
|---|
| 321 | OS2gluQuadricTexture(quad,texture);
|
|---|
| 322 | }
|
|---|
| 323 |
|
|---|
| 324 | GLint WIN32API gluScaleImage(GLenum format,
|
|---|
| 325 | GLsizei wIn,
|
|---|
| 326 | GLsizei hIn,
|
|---|
| 327 | GLenum typeIn,
|
|---|
| 328 | const void *dataIn,
|
|---|
| 329 | GLsizei wOut,
|
|---|
| 330 | GLsizei hOut,
|
|---|
| 331 | GLenum typeOut,
|
|---|
| 332 | GLvoid* dataOut)
|
|---|
| 333 | {
|
|---|
| 334 | return OS2gluScaleImage(format,wIn,hIn,typeIn,dataIn,wOut,hOut,typeOut,dataOut);
|
|---|
| 335 | }
|
|---|
| 336 |
|
|---|
| 337 | void WIN32API gluSphere(GLUquadric* quad,
|
|---|
| 338 | GLdouble radius,
|
|---|
| 339 | GLint slices,
|
|---|
| 340 | GLint stacks)
|
|---|
| 341 | {
|
|---|
| 342 | OS2gluSphere(quad,radius,slices,stacks);
|
|---|
| 343 | }
|
|---|
| 344 |
|
|---|
| 345 | void WIN32API gluTessBeginContour(GLUtesselator* tess)
|
|---|
| 346 | {
|
|---|
| 347 | OS2gluTessBeginContour(tess);
|
|---|
| 348 | }
|
|---|
| 349 |
|
|---|
| 350 | void WIN32API gluTessBeginPolygon(GLUtesselator* tess,
|
|---|
| 351 | GLvoid* data)
|
|---|
| 352 | {
|
|---|
| 353 | OS2gluTessBeginPolygon(tess,data);
|
|---|
| 354 | }
|
|---|
| 355 |
|
|---|
| 356 | void WIN32API gluTessCallback(GLUtesselator* tess,
|
|---|
| 357 | GLenum which,
|
|---|
| 358 | GLvoid (* WIN32API CallBackFunc)())
|
|---|
| 359 | {
|
|---|
| 360 | GLUOS2CALLBACK pfn=OS2glucbRegisterCallback(GLUCB_TESS,(void *)tess,which,CallBackFunc);
|
|---|
| 361 |
|
|---|
| 362 | OS2gluTessCallback(tess,which,pfn);
|
|---|
| 363 | }
|
|---|
| 364 |
|
|---|
| 365 | void WIN32API gluTessEndContour(GLUtesselator* tess)
|
|---|
| 366 | {
|
|---|
| 367 | OS2gluTessEndContour(tess);
|
|---|
| 368 | }
|
|---|
| 369 |
|
|---|
| 370 | void WIN32API gluTessEndPolygon(GLUtesselator* tess)
|
|---|
| 371 | {
|
|---|
| 372 | OS2gluTessEndPolygon(tess);
|
|---|
| 373 | }
|
|---|
| 374 |
|
|---|
| 375 | void WIN32API gluTessNormal(GLUtesselator* tess,
|
|---|
| 376 | GLdouble valueX,
|
|---|
| 377 | GLdouble valueY,
|
|---|
| 378 | GLdouble valueZ)
|
|---|
| 379 | {
|
|---|
| 380 | OS2gluTessNormal(tess,valueX,valueY,valueZ);
|
|---|
| 381 | }
|
|---|
| 382 |
|
|---|
| 383 | void WIN32API gluTessProperty(GLUtesselator* tess,
|
|---|
| 384 | GLenum which,
|
|---|
| 385 | GLdouble data)
|
|---|
| 386 | {
|
|---|
| 387 | OS2gluTessProperty(tess,which,data);
|
|---|
| 388 | }
|
|---|
| 389 |
|
|---|
| 390 | void WIN32API gluTessVertex(GLUtesselator* tess,
|
|---|
| 391 | GLdouble *location,
|
|---|
| 392 | GLvoid* data)
|
|---|
| 393 | {
|
|---|
| 394 | OS2gluTessVertex(tess,location,data);
|
|---|
| 395 | }
|
|---|
| 396 |
|
|---|
| 397 | GLint WIN32API gluUnProject(GLdouble winX,
|
|---|
| 398 | GLdouble winY,
|
|---|
| 399 | GLdouble winZ,
|
|---|
| 400 | const GLdouble *model,
|
|---|
| 401 | const GLdouble *proj,
|
|---|
| 402 | const GLint *view,
|
|---|
| 403 | GLdouble* objX,
|
|---|
| 404 | GLdouble* objY,
|
|---|
| 405 | GLdouble* objZ)
|
|---|
| 406 | {
|
|---|
| 407 | return OS2gluUnProject(winX,winY,winZ,model,proj,view,objX,objY,objZ);
|
|---|
| 408 | }
|
|---|
| 409 |
|
|---|
| 410 | /*****************************************************************************/
|
|---|
| 411 | /* */
|
|---|
| 412 | /* Module Internal init and cleanup - called by initterm */
|
|---|
| 413 | /* */
|
|---|
| 414 | /*****************************************************************************/
|
|---|
| 415 |
|
|---|
| 416 | void mod_init(void)
|
|---|
| 417 | {
|
|---|
| 418 | dprintf(("GLU32 INIT\n"));
|
|---|
| 419 |
|
|---|
| 420 | DosCreateMutexSem(NULL,&hmtxGlucb,0,0);
|
|---|
| 421 | }
|
|---|
| 422 |
|
|---|
| 423 | void mod_cleanup(void)
|
|---|
| 424 | {
|
|---|
| 425 | while(Glucbs)
|
|---|
| 426 | OS2glucbDestroyGlucb(Glucbs);
|
|---|
| 427 |
|
|---|
| 428 | DosCloseMutexSem(hmtxGlucb);
|
|---|
| 429 |
|
|---|
| 430 | dprintf(("GLU32 TERM\n"));
|
|---|
| 431 | }
|
|---|