webservices/tests: Add tests.
[wine.git] / dlls / glu32 / glu.c
blob4f0d0e2f7d911191ebdf38c1f74d18ac87abe385
1 /*
2 * Copyright 2001 Marcus Meissner
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation; either
7 * version 2.1 of the License, or (at your option) any later version.
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Lesser General Public License for more details.
14 * You should have received a copy of the GNU Lesser General Public
15 * License along with this library; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
19 #include <stdarg.h>
21 #include "windef.h"
22 #include "winbase.h"
24 #include "wine/debug.h"
26 WINE_DEFAULT_DEBUG_CHANNEL(glu);
28 /* The only non-trivial bit of this is the *Tess* functions. Here we
29 need to wrap the callbacks up in a thunk to switch calling
30 conventions, so we use our own tesselator type to store the
31 application's callbacks. wine_gluTessCallback always sets the
32 *_DATA type of callback so that we have access to the polygon_data
33 (which is in fact just wine_tess_t), in the thunk itself we can
34 check whether we should call the _DATA or non _DATA type. */
36 typedef struct {
37 void *tess;
38 void *polygon_data;
39 void (CALLBACK *cb_tess_begin)(int);
40 void (CALLBACK *cb_tess_begin_data)(int, void *);
41 void (CALLBACK *cb_tess_vertex)(void *);
42 void (CALLBACK *cb_tess_vertex_data)(void *, void *);
43 void (CALLBACK *cb_tess_end)(void);
44 void (CALLBACK *cb_tess_end_data)(void *);
45 void (CALLBACK *cb_tess_error)(int);
46 void (CALLBACK *cb_tess_error_data)(int, void *);
47 void (CALLBACK *cb_tess_edge_flag)(int);
48 void (CALLBACK *cb_tess_edge_flag_data)(int, void *);
49 void (CALLBACK *cb_tess_combine)(double *, void *, float *, void **);
50 void (CALLBACK *cb_tess_combine_data)(double *, void *, float *, void **, void *);
51 } wine_tess_t;
53 #define GLU_TESS_BEGIN 100100
54 #define GLU_TESS_VERTEX 100101
55 #define GLU_TESS_END 100102
56 #define GLU_TESS_ERROR 100103
57 #define GLU_TESS_EDGE_FLAG 100104
58 #define GLU_TESS_COMBINE 100105
59 #define GLU_TESS_BEGIN_DATA 100106
60 #define GLU_TESS_VERTEX_DATA 100107
61 #define GLU_TESS_END_DATA 100108
62 #define GLU_TESS_ERROR_DATA 100109
63 #define GLU_TESS_EDGE_FLAG_DATA 100110
64 #define GLU_TESS_COMBINE_DATA 100111
66 /***********************************************************************
67 * gluLookAt (GLU32.@)
69 extern int gluLookAt(double arg0,double arg1,double arg2,double arg3,double arg4,double arg5,double arg6,double arg7,double arg8);
70 int WINAPI wine_gluLookAt(double arg0,double arg1,double arg2,double arg3,double arg4,double arg5,double arg6,double arg7,double arg8) {
71 return gluLookAt(arg0,arg1,arg2,arg3,arg4,arg5,arg6,arg7,arg8);
74 /***********************************************************************
75 * gluOrtho2D (GLU32.@)
77 extern int gluOrtho2D(double arg0,double arg1,double arg2,double arg3);
78 int WINAPI wine_gluOrtho2D(double arg0,double arg1,double arg2,double arg3) {
79 return gluOrtho2D(arg0,arg1,arg2,arg3);
82 /***********************************************************************
83 * gluPerspective (GLU32.@)
85 extern int gluPerspective(double arg0,double arg1,double arg2,double arg3);
86 int WINAPI wine_gluPerspective(double arg0,double arg1,double arg2,double arg3) {
87 return gluPerspective(arg0,arg1,arg2,arg3);
90 /***********************************************************************
91 * gluPickMatrix (GLU32.@)
93 extern int gluPickMatrix(double arg0,double arg1,double arg2,double arg3,void *arg4);
94 int WINAPI wine_gluPickMatrix(double arg0,double arg1,double arg2,double arg3,void *arg4) {
95 return gluPickMatrix(arg0,arg1,arg2,arg3,arg4);
98 /***********************************************************************
99 * gluProject (GLU32.@)
101 extern int gluProject(double arg0,double arg1,double arg2,void *arg3,void *arg4,void *arg5,void *arg6,void *arg7,void *arg8);
102 int WINAPI wine_gluProject(double arg0,double arg1,double arg2,void *arg3,void *arg4,void *arg5,void *arg6,void *arg7,void *arg8) {
103 return gluProject(arg0,arg1,arg2,arg3,arg4,arg5,arg6,arg7,arg8);
106 /***********************************************************************
107 * gluUnProject (GLU32.@)
109 extern int gluUnProject(double arg0,double arg1,double arg2,void *arg3,void *arg4,void *arg5,void *arg6,void *arg7,void *arg8);
110 int WINAPI wine_gluUnProject(double arg0,double arg1,double arg2,void *arg3,void *arg4,void *arg5,void *arg6,void *arg7,void *arg8) {
111 return gluUnProject(arg0,arg1,arg2,arg3,arg4,arg5,arg6,arg7,arg8);
114 /***********************************************************************
115 * gluErrorString (GLU32.@)
117 extern int gluErrorString(int arg0);
118 int WINAPI wine_gluErrorString(int arg0) {
119 return gluErrorString(arg0);
122 /***********************************************************************
123 * gluScaleImage (GLU32.@)
125 extern int gluScaleImage(int arg0,int arg1,int arg2,int arg3,void *arg4,int arg5,int arg6,int arg7,void *arg8);
126 int WINAPI wine_gluScaleImage(int arg0,int arg1,int arg2,int arg3,void *arg4,int arg5,int arg6,int arg7,void *arg8) {
127 return gluScaleImage(arg0,arg1,arg2,arg3,arg4,arg5,arg6,arg7,arg8);
130 /***********************************************************************
131 * gluBuild1DMipmaps (GLU32.@)
133 extern int gluBuild1DMipmaps(int arg0,int arg1,int arg2,int arg3,int arg4,void *arg5);
134 int WINAPI wine_gluBuild1DMipmaps(int arg0,int arg1,int arg2,int arg3,int arg4,void *arg5) {
135 return gluBuild1DMipmaps(arg0,arg1,arg2,arg3,arg4,arg5);
138 /***********************************************************************
139 * gluBuild2DMipmaps (GLU32.@)
141 extern int gluBuild2DMipmaps(int arg0,int arg1,int arg2,int arg3,int arg4,int arg5,void *arg6);
142 int WINAPI wine_gluBuild2DMipmaps(int arg0,int arg1,int arg2,int arg3,int arg4,int arg5,void *arg6) {
143 return gluBuild2DMipmaps(arg0,arg1,arg2,arg3,arg4,arg5,arg6);
146 /***********************************************************************
147 * gluNewQuadric (GLU32.@)
149 extern int gluNewQuadric(void);
150 int WINAPI wine_gluNewQuadric(void) {
151 return gluNewQuadric();
154 /***********************************************************************
155 * gluDeleteQuadric (GLU32.@)
157 extern int gluDeleteQuadric(void *arg0);
158 int WINAPI wine_gluDeleteQuadric(void *arg0) {
159 return gluDeleteQuadric(arg0);
162 /***********************************************************************
163 * gluQuadricDrawStyle (GLU32.@)
165 extern int gluQuadricDrawStyle(void *arg0,int arg1);
166 int WINAPI wine_gluQuadricDrawStyle(void *arg0,int arg1) {
167 return gluQuadricDrawStyle(arg0,arg1);
170 /***********************************************************************
171 * gluQuadricOrientation (GLU32.@)
173 extern int gluQuadricOrientation(void *arg0,int arg1);
174 int WINAPI wine_gluQuadricOrientation(void *arg0,int arg1) {
175 return gluQuadricOrientation(arg0,arg1);
178 /***********************************************************************
179 * gluQuadricNormals (GLU32.@)
181 extern int gluQuadricNormals(void *arg0,int arg1);
182 int WINAPI wine_gluQuadricNormals(void *arg0,int arg1) {
183 return gluQuadricNormals(arg0,arg1);
186 /***********************************************************************
187 * gluQuadricTexture (GLU32.@)
189 extern int gluQuadricTexture(void *arg0,int arg1);
190 int WINAPI wine_gluQuadricTexture(void *arg0,int arg1) {
191 return gluQuadricTexture(arg0,arg1);
194 /***********************************************************************
195 * gluQuadricCallback (GLU32.@)
197 extern int gluQuadricCallback(void *arg0,int arg1,void *arg2);
198 int WINAPI wine_gluQuadricCallback(void *arg0,int arg1,void *arg2) {
199 return gluQuadricCallback(arg0,arg1,arg2);
202 /***********************************************************************
203 * gluCylinder (GLU32.@)
205 extern int gluCylinder(void *arg0,double arg1,double arg2,double arg3,int arg4,int arg5);
206 int WINAPI wine_gluCylinder(void *arg0,double arg1,double arg2,double arg3,int arg4,int arg5) {
207 return gluCylinder(arg0,arg1,arg2,arg3,arg4,arg5);
210 /***********************************************************************
211 * gluSphere (GLU32.@)
213 extern int gluSphere(void *arg0,double arg1,int arg2,int arg3);
214 int WINAPI wine_gluSphere(void *arg0,double arg1,int arg2,int arg3) {
215 return gluSphere(arg0,arg1,arg2,arg3);
218 /***********************************************************************
219 * gluDisk (GLU32.@)
221 extern int gluDisk(void *arg0,double arg1,double arg2,int arg3,int arg4);
222 int WINAPI wine_gluDisk(void *arg0,double arg1,double arg2,int arg3,int arg4) {
223 return gluDisk(arg0,arg1,arg2,arg3,arg4);
226 /***********************************************************************
227 * gluPartialDisk (GLU32.@)
229 extern int gluPartialDisk(void *arg0,double arg1,double arg2,int arg3,int arg4,double arg5,double arg6);
230 int WINAPI wine_gluPartialDisk(void *arg0,double arg1,double arg2,int arg3,int arg4,double arg5,double arg6) {
231 return gluPartialDisk(arg0,arg1,arg2,arg3,arg4,arg5,arg6);
234 /***********************************************************************
235 * gluNewNurbsRenderer (GLU32.@)
237 extern int gluNewNurbsRenderer(void);
238 int WINAPI wine_gluNewNurbsRenderer(void) {
239 return gluNewNurbsRenderer();
242 /***********************************************************************
243 * gluDeleteNurbsRenderer (GLU32.@)
245 extern int gluDeleteNurbsRenderer(void *arg0);
246 int WINAPI wine_gluDeleteNurbsRenderer(void *arg0) {
247 return gluDeleteNurbsRenderer(arg0);
250 /***********************************************************************
251 * gluLoadSamplingMatrices (GLU32.@)
253 extern int gluLoadSamplingMatrices(void *arg0,void *arg1,void *arg2,void *arg3);
254 int WINAPI wine_gluLoadSamplingMatrices(void *arg0,void *arg1,void *arg2,void *arg3) {
255 return gluLoadSamplingMatrices(arg0,arg1,arg2,arg3);
258 /***********************************************************************
259 * gluNurbsProperty (GLU32.@)
261 extern int gluNurbsProperty(void *arg0,int arg1,int arg2);
262 int WINAPI wine_gluNurbsProperty(void *arg0,int arg1,int arg2) {
263 return gluNurbsProperty(arg0,arg1,arg2);
266 /***********************************************************************
267 * gluGetNurbsProperty (GLU32.@)
269 extern int gluGetNurbsProperty(void *arg0,int arg1,void *arg2);
270 int WINAPI wine_gluGetNurbsProperty(void *arg0,int arg1,void *arg2) {
271 return gluGetNurbsProperty(arg0,arg1,arg2);
274 /***********************************************************************
275 * gluBeginCurve (GLU32.@)
277 extern int gluBeginCurve(void *arg0);
278 int WINAPI wine_gluBeginCurve(void *arg0) {
279 return gluBeginCurve(arg0);
282 /***********************************************************************
283 * gluEndCurve (GLU32.@)
285 extern int gluEndCurve(void *arg0);
286 int WINAPI wine_gluEndCurve(void *arg0) {
287 return gluEndCurve(arg0);
290 /***********************************************************************
291 * gluNurbsCurve (GLU32.@)
293 extern int gluNurbsCurve(void *arg0,int arg1,void *arg2,int arg3,void *arg4,int arg5,int arg6);
294 int WINAPI wine_gluNurbsCurve(void *arg0,int arg1,void *arg2,int arg3,void *arg4,int arg5,int arg6) {
295 return gluNurbsCurve(arg0,arg1,arg2,arg3,arg4,arg5,arg6);
298 /***********************************************************************
299 * gluBeginSurface (GLU32.@)
301 extern int gluBeginSurface(void *arg0);
302 int WINAPI wine_gluBeginSurface(void *arg0) {
303 return gluBeginSurface(arg0);
306 /***********************************************************************
307 * gluEndSurface (GLU32.@)
309 extern int gluEndSurface(void *arg0);
310 int WINAPI wine_gluEndSurface(void *arg0) {
311 return gluEndSurface(arg0);
314 /***********************************************************************
315 * gluNurbsSurface (GLU32.@)
317 extern int gluNurbsSurface(void *arg0,int arg1,void *arg2,int arg3,void *arg4,int arg5,int arg6,void *arg7,int arg8,int arg9,int arg10);
318 int WINAPI wine_gluNurbsSurface(void *arg0,int arg1,void *arg2,int arg3,void *arg4,int arg5,int arg6,void *arg7,int arg8,int arg9,int arg10) {
319 return gluNurbsSurface(arg0,arg1,arg2,arg3,arg4,arg5,arg6,arg7,arg8,arg9,arg10);
322 /***********************************************************************
323 * gluBeginTrim (GLU32.@)
325 extern int gluBeginTrim(void *arg0);
326 int WINAPI wine_gluBeginTrim(void *arg0) {
327 return gluBeginTrim(arg0);
330 /***********************************************************************
331 * gluEndTrim (GLU32.@)
333 extern int gluEndTrim(void *arg0);
334 int WINAPI wine_gluEndTrim(void *arg0) {
335 return gluEndTrim(arg0);
338 /***********************************************************************
339 * gluPwlCurve (GLU32.@)
341 extern int gluPwlCurve(void *arg0,int arg1,void *arg2,int arg3,int arg4);
342 int WINAPI wine_gluPwlCurve(void *arg0,int arg1,void *arg2,int arg3,int arg4) {
343 return gluPwlCurve(arg0,arg1,arg2,arg3,arg4);
346 /***********************************************************************
347 * gluNurbsCallback (GLU32.@)
349 extern int gluNurbsCallback(void *arg0,int arg1,void *arg2);
350 int WINAPI wine_gluNurbsCallback(void *arg0,int arg1,void *arg2) {
351 return gluNurbsCallback(arg0,arg1,arg2);
354 /***********************************************************************
355 * gluGetString (GLU32.@)
357 extern int gluGetString(int arg0);
358 int WINAPI wine_gluGetString(int arg0) {
359 return gluGetString(arg0);
362 /***********************************************************************
363 * gluCheckExtension (GLU32.@)
365 int WINAPI
366 wine_gluCheckExtension( const char *extName, void *extString ) {
367 return 0;
370 extern void *gluNewTess(void);
371 extern void gluDeleteTess(void *);
373 /***********************************************************************
374 * gluNewTess (GLU32.@)
376 void * WINAPI wine_gluNewTess(void)
378 void *tess;
379 wine_tess_t *ret;
381 if((tess = gluNewTess()) == NULL)
382 return NULL;
384 ret = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*ret));
385 if(!ret) {
386 gluDeleteTess(tess);
387 return NULL;
389 ret->tess = tess;
390 return ret;
393 /***********************************************************************
394 * gluDeleteTess (GLU32.@)
396 void WINAPI wine_gluDeleteTess(void *tess)
398 wine_tess_t *wine_tess = tess;
399 gluDeleteTess(wine_tess->tess);
400 HeapFree(GetProcessHeap(), 0, wine_tess);
401 return;
404 /***********************************************************************
405 * gluTessBeginPolygon (GLU32.@)
407 extern void gluTessBeginPolygon(void *, void *);
408 void WINAPI wine_gluTessBeginPolygon(void *tess, void *polygon_data)
410 wine_tess_t *wine_tess = tess;
411 wine_tess->polygon_data = polygon_data;
413 gluTessBeginPolygon(wine_tess->tess, wine_tess);
416 /***********************************************************************
417 * gluTessEndPolygon (GLU32.@)
419 extern void gluTessEndPolygon(void *);
420 void WINAPI wine_gluTessEndPolygon(void *tess)
422 wine_tess_t *wine_tess = tess;
423 gluTessEndPolygon(wine_tess->tess);
427 static void wine_glu_tess_begin_data(int type, wine_tess_t *wine_tess)
429 if(wine_tess->cb_tess_begin_data)
430 wine_tess->cb_tess_begin_data(type, wine_tess->polygon_data);
431 else
432 wine_tess->cb_tess_begin(type);
435 static void wine_glu_tess_vertex_data(void *vertex_data, wine_tess_t *wine_tess)
437 if(wine_tess->cb_tess_vertex_data)
438 wine_tess->cb_tess_vertex_data(vertex_data, wine_tess->polygon_data);
439 else
440 wine_tess->cb_tess_vertex(vertex_data);
443 static void wine_glu_tess_end_data(wine_tess_t *wine_tess)
445 if(wine_tess->cb_tess_end_data)
446 wine_tess->cb_tess_end_data(wine_tess->polygon_data);
447 else
448 wine_tess->cb_tess_end();
451 static void wine_glu_tess_error_data(int error, wine_tess_t *wine_tess)
453 if(wine_tess->cb_tess_error_data)
454 wine_tess->cb_tess_error_data(error, wine_tess->polygon_data);
455 else
456 wine_tess->cb_tess_error(error);
459 static void wine_glu_tess_edge_flag_data(int flag, wine_tess_t *wine_tess)
461 if(wine_tess->cb_tess_edge_flag_data)
462 wine_tess->cb_tess_edge_flag_data(flag, wine_tess->polygon_data);
463 else
464 wine_tess->cb_tess_edge_flag(flag);
467 static void wine_glu_tess_combine_data(double *coords, void *vertex_data, float *weight, void **outData,
468 wine_tess_t *wine_tess)
470 if(wine_tess->cb_tess_combine_data)
471 wine_tess->cb_tess_combine_data(coords, vertex_data, weight, outData, wine_tess->polygon_data);
472 else
473 wine_tess->cb_tess_combine(coords, vertex_data, weight, outData);
477 /***********************************************************************
478 * gluTessCallback (GLU32.@)
480 extern void gluTessCallback(void *,int,void *);
481 void WINAPI wine_gluTessCallback(void *tess,int which,void *fn)
483 wine_tess_t *wine_tess = tess;
484 switch(which) {
485 case GLU_TESS_BEGIN:
486 wine_tess->cb_tess_begin = fn;
487 fn = wine_glu_tess_begin_data;
488 which += 6;
489 break;
490 case GLU_TESS_VERTEX:
491 wine_tess->cb_tess_vertex = fn;
492 fn = wine_glu_tess_vertex_data;
493 which += 6;
494 break;
495 case GLU_TESS_END:
496 wine_tess->cb_tess_end = fn;
497 fn = wine_glu_tess_end_data;
498 which += 6;
499 break;
500 case GLU_TESS_ERROR:
501 wine_tess->cb_tess_error = fn;
502 fn = wine_glu_tess_error_data;
503 which += 6;
504 break;
505 case GLU_TESS_EDGE_FLAG:
506 wine_tess->cb_tess_edge_flag = fn;
507 fn = wine_glu_tess_edge_flag_data;
508 which += 6;
509 break;
510 case GLU_TESS_COMBINE:
511 wine_tess->cb_tess_combine = fn;
512 fn = wine_glu_tess_combine_data;
513 which += 6;
514 break;
515 case GLU_TESS_BEGIN_DATA:
516 wine_tess->cb_tess_begin_data = fn;
517 fn = wine_glu_tess_begin_data;
518 break;
519 case GLU_TESS_VERTEX_DATA:
520 wine_tess->cb_tess_vertex_data = fn;
521 fn = wine_glu_tess_vertex_data;
522 break;
523 case GLU_TESS_END_DATA:
524 wine_tess->cb_tess_end_data = fn;
525 fn = wine_glu_tess_end_data;
526 break;
527 case GLU_TESS_ERROR_DATA:
528 wine_tess->cb_tess_error_data = fn;
529 fn = wine_glu_tess_error_data;
530 break;
531 case GLU_TESS_EDGE_FLAG_DATA:
532 wine_tess->cb_tess_edge_flag_data = fn;
533 fn = wine_glu_tess_edge_flag_data;
534 break;
535 case GLU_TESS_COMBINE_DATA:
536 wine_tess->cb_tess_combine_data = fn;
537 fn = wine_glu_tess_combine_data;
538 break;
539 default:
540 ERR("Unknown callback %d\n", which);
541 break;
543 gluTessCallback(wine_tess->tess, which, fn);
546 /***********************************************************************
547 * gluTessBeginContour (GLU32.@)
549 extern void gluTessBeginContour(void *);
550 void WINAPI wine_gluTessBeginContour(void *tess)
552 wine_tess_t *wine_tess = tess;
553 gluTessBeginContour(wine_tess->tess);
556 /***********************************************************************
557 * gluTessEndContour (GLU32.@)
559 extern void gluTessEndContour(void *);
560 void WINAPI wine_gluTessEndContour(void *tess)
562 wine_tess_t *wine_tess = tess;
563 gluTessEndContour(wine_tess->tess);
566 /***********************************************************************
567 * gluTessVertex (GLU32.@)
569 extern void gluTessVertex(void *, void *, void *);
570 void WINAPI wine_gluTessVertex(void *tess,void *arg1,void *arg2)
572 wine_tess_t *wine_tess = tess;
573 gluTessVertex(wine_tess->tess, arg1, arg2);
577 /***********************************************************************
578 * gluTessProperty (GLU32.@)
580 extern void gluTessProperty(void *, int, double);
581 void WINAPI wine_gluTessProperty(void *tess, int arg1, double arg2)
583 wine_tess_t *wine_tess = tess;
584 gluTessProperty(wine_tess->tess, arg1, arg2);
587 /***********************************************************************
588 * gluTessNormal (GLU32.@)
590 extern void gluTessNormal(void *, double, double, double);
591 void WINAPI wine_gluTessNormal(void *tess, double arg1, double arg2, double arg3)
593 wine_tess_t *wine_tess = tess;
594 gluTessNormal(wine_tess->tess, arg1, arg2, arg3);
597 /***********************************************************************
598 * gluBeginPolygon (GLU32.@)
600 void WINAPI wine_gluBeginPolygon(void *tess)
602 wine_tess_t *wine_tess = tess;
603 wine_tess->polygon_data = NULL;
604 gluTessBeginPolygon(wine_tess->tess, wine_tess);
605 gluTessBeginContour(wine_tess->tess);
608 /***********************************************************************
609 * gluEndPolygon (GLU32.@)
611 void WINAPI wine_gluEndPolygon(void *tess)
613 wine_tess_t *wine_tess = tess;
614 gluTessEndContour(wine_tess->tess);
615 gluTessEndPolygon(wine_tess->tess);
618 /***********************************************************************
619 * gluNextContour (GLU32.@)
621 void WINAPI wine_gluNextContour(void *tess, int arg1)
623 wine_tess_t *wine_tess = tess;
624 gluTessEndContour(wine_tess->tess);
625 gluTessBeginContour(wine_tess->tess);