glu32: Load libGLU dynamically.
[wine.git] / dlls / glu32 / glu.c
blob7867a33cf7f1d79981150a54db5898100aa0b59b
1 /*
2 * Copyright 2001 Marcus Meissner
3 * Copyright 2017 Alexandre Julliard
5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Lesser General Public
7 * License as published by the Free Software Foundation; either
8 * version 2.1 of the License, or (at your option) any later version.
10 * This library is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * Lesser General Public License for more details.
15 * You should have received a copy of the GNU Lesser General Public
16 * License along with this library; if not, write to the Free Software
17 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
20 #include "config.h"
21 #include "wine/port.h"
23 #include <stdarg.h>
25 #include "windef.h"
26 #include "winbase.h"
28 #include "wine/library.h"
29 #include "wine/debug.h"
31 WINE_DEFAULT_DEBUG_CHANNEL(glu);
33 /* The only non-trivial bit of this is the *Tess* functions. Here we
34 need to wrap the callbacks up in a thunk to switch calling
35 conventions, so we use our own tesselator type to store the
36 application's callbacks. wine_gluTessCallback always sets the
37 *_DATA type of callback so that we have access to the polygon_data
38 (which is in fact just wine_tess_t), in the thunk itself we can
39 check whether we should call the _DATA or non _DATA type. */
41 typedef struct {
42 void *tess;
43 void *polygon_data;
44 void (CALLBACK *cb_tess_begin)(int);
45 void (CALLBACK *cb_tess_begin_data)(int, void *);
46 void (CALLBACK *cb_tess_vertex)(void *);
47 void (CALLBACK *cb_tess_vertex_data)(void *, void *);
48 void (CALLBACK *cb_tess_end)(void);
49 void (CALLBACK *cb_tess_end_data)(void *);
50 void (CALLBACK *cb_tess_error)(int);
51 void (CALLBACK *cb_tess_error_data)(int, void *);
52 void (CALLBACK *cb_tess_edge_flag)(int);
53 void (CALLBACK *cb_tess_edge_flag_data)(int, void *);
54 void (CALLBACK *cb_tess_combine)(double *, void *, float *, void **);
55 void (CALLBACK *cb_tess_combine_data)(double *, void *, float *, void **, void *);
56 } wine_tess_t;
58 #define GLU_TESS_BEGIN 100100
59 #define GLU_TESS_VERTEX 100101
60 #define GLU_TESS_END 100102
61 #define GLU_TESS_ERROR 100103
62 #define GLU_TESS_EDGE_FLAG 100104
63 #define GLU_TESS_COMBINE 100105
64 #define GLU_TESS_BEGIN_DATA 100106
65 #define GLU_TESS_VERTEX_DATA 100107
66 #define GLU_TESS_END_DATA 100108
67 #define GLU_TESS_ERROR_DATA 100109
68 #define GLU_TESS_EDGE_FLAG_DATA 100110
69 #define GLU_TESS_COMBINE_DATA 100111
71 static int (*p_gluBeginCurve)(void *arg0);
72 static int (*p_gluBeginSurface)(void *arg0);
73 static int (*p_gluBeginTrim)(void *arg0);
74 static int (*p_gluBuild1DMipmaps)(int arg0,int arg1,int arg2,int arg3,int arg4,void *arg5);
75 static int (*p_gluBuild2DMipmaps)(int arg0,int arg1,int arg2,int arg3,int arg4,int arg5,void *arg6);
76 static int (*p_gluCylinder)(void *arg0,double arg1,double arg2,double arg3,int arg4,int arg5);
77 static int (*p_gluDeleteNurbsRenderer)(void *arg0);
78 static int (*p_gluDeleteQuadric)(void *arg0);
79 static void (*p_gluDeleteTess)(void *);
80 static int (*p_gluDisk)(void *arg0,double arg1,double arg2,int arg3,int arg4);
81 static int (*p_gluEndCurve)(void *arg0);
82 static int (*p_gluEndSurface)(void *arg0);
83 static int (*p_gluEndTrim)(void *arg0);
84 static int (*p_gluErrorString)(int arg0);
85 static int (*p_gluGetNurbsProperty)(void *arg0,int arg1,void *arg2);
86 static int (*p_gluGetString)(int arg0);
87 static int (*p_gluLoadSamplingMatrices)(void *arg0,void *arg1,void *arg2,void *arg3);
88 static int (*p_gluLookAt)(double arg0,double arg1,double arg2,double arg3,double arg4,double arg5,double arg6,double arg7,double arg8);
89 static int (*p_gluNewNurbsRenderer)(void);
90 static int (*p_gluNewQuadric)(void);
91 static void*(*p_gluNewTess)(void);
92 static int (*p_gluNurbsCallback)(void *arg0,int arg1,void *arg2);
93 static int (*p_gluNurbsCurve)(void *arg0,int arg1,void *arg2,int arg3,void *arg4,int arg5,int arg6);
94 static int (*p_gluNurbsProperty)(void *arg0,int arg1,int arg2);
95 static int (*p_gluNurbsSurface)(void *arg0,int arg1,void *arg2,int arg3,void *arg4,int arg5,int arg6,void *arg7,int arg8,int arg9,int arg10);
96 static int (*p_gluOrtho2D)(double arg0,double arg1,double arg2,double arg3);
97 static int (*p_gluPartialDisk)(void *arg0,double arg1,double arg2,int arg3,int arg4,double arg5,double arg6);
98 static int (*p_gluPerspective)(double arg0,double arg1,double arg2,double arg3);
99 static int (*p_gluPickMatrix)(double arg0,double arg1,double arg2,double arg3,void *arg4);
100 static int (*p_gluProject)(double arg0,double arg1,double arg2,void *arg3,void *arg4,void *arg5,void *arg6,void *arg7,void *arg8);
101 static int (*p_gluPwlCurve)(void *arg0,int arg1,void *arg2,int arg3,int arg4);
102 static int (*p_gluQuadricCallback)(void *arg0,int arg1,void *arg2);
103 static int (*p_gluQuadricDrawStyle)(void *arg0,int arg1);
104 static int (*p_gluQuadricNormals)(void *arg0,int arg1);
105 static int (*p_gluQuadricOrientation)(void *arg0,int arg1);
106 static int (*p_gluQuadricTexture)(void *arg0,int arg1);
107 static int (*p_gluScaleImage)(int arg0,int arg1,int arg2,int arg3,void *arg4,int arg5,int arg6,int arg7,void *arg8);
108 static int (*p_gluSphere)(void *arg0,double arg1,int arg2,int arg3);
109 static void (*p_gluTessBeginContour)(void *);
110 static void (*p_gluTessBeginPolygon)(void *, void *);
111 static void (*p_gluTessCallback)(void *,int,void *);
112 static void (*p_gluTessEndContour)(void *);
113 static void (*p_gluTessEndPolygon)(void *);
114 static void (*p_gluTessNormal)(void *, double, double, double);
115 static void (*p_gluTessProperty)(void *, int, double);
116 static void (*p_gluTessVertex)(void *, void *, void *);
117 static int (*p_gluUnProject)(double arg0,double arg1,double arg2,void *arg3,void *arg4,void *arg5,void *arg6,void *arg7,void *arg8);
119 static BOOL load_libglu(void)
121 char error[256];
122 void *handle = wine_dlopen( SONAME_LIBGLU, RTLD_NOW, error, sizeof(error) );
124 if (!handle)
126 ERR( "Failed to load %s: %s\n", SONAME_LIBGLU, error );
127 return FALSE;
129 #define LOAD_FUNCPTR(f) if (!(p_##f = wine_dlsym( handle, #f, NULL, 0 ))) { ERR( "Can't find %s in %s\n", #f, SONAME_LIBGLU ); return FALSE; }
130 LOAD_FUNCPTR(gluBeginCurve);
131 LOAD_FUNCPTR(gluBeginSurface);
132 LOAD_FUNCPTR(gluBeginTrim);
133 LOAD_FUNCPTR(gluBuild1DMipmaps);
134 LOAD_FUNCPTR(gluBuild2DMipmaps);
135 LOAD_FUNCPTR(gluCylinder);
136 LOAD_FUNCPTR(gluDeleteNurbsRenderer);
137 LOAD_FUNCPTR(gluDeleteQuadric);
138 LOAD_FUNCPTR(gluDeleteTess);
139 LOAD_FUNCPTR(gluDisk);
140 LOAD_FUNCPTR(gluEndCurve);
141 LOAD_FUNCPTR(gluEndSurface);
142 LOAD_FUNCPTR(gluEndTrim);
143 LOAD_FUNCPTR(gluErrorString);
144 LOAD_FUNCPTR(gluGetNurbsProperty);
145 LOAD_FUNCPTR(gluGetString);
146 LOAD_FUNCPTR(gluLoadSamplingMatrices);
147 LOAD_FUNCPTR(gluLookAt);
148 LOAD_FUNCPTR(gluNewNurbsRenderer);
149 LOAD_FUNCPTR(gluNewQuadric);
150 LOAD_FUNCPTR(gluNewTess);
151 LOAD_FUNCPTR(gluNurbsCallback);
152 LOAD_FUNCPTR(gluNurbsCurve);
153 LOAD_FUNCPTR(gluNurbsProperty);
154 LOAD_FUNCPTR(gluNurbsSurface);
155 LOAD_FUNCPTR(gluOrtho2D);
156 LOAD_FUNCPTR(gluPartialDisk);
157 LOAD_FUNCPTR(gluPerspective);
158 LOAD_FUNCPTR(gluPickMatrix);
159 LOAD_FUNCPTR(gluProject);
160 LOAD_FUNCPTR(gluPwlCurve);
161 LOAD_FUNCPTR(gluQuadricCallback);
162 LOAD_FUNCPTR(gluQuadricDrawStyle);
163 LOAD_FUNCPTR(gluQuadricNormals);
164 LOAD_FUNCPTR(gluQuadricOrientation);
165 LOAD_FUNCPTR(gluQuadricTexture);
166 LOAD_FUNCPTR(gluScaleImage);
167 LOAD_FUNCPTR(gluSphere);
168 LOAD_FUNCPTR(gluTessBeginContour);
169 LOAD_FUNCPTR(gluTessBeginPolygon);
170 LOAD_FUNCPTR(gluTessCallback);
171 LOAD_FUNCPTR(gluTessEndContour);
172 LOAD_FUNCPTR(gluTessEndPolygon);
173 LOAD_FUNCPTR(gluTessNormal);
174 LOAD_FUNCPTR(gluTessProperty);
175 LOAD_FUNCPTR(gluTessVertex);
176 LOAD_FUNCPTR(gluUnProject);
177 #undef LOAD_FUNCPTR
178 TRACE( "loaded %s\n", SONAME_LIBGLU );
179 return TRUE;
183 /***********************************************************************
184 * DllMain
186 BOOL WINAPI DllMain( HINSTANCE inst, DWORD reason, LPVOID reserved )
188 switch (reason)
190 case DLL_PROCESS_ATTACH:
191 DisableThreadLibraryCalls( inst );
192 return load_libglu();
194 return TRUE;
197 /***********************************************************************
198 * gluLookAt (GLU32.@)
200 int WINAPI wine_gluLookAt(double arg0,double arg1,double arg2,double arg3,double arg4,double arg5,double arg6,double arg7,double arg8) {
201 return p_gluLookAt(arg0,arg1,arg2,arg3,arg4,arg5,arg6,arg7,arg8);
204 /***********************************************************************
205 * gluOrtho2D (GLU32.@)
207 int WINAPI wine_gluOrtho2D(double arg0,double arg1,double arg2,double arg3) {
208 return p_gluOrtho2D(arg0,arg1,arg2,arg3);
211 /***********************************************************************
212 * gluPerspective (GLU32.@)
214 int WINAPI wine_gluPerspective(double arg0,double arg1,double arg2,double arg3) {
215 return p_gluPerspective(arg0,arg1,arg2,arg3);
218 /***********************************************************************
219 * gluPickMatrix (GLU32.@)
221 int WINAPI wine_gluPickMatrix(double arg0,double arg1,double arg2,double arg3,void *arg4) {
222 return p_gluPickMatrix(arg0,arg1,arg2,arg3,arg4);
225 /***********************************************************************
226 * gluProject (GLU32.@)
228 int WINAPI wine_gluProject(double arg0,double arg1,double arg2,void *arg3,void *arg4,void *arg5,void *arg6,void *arg7,void *arg8) {
229 return p_gluProject(arg0,arg1,arg2,arg3,arg4,arg5,arg6,arg7,arg8);
232 /***********************************************************************
233 * gluUnProject (GLU32.@)
235 int WINAPI wine_gluUnProject(double arg0,double arg1,double arg2,void *arg3,void *arg4,void *arg5,void *arg6,void *arg7,void *arg8) {
236 return p_gluUnProject(arg0,arg1,arg2,arg3,arg4,arg5,arg6,arg7,arg8);
239 /***********************************************************************
240 * gluErrorString (GLU32.@)
242 int WINAPI wine_gluErrorString(int arg0) {
243 return p_gluErrorString(arg0);
246 /***********************************************************************
247 * gluScaleImage (GLU32.@)
249 int WINAPI wine_gluScaleImage(int arg0,int arg1,int arg2,int arg3,void *arg4,int arg5,int arg6,int arg7,void *arg8) {
250 return p_gluScaleImage(arg0,arg1,arg2,arg3,arg4,arg5,arg6,arg7,arg8);
253 /***********************************************************************
254 * gluBuild1DMipmaps (GLU32.@)
256 int WINAPI wine_gluBuild1DMipmaps(int arg0,int arg1,int arg2,int arg3,int arg4,void *arg5) {
257 return p_gluBuild1DMipmaps(arg0,arg1,arg2,arg3,arg4,arg5);
260 /***********************************************************************
261 * gluBuild2DMipmaps (GLU32.@)
263 int WINAPI wine_gluBuild2DMipmaps(int arg0,int arg1,int arg2,int arg3,int arg4,int arg5,void *arg6) {
264 return p_gluBuild2DMipmaps(arg0,arg1,arg2,arg3,arg4,arg5,arg6);
267 /***********************************************************************
268 * gluNewQuadric (GLU32.@)
270 int WINAPI wine_gluNewQuadric(void) {
271 return p_gluNewQuadric();
274 /***********************************************************************
275 * gluDeleteQuadric (GLU32.@)
277 int WINAPI wine_gluDeleteQuadric(void *arg0) {
278 return p_gluDeleteQuadric(arg0);
281 /***********************************************************************
282 * gluQuadricDrawStyle (GLU32.@)
284 int WINAPI wine_gluQuadricDrawStyle(void *arg0,int arg1) {
285 return p_gluQuadricDrawStyle(arg0,arg1);
288 /***********************************************************************
289 * gluQuadricOrientation (GLU32.@)
291 int WINAPI wine_gluQuadricOrientation(void *arg0,int arg1) {
292 return p_gluQuadricOrientation(arg0,arg1);
295 /***********************************************************************
296 * gluQuadricNormals (GLU32.@)
298 int WINAPI wine_gluQuadricNormals(void *arg0,int arg1) {
299 return p_gluQuadricNormals(arg0,arg1);
302 /***********************************************************************
303 * gluQuadricTexture (GLU32.@)
305 int WINAPI wine_gluQuadricTexture(void *arg0,int arg1) {
306 return p_gluQuadricTexture(arg0,arg1);
309 /***********************************************************************
310 * gluQuadricCallback (GLU32.@)
312 int WINAPI wine_gluQuadricCallback(void *arg0,int arg1,void *arg2) {
313 return p_gluQuadricCallback(arg0,arg1,arg2);
316 /***********************************************************************
317 * gluCylinder (GLU32.@)
319 int WINAPI wine_gluCylinder(void *arg0,double arg1,double arg2,double arg3,int arg4,int arg5) {
320 return p_gluCylinder(arg0,arg1,arg2,arg3,arg4,arg5);
323 /***********************************************************************
324 * gluSphere (GLU32.@)
326 int WINAPI wine_gluSphere(void *arg0,double arg1,int arg2,int arg3) {
327 return p_gluSphere(arg0,arg1,arg2,arg3);
330 /***********************************************************************
331 * gluDisk (GLU32.@)
333 int WINAPI wine_gluDisk(void *arg0,double arg1,double arg2,int arg3,int arg4) {
334 return p_gluDisk(arg0,arg1,arg2,arg3,arg4);
337 /***********************************************************************
338 * gluPartialDisk (GLU32.@)
340 int WINAPI wine_gluPartialDisk(void *arg0,double arg1,double arg2,int arg3,int arg4,double arg5,double arg6) {
341 return p_gluPartialDisk(arg0,arg1,arg2,arg3,arg4,arg5,arg6);
344 /***********************************************************************
345 * gluNewNurbsRenderer (GLU32.@)
347 int WINAPI wine_gluNewNurbsRenderer(void) {
348 return p_gluNewNurbsRenderer();
351 /***********************************************************************
352 * gluDeleteNurbsRenderer (GLU32.@)
354 int WINAPI wine_gluDeleteNurbsRenderer(void *arg0) {
355 return p_gluDeleteNurbsRenderer(arg0);
358 /***********************************************************************
359 * gluLoadSamplingMatrices (GLU32.@)
361 int WINAPI wine_gluLoadSamplingMatrices(void *arg0,void *arg1,void *arg2,void *arg3) {
362 return p_gluLoadSamplingMatrices(arg0,arg1,arg2,arg3);
365 /***********************************************************************
366 * gluNurbsProperty (GLU32.@)
368 int WINAPI wine_gluNurbsProperty(void *arg0,int arg1,int arg2) {
369 return p_gluNurbsProperty(arg0,arg1,arg2);
372 /***********************************************************************
373 * gluGetNurbsProperty (GLU32.@)
375 int WINAPI wine_gluGetNurbsProperty(void *arg0,int arg1,void *arg2) {
376 return p_gluGetNurbsProperty(arg0,arg1,arg2);
379 /***********************************************************************
380 * gluBeginCurve (GLU32.@)
382 int WINAPI wine_gluBeginCurve(void *arg0) {
383 return p_gluBeginCurve(arg0);
386 /***********************************************************************
387 * gluEndCurve (GLU32.@)
389 int WINAPI wine_gluEndCurve(void *arg0) {
390 return p_gluEndCurve(arg0);
393 /***********************************************************************
394 * gluNurbsCurve (GLU32.@)
396 int WINAPI wine_gluNurbsCurve(void *arg0,int arg1,void *arg2,int arg3,void *arg4,int arg5,int arg6) {
397 return p_gluNurbsCurve(arg0,arg1,arg2,arg3,arg4,arg5,arg6);
400 /***********************************************************************
401 * gluBeginSurface (GLU32.@)
403 int WINAPI wine_gluBeginSurface(void *arg0) {
404 return p_gluBeginSurface(arg0);
407 /***********************************************************************
408 * gluEndSurface (GLU32.@)
410 int WINAPI wine_gluEndSurface(void *arg0) {
411 return p_gluEndSurface(arg0);
414 /***********************************************************************
415 * gluNurbsSurface (GLU32.@)
417 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) {
418 return p_gluNurbsSurface(arg0,arg1,arg2,arg3,arg4,arg5,arg6,arg7,arg8,arg9,arg10);
421 /***********************************************************************
422 * gluBeginTrim (GLU32.@)
424 int WINAPI wine_gluBeginTrim(void *arg0) {
425 return p_gluBeginTrim(arg0);
428 /***********************************************************************
429 * gluEndTrim (GLU32.@)
431 int WINAPI wine_gluEndTrim(void *arg0) {
432 return p_gluEndTrim(arg0);
435 /***********************************************************************
436 * gluPwlCurve (GLU32.@)
438 int WINAPI wine_gluPwlCurve(void *arg0,int arg1,void *arg2,int arg3,int arg4) {
439 return p_gluPwlCurve(arg0,arg1,arg2,arg3,arg4);
442 /***********************************************************************
443 * gluNurbsCallback (GLU32.@)
445 int WINAPI wine_gluNurbsCallback(void *arg0,int arg1,void *arg2) {
446 return p_gluNurbsCallback(arg0,arg1,arg2);
449 /***********************************************************************
450 * gluGetString (GLU32.@)
452 int WINAPI wine_gluGetString(int arg0) {
453 return p_gluGetString(arg0);
456 /***********************************************************************
457 * gluCheckExtension (GLU32.@)
459 int WINAPI
460 wine_gluCheckExtension( const char *extName, void *extString ) {
461 return 0;
464 /***********************************************************************
465 * gluNewTess (GLU32.@)
467 void * WINAPI wine_gluNewTess(void)
469 void *tess;
470 wine_tess_t *ret;
472 if((tess = p_gluNewTess()) == NULL)
473 return NULL;
475 ret = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*ret));
476 if(!ret) {
477 p_gluDeleteTess(tess);
478 return NULL;
480 ret->tess = tess;
481 return ret;
484 /***********************************************************************
485 * gluDeleteTess (GLU32.@)
487 void WINAPI wine_gluDeleteTess(void *tess)
489 wine_tess_t *wine_tess = tess;
490 p_gluDeleteTess(wine_tess->tess);
491 HeapFree(GetProcessHeap(), 0, wine_tess);
492 return;
495 /***********************************************************************
496 * gluTessBeginPolygon (GLU32.@)
498 void WINAPI wine_gluTessBeginPolygon(void *tess, void *polygon_data)
500 wine_tess_t *wine_tess = tess;
501 wine_tess->polygon_data = polygon_data;
503 p_gluTessBeginPolygon(wine_tess->tess, wine_tess);
506 /***********************************************************************
507 * gluTessEndPolygon (GLU32.@)
509 void WINAPI wine_gluTessEndPolygon(void *tess)
511 wine_tess_t *wine_tess = tess;
512 p_gluTessEndPolygon(wine_tess->tess);
516 static void wine_glu_tess_begin_data(int type, wine_tess_t *wine_tess)
518 if(wine_tess->cb_tess_begin_data)
519 wine_tess->cb_tess_begin_data(type, wine_tess->polygon_data);
520 else
521 wine_tess->cb_tess_begin(type);
524 static void wine_glu_tess_vertex_data(void *vertex_data, wine_tess_t *wine_tess)
526 if(wine_tess->cb_tess_vertex_data)
527 wine_tess->cb_tess_vertex_data(vertex_data, wine_tess->polygon_data);
528 else
529 wine_tess->cb_tess_vertex(vertex_data);
532 static void wine_glu_tess_end_data(wine_tess_t *wine_tess)
534 if(wine_tess->cb_tess_end_data)
535 wine_tess->cb_tess_end_data(wine_tess->polygon_data);
536 else
537 wine_tess->cb_tess_end();
540 static void wine_glu_tess_error_data(int error, wine_tess_t *wine_tess)
542 if(wine_tess->cb_tess_error_data)
543 wine_tess->cb_tess_error_data(error, wine_tess->polygon_data);
544 else
545 wine_tess->cb_tess_error(error);
548 static void wine_glu_tess_edge_flag_data(int flag, wine_tess_t *wine_tess)
550 if(wine_tess->cb_tess_edge_flag_data)
551 wine_tess->cb_tess_edge_flag_data(flag, wine_tess->polygon_data);
552 else
553 wine_tess->cb_tess_edge_flag(flag);
556 static void wine_glu_tess_combine_data(double *coords, void *vertex_data, float *weight, void **outData,
557 wine_tess_t *wine_tess)
559 if(wine_tess->cb_tess_combine_data)
560 wine_tess->cb_tess_combine_data(coords, vertex_data, weight, outData, wine_tess->polygon_data);
561 else
562 wine_tess->cb_tess_combine(coords, vertex_data, weight, outData);
566 /***********************************************************************
567 * gluTessCallback (GLU32.@)
569 void WINAPI wine_gluTessCallback(void *tess,int which,void *fn)
571 wine_tess_t *wine_tess = tess;
572 switch(which) {
573 case GLU_TESS_BEGIN:
574 wine_tess->cb_tess_begin = fn;
575 fn = wine_glu_tess_begin_data;
576 which += 6;
577 break;
578 case GLU_TESS_VERTEX:
579 wine_tess->cb_tess_vertex = fn;
580 fn = wine_glu_tess_vertex_data;
581 which += 6;
582 break;
583 case GLU_TESS_END:
584 wine_tess->cb_tess_end = fn;
585 fn = wine_glu_tess_end_data;
586 which += 6;
587 break;
588 case GLU_TESS_ERROR:
589 wine_tess->cb_tess_error = fn;
590 fn = wine_glu_tess_error_data;
591 which += 6;
592 break;
593 case GLU_TESS_EDGE_FLAG:
594 wine_tess->cb_tess_edge_flag = fn;
595 fn = wine_glu_tess_edge_flag_data;
596 which += 6;
597 break;
598 case GLU_TESS_COMBINE:
599 wine_tess->cb_tess_combine = fn;
600 fn = wine_glu_tess_combine_data;
601 which += 6;
602 break;
603 case GLU_TESS_BEGIN_DATA:
604 wine_tess->cb_tess_begin_data = fn;
605 fn = wine_glu_tess_begin_data;
606 break;
607 case GLU_TESS_VERTEX_DATA:
608 wine_tess->cb_tess_vertex_data = fn;
609 fn = wine_glu_tess_vertex_data;
610 break;
611 case GLU_TESS_END_DATA:
612 wine_tess->cb_tess_end_data = fn;
613 fn = wine_glu_tess_end_data;
614 break;
615 case GLU_TESS_ERROR_DATA:
616 wine_tess->cb_tess_error_data = fn;
617 fn = wine_glu_tess_error_data;
618 break;
619 case GLU_TESS_EDGE_FLAG_DATA:
620 wine_tess->cb_tess_edge_flag_data = fn;
621 fn = wine_glu_tess_edge_flag_data;
622 break;
623 case GLU_TESS_COMBINE_DATA:
624 wine_tess->cb_tess_combine_data = fn;
625 fn = wine_glu_tess_combine_data;
626 break;
627 default:
628 ERR("Unknown callback %d\n", which);
629 break;
631 p_gluTessCallback(wine_tess->tess, which, fn);
634 /***********************************************************************
635 * gluTessBeginContour (GLU32.@)
637 void WINAPI wine_gluTessBeginContour(void *tess)
639 wine_tess_t *wine_tess = tess;
640 p_gluTessBeginContour(wine_tess->tess);
643 /***********************************************************************
644 * gluTessEndContour (GLU32.@)
646 void WINAPI wine_gluTessEndContour(void *tess)
648 wine_tess_t *wine_tess = tess;
649 p_gluTessEndContour(wine_tess->tess);
652 /***********************************************************************
653 * gluTessVertex (GLU32.@)
655 void WINAPI wine_gluTessVertex(void *tess,void *arg1,void *arg2)
657 wine_tess_t *wine_tess = tess;
658 p_gluTessVertex(wine_tess->tess, arg1, arg2);
662 /***********************************************************************
663 * gluTessProperty (GLU32.@)
665 void WINAPI wine_gluTessProperty(void *tess, int arg1, double arg2)
667 wine_tess_t *wine_tess = tess;
668 p_gluTessProperty(wine_tess->tess, arg1, arg2);
671 /***********************************************************************
672 * gluTessNormal (GLU32.@)
674 void WINAPI wine_gluTessNormal(void *tess, double arg1, double arg2, double arg3)
676 wine_tess_t *wine_tess = tess;
677 p_gluTessNormal(wine_tess->tess, arg1, arg2, arg3);
680 /***********************************************************************
681 * gluBeginPolygon (GLU32.@)
683 void WINAPI wine_gluBeginPolygon(void *tess)
685 wine_tess_t *wine_tess = tess;
686 wine_tess->polygon_data = NULL;
687 p_gluTessBeginPolygon(wine_tess->tess, wine_tess);
688 p_gluTessBeginContour(wine_tess->tess);
691 /***********************************************************************
692 * gluEndPolygon (GLU32.@)
694 void WINAPI wine_gluEndPolygon(void *tess)
696 wine_tess_t *wine_tess = tess;
697 p_gluTessEndContour(wine_tess->tess);
698 p_gluTessEndPolygon(wine_tess->tess);
701 /***********************************************************************
702 * gluNextContour (GLU32.@)
704 void WINAPI wine_gluNextContour(void *tess, int arg1)
706 wine_tess_t *wine_tess = tess;
707 p_gluTessEndContour(wine_tess->tess);
708 p_gluTessBeginContour(wine_tess->tess);