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
21 #include "wine/port.h"
29 #include "wine/library.h"
30 #include "wine/debug.h"
32 WINE_DEFAULT_DEBUG_CHANNEL(glu
);
34 typedef struct GLUnurbs GLUnurbs
;
35 typedef struct GLUquadric GLUquadric
;
36 typedef struct GLUtesselator GLUtesselator
;
37 typedef void (*_GLUfuncptr
)(void);
39 /* The only non-trivial bit of this is the *Tess* functions. Here we
40 need to wrap the callbacks up in a thunk to switch calling
41 conventions, so we use our own tesselator type to store the
42 application's callbacks. wine_gluTessCallback always sets the
43 *_DATA type of callback so that we have access to the polygon_data
44 (which is in fact just wine_GLUtesselator), in the thunk itself we can
45 check whether we should call the _DATA or non _DATA type. */
50 void (CALLBACK
*cb_tess_begin
)(int);
51 void (CALLBACK
*cb_tess_begin_data
)(int, void *);
52 void (CALLBACK
*cb_tess_vertex
)(void *);
53 void (CALLBACK
*cb_tess_vertex_data
)(void *, void *);
54 void (CALLBACK
*cb_tess_end
)(void);
55 void (CALLBACK
*cb_tess_end_data
)(void *);
56 void (CALLBACK
*cb_tess_error
)(int);
57 void (CALLBACK
*cb_tess_error_data
)(int, void *);
58 void (CALLBACK
*cb_tess_edge_flag
)(int);
59 void (CALLBACK
*cb_tess_edge_flag_data
)(int, void *);
60 void (CALLBACK
*cb_tess_combine
)(double *, void *, float *, void **);
61 void (CALLBACK
*cb_tess_combine_data
)(double *, void *, float *, void **, void *);
64 #define GLU_TESS_BEGIN 100100
65 #define GLU_TESS_VERTEX 100101
66 #define GLU_TESS_END 100102
67 #define GLU_TESS_ERROR 100103
68 #define GLU_TESS_EDGE_FLAG 100104
69 #define GLU_TESS_COMBINE 100105
70 #define GLU_TESS_BEGIN_DATA 100106
71 #define GLU_TESS_VERTEX_DATA 100107
72 #define GLU_TESS_END_DATA 100108
73 #define GLU_TESS_ERROR_DATA 100109
74 #define GLU_TESS_EDGE_FLAG_DATA 100110
75 #define GLU_TESS_COMBINE_DATA 100111
77 static void (*p_gluBeginCurve
)( GLUnurbs
* nurb
);
78 static void (*p_gluBeginSurface
)( GLUnurbs
* nurb
);
79 static void (*p_gluBeginTrim
)( GLUnurbs
* nurb
);
80 static GLint (*p_gluBuild1DMipmaps
)( GLenum target
, GLint internalFormat
, GLsizei width
, GLenum format
, GLenum type
, const void *data
);
81 static GLint (*p_gluBuild2DMipmaps
)( GLenum target
, GLint internalFormat
, GLsizei width
, GLsizei height
, GLenum format
, GLenum type
, const void *data
);
82 static void (*p_gluCylinder
)( GLUquadric
* quad
, GLdouble base
, GLdouble top
, GLdouble height
, GLint slices
, GLint stacks
);
83 static void (*p_gluDeleteNurbsRenderer
)( GLUnurbs
* nurb
);
84 static void (*p_gluDeleteQuadric
)( GLUquadric
* quad
);
85 static void (*p_gluDeleteTess
)( GLUtesselator
* tess
);
86 static void (*p_gluDisk
)( GLUquadric
* quad
, GLdouble inner
, GLdouble outer
, GLint slices
, GLint loops
);
87 static void (*p_gluEndCurve
)( GLUnurbs
* nurb
);
88 static void (*p_gluEndSurface
)( GLUnurbs
* nurb
);
89 static void (*p_gluEndTrim
)( GLUnurbs
* nurb
);
90 static const GLubyte
* (*p_gluErrorString
)( GLenum error
);
91 static void (*p_gluGetNurbsProperty
)( GLUnurbs
* nurb
, GLenum property
, GLfloat
* data
);
92 static const GLubyte
* (*p_gluGetString
)( GLenum name
);
93 static void (*p_gluGetTessProperty
)( GLUtesselator
* tess
, GLenum which
, GLdouble
* data
);
94 static void (*p_gluLoadSamplingMatrices
)( GLUnurbs
* nurb
, const GLfloat
*model
, const GLfloat
*perspective
, const GLint
*view
);
95 static void (*p_gluLookAt
)( GLdouble eyeX
, GLdouble eyeY
, GLdouble eyeZ
, GLdouble centerX
, GLdouble centerY
, GLdouble centerZ
, GLdouble upX
, GLdouble upY
, GLdouble upZ
);
96 static GLUnurbs
* (*p_gluNewNurbsRenderer
)(void);
97 static GLUquadric
* (*p_gluNewQuadric
)(void);
98 static GLUtesselator
* (*p_gluNewTess
)(void);
99 static void (*p_gluNurbsCallback
)( GLUnurbs
* nurb
, GLenum which
, _GLUfuncptr CallBackFunc
);
100 static void (*p_gluNurbsCurve
)( GLUnurbs
* nurb
, GLint knotCount
, GLfloat
*knots
, GLint stride
, GLfloat
*control
, GLint order
, GLenum type
);
101 static void (*p_gluNurbsProperty
)( GLUnurbs
* nurb
, GLenum property
, GLfloat value
);
102 static void (*p_gluNurbsSurface
)( GLUnurbs
* nurb
, GLint sKnotCount
, GLfloat
* sKnots
, GLint tKnotCount
, GLfloat
* tKnots
, GLint sStride
, GLint tStride
, GLfloat
* control
, GLint sOrder
, GLint tOrder
, GLenum type
);
103 static void (*p_gluOrtho2D
)( GLdouble left
, GLdouble right
, GLdouble bottom
, GLdouble top
);
104 static void (*p_gluPartialDisk
)( GLUquadric
* quad
, GLdouble inner
, GLdouble outer
, GLint slices
, GLint loops
, GLdouble start
, GLdouble sweep
);
105 static void (*p_gluPerspective
)( GLdouble fovy
, GLdouble aspect
, GLdouble zNear
, GLdouble zFar
);
106 static void (*p_gluPickMatrix
)( GLdouble x
, GLdouble y
, GLdouble delX
, GLdouble delY
, GLint
*viewport
);
107 static GLint (*p_gluProject
)( GLdouble objX
, GLdouble objY
, GLdouble objZ
, const GLdouble
*model
, const GLdouble
*proj
, const GLint
*view
, GLdouble
* winX
, GLdouble
* winY
, GLdouble
* winZ
);
108 static void (*p_gluPwlCurve
)( GLUnurbs
* nurb
, GLint count
, GLfloat
* data
, GLint stride
, GLenum type
);
109 static void (*p_gluQuadricCallback
)( GLUquadric
* quad
, GLenum which
, _GLUfuncptr CallBackFunc
);
110 static void (*p_gluQuadricDrawStyle
)( GLUquadric
* quad
, GLenum draw
);
111 static void (*p_gluQuadricNormals
)( GLUquadric
* quad
, GLenum normal
);
112 static void (*p_gluQuadricOrientation
)( GLUquadric
* quad
, GLenum orientation
);
113 static void (*p_gluQuadricTexture
)( GLUquadric
* quad
, GLboolean texture
);
114 static GLint (*p_gluScaleImage
)( GLenum format
, GLsizei wIn
, GLsizei hIn
, GLenum typeIn
, const void *dataIn
, GLsizei wOut
, GLsizei hOut
, GLenum typeOut
, GLvoid
* dataOut
);
115 static void (*p_gluSphere
)( GLUquadric
* quad
, GLdouble radius
, GLint slices
, GLint stacks
);
116 static void (*p_gluTessBeginContour
)( GLUtesselator
* tess
);
117 static void (*p_gluTessBeginPolygon
)( GLUtesselator
* tess
, GLvoid
* data
);
118 static void (*p_gluTessCallback
)( GLUtesselator
* tess
, GLenum which
, _GLUfuncptr CallBackFunc
);
119 static void (*p_gluTessEndContour
)( GLUtesselator
* tess
);
120 static void (*p_gluTessEndPolygon
)( GLUtesselator
* tess
);
121 static void (*p_gluTessNormal
)( GLUtesselator
* tess
, GLdouble valueX
, GLdouble valueY
, GLdouble valueZ
);
122 static void (*p_gluTessProperty
)( GLUtesselator
* tess
, GLenum which
, GLdouble data
);
123 static void (*p_gluTessVertex
)( GLUtesselator
* tess
, GLdouble
*location
, GLvoid
* data
);
124 static GLint (*p_gluUnProject
)( GLdouble winX
, GLdouble winY
, GLdouble winZ
, const GLdouble
*model
, const GLdouble
*proj
, const GLint
*view
, GLdouble
* objX
, GLdouble
* objY
, GLdouble
* objZ
);
126 static BOOL
load_libglu(void)
129 void *handle
= wine_dlopen( SONAME_LIBGLU
, RTLD_NOW
, error
, sizeof(error
) );
133 ERR( "Failed to load %s: %s\n", SONAME_LIBGLU
, error
);
136 #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; }
137 LOAD_FUNCPTR(gluBeginCurve
);
138 LOAD_FUNCPTR(gluBeginSurface
);
139 LOAD_FUNCPTR(gluBeginTrim
);
140 LOAD_FUNCPTR(gluBuild1DMipmaps
);
141 LOAD_FUNCPTR(gluBuild2DMipmaps
);
142 LOAD_FUNCPTR(gluCylinder
);
143 LOAD_FUNCPTR(gluDeleteNurbsRenderer
);
144 LOAD_FUNCPTR(gluDeleteQuadric
);
145 LOAD_FUNCPTR(gluDeleteTess
);
146 LOAD_FUNCPTR(gluDisk
);
147 LOAD_FUNCPTR(gluEndCurve
);
148 LOAD_FUNCPTR(gluEndSurface
);
149 LOAD_FUNCPTR(gluEndTrim
);
150 LOAD_FUNCPTR(gluErrorString
);
151 LOAD_FUNCPTR(gluGetNurbsProperty
);
152 LOAD_FUNCPTR(gluGetString
);
153 LOAD_FUNCPTR(gluGetTessProperty
);
154 LOAD_FUNCPTR(gluLoadSamplingMatrices
);
155 LOAD_FUNCPTR(gluLookAt
);
156 LOAD_FUNCPTR(gluNewNurbsRenderer
);
157 LOAD_FUNCPTR(gluNewQuadric
);
158 LOAD_FUNCPTR(gluNewTess
);
159 LOAD_FUNCPTR(gluNurbsCallback
);
160 LOAD_FUNCPTR(gluNurbsCurve
);
161 LOAD_FUNCPTR(gluNurbsProperty
);
162 LOAD_FUNCPTR(gluNurbsSurface
);
163 LOAD_FUNCPTR(gluOrtho2D
);
164 LOAD_FUNCPTR(gluPartialDisk
);
165 LOAD_FUNCPTR(gluPerspective
);
166 LOAD_FUNCPTR(gluPickMatrix
);
167 LOAD_FUNCPTR(gluProject
);
168 LOAD_FUNCPTR(gluPwlCurve
);
169 LOAD_FUNCPTR(gluQuadricCallback
);
170 LOAD_FUNCPTR(gluQuadricDrawStyle
);
171 LOAD_FUNCPTR(gluQuadricNormals
);
172 LOAD_FUNCPTR(gluQuadricOrientation
);
173 LOAD_FUNCPTR(gluQuadricTexture
);
174 LOAD_FUNCPTR(gluScaleImage
);
175 LOAD_FUNCPTR(gluSphere
);
176 LOAD_FUNCPTR(gluTessBeginContour
);
177 LOAD_FUNCPTR(gluTessBeginPolygon
);
178 LOAD_FUNCPTR(gluTessCallback
);
179 LOAD_FUNCPTR(gluTessEndContour
);
180 LOAD_FUNCPTR(gluTessEndPolygon
);
181 LOAD_FUNCPTR(gluTessNormal
);
182 LOAD_FUNCPTR(gluTessProperty
);
183 LOAD_FUNCPTR(gluTessVertex
);
184 LOAD_FUNCPTR(gluUnProject
);
186 TRACE( "loaded %s\n", SONAME_LIBGLU
);
191 /***********************************************************************
194 BOOL WINAPI
DllMain( HINSTANCE inst
, DWORD reason
, LPVOID reserved
)
198 case DLL_PROCESS_ATTACH
:
199 DisableThreadLibraryCalls( inst
);
200 return load_libglu();
205 /***********************************************************************
206 * gluLookAt (GLU32.@)
208 void WINAPI
wine_gluLookAt( GLdouble eyex
, GLdouble eyey
, GLdouble eyez
,
209 GLdouble centerx
, GLdouble centery
, GLdouble centerz
,
210 GLdouble upx
, GLdouble upy
, GLdouble upz
)
212 p_gluLookAt( eyex
, eyey
, eyez
, centerx
, centery
, centerz
, upx
, upy
, upz
);
215 /***********************************************************************
216 * gluOrtho2D (GLU32.@)
218 void WINAPI
wine_gluOrtho2D( GLdouble left
, GLdouble right
, GLdouble bottom
, GLdouble top
)
220 p_gluOrtho2D( left
, right
, bottom
, top
);
223 /***********************************************************************
224 * gluPerspective (GLU32.@)
226 void WINAPI
wine_gluPerspective( GLdouble fovy
, GLdouble aspect
, GLdouble zNear
, GLdouble zFar
)
228 p_gluPerspective( fovy
, aspect
, zNear
, zFar
);
231 /***********************************************************************
232 * gluPickMatrix (GLU32.@)
234 void WINAPI
wine_gluPickMatrix( GLdouble x
, GLdouble y
, GLdouble width
, GLdouble height
, GLint viewport
[4])
236 p_gluPickMatrix( x
, y
, width
, height
, viewport
);
239 /***********************************************************************
240 * gluProject (GLU32.@)
242 int WINAPI
wine_gluProject( GLdouble objx
, GLdouble objy
, GLdouble objz
, const GLdouble modelMatrix
[16],
243 const GLdouble projMatrix
[16], const GLint viewport
[4],
244 GLdouble
*winx
, GLdouble
*winy
, GLdouble
*winz
)
246 return p_gluProject( objx
, objy
, objz
, modelMatrix
, projMatrix
, viewport
, winx
, winy
, winz
);
249 /***********************************************************************
250 * gluUnProject (GLU32.@)
252 int WINAPI
wine_gluUnProject( GLdouble winx
, GLdouble winy
, GLdouble winz
, const GLdouble modelMatrix
[16],
253 const GLdouble projMatrix
[16], const GLint viewport
[4],
254 GLdouble
*objx
, GLdouble
*objy
, GLdouble
*objz
)
256 return p_gluUnProject( winx
, winy
, winz
, modelMatrix
, projMatrix
, viewport
, objx
, objy
, objz
);
259 /***********************************************************************
260 * gluErrorString (GLU32.@)
262 const GLubyte
* WINAPI
wine_gluErrorString( GLenum errCode
)
264 return p_gluErrorString( errCode
);
267 /***********************************************************************
268 * gluScaleImage (GLU32.@)
270 int WINAPI
wine_gluScaleImage( GLenum format
, GLint widthin
, GLint heightin
, GLenum typein
, const void *datain
,
271 GLint widthout
, GLint heightout
, GLenum typeout
, void *dataout
)
273 return p_gluScaleImage( format
, widthin
, heightin
, typein
, datain
,
274 widthout
, heightout
, typeout
, dataout
);
277 /***********************************************************************
278 * gluBuild1DMipmaps (GLU32.@)
280 int WINAPI
wine_gluBuild1DMipmaps( GLenum target
, GLint components
, GLint width
,
281 GLenum format
, GLenum type
, const void *data
)
283 return p_gluBuild1DMipmaps( target
, components
, width
, format
, type
, data
);
286 /***********************************************************************
287 * gluBuild2DMipmaps (GLU32.@)
289 int WINAPI
wine_gluBuild2DMipmaps( GLenum target
, GLint components
, GLint width
, GLint height
,
290 GLenum format
, GLenum type
, const void *data
)
292 return p_gluBuild2DMipmaps( target
, components
, width
, height
, format
, type
, data
);
295 /***********************************************************************
296 * gluNewQuadric (GLU32.@)
298 GLUquadric
* WINAPI
wine_gluNewQuadric(void)
300 return p_gluNewQuadric();
303 /***********************************************************************
304 * gluDeleteQuadric (GLU32.@)
306 void WINAPI
wine_gluDeleteQuadric( GLUquadric
*state
)
308 p_gluDeleteQuadric( state
);
311 /***********************************************************************
312 * gluQuadricDrawStyle (GLU32.@)
314 void WINAPI
wine_gluQuadricDrawStyle( GLUquadric
*quadObject
, GLenum drawStyle
)
316 p_gluQuadricDrawStyle( quadObject
, drawStyle
);
319 /***********************************************************************
320 * gluQuadricOrientation (GLU32.@)
322 void WINAPI
wine_gluQuadricOrientation( GLUquadric
*quadObject
, GLenum orientation
)
324 p_gluQuadricOrientation( quadObject
, orientation
);
327 /***********************************************************************
328 * gluQuadricNormals (GLU32.@)
330 void WINAPI
wine_gluQuadricNormals( GLUquadric
*quadObject
, GLenum normals
)
332 p_gluQuadricNormals( quadObject
, normals
);
335 /***********************************************************************
336 * gluQuadricTexture (GLU32.@)
338 void WINAPI
wine_gluQuadricTexture( GLUquadric
*quadObject
, GLboolean textureCoords
)
340 p_gluQuadricTexture( quadObject
, textureCoords
);
343 /***********************************************************************
344 * gluQuadricCallback (GLU32.@)
346 void WINAPI
wine_gluQuadricCallback( GLUquadric
*qobj
, GLenum which
, void (CALLBACK
*fn
)(void) )
348 /* FIXME: callback calling convention */
349 p_gluQuadricCallback( qobj
, which
, (_GLUfuncptr
)fn
);
352 /***********************************************************************
353 * gluCylinder (GLU32.@)
355 void WINAPI
wine_gluCylinder( GLUquadric
*qobj
, GLdouble baseRadius
, GLdouble topRadius
,
356 GLdouble height
, GLint slices
, GLint stacks
)
358 p_gluCylinder( qobj
, baseRadius
, topRadius
, height
, slices
, stacks
);
361 /***********************************************************************
362 * gluSphere (GLU32.@)
364 void WINAPI
wine_gluSphere( GLUquadric
*qobj
, GLdouble radius
, GLint slices
, GLint stacks
)
366 p_gluSphere( qobj
, radius
, slices
, stacks
);
369 /***********************************************************************
372 void WINAPI
wine_gluDisk( GLUquadric
*qobj
, GLdouble innerRadius
, GLdouble outerRadius
,
373 GLint slices
, GLint loops
)
375 p_gluDisk( qobj
, innerRadius
, outerRadius
, slices
, loops
);
378 /***********************************************************************
379 * gluPartialDisk (GLU32.@)
381 void WINAPI
wine_gluPartialDisk( GLUquadric
*qobj
, GLdouble innerRadius
, GLdouble outerRadius
,
382 GLint slices
, GLint loops
, GLdouble startAngle
, GLdouble sweepAngle
)
384 p_gluPartialDisk( qobj
, innerRadius
, outerRadius
, slices
, loops
, startAngle
, sweepAngle
);
387 /***********************************************************************
388 * gluNewNurbsRenderer (GLU32.@)
390 GLUnurbs
* WINAPI
wine_gluNewNurbsRenderer(void)
392 return p_gluNewNurbsRenderer();
395 /***********************************************************************
396 * gluDeleteNurbsRenderer (GLU32.@)
398 void WINAPI
wine_gluDeleteNurbsRenderer( GLUnurbs
*nobj
)
400 p_gluDeleteNurbsRenderer( nobj
);
403 /***********************************************************************
404 * gluLoadSamplingMatrices (GLU32.@)
406 void WINAPI
wine_gluLoadSamplingMatrices( GLUnurbs
*nobj
, const GLfloat modelMatrix
[16],
407 const GLfloat projMatrix
[16], const GLint viewport
[4] )
409 p_gluLoadSamplingMatrices( nobj
, modelMatrix
, projMatrix
, viewport
);
412 /***********************************************************************
413 * gluNurbsProperty (GLU32.@)
415 void WINAPI
wine_gluNurbsProperty( GLUnurbs
*nobj
, GLenum property
, GLfloat value
)
417 p_gluNurbsProperty( nobj
, property
, value
);
420 /***********************************************************************
421 * gluGetNurbsProperty (GLU32.@)
423 void WINAPI
wine_gluGetNurbsProperty( GLUnurbs
*nobj
, GLenum property
, GLfloat
*value
)
425 p_gluGetNurbsProperty( nobj
, property
, value
);
428 /***********************************************************************
429 * gluBeginCurve (GLU32.@)
431 void WINAPI
wine_gluBeginCurve( GLUnurbs
*nobj
)
433 p_gluBeginCurve( nobj
);
436 /***********************************************************************
437 * gluEndCurve (GLU32.@)
439 void WINAPI
wine_gluEndCurve( GLUnurbs
*nobj
)
441 p_gluEndCurve( nobj
);
444 /***********************************************************************
445 * gluNurbsCurve (GLU32.@)
447 void WINAPI
wine_gluNurbsCurve( GLUnurbs
*nobj
, GLint nknots
, GLfloat
*knot
,
448 GLint stride
, GLfloat
*ctlarray
, GLint order
, GLenum type
)
450 p_gluNurbsCurve( nobj
, nknots
, knot
, stride
, ctlarray
, order
, type
);
453 /***********************************************************************
454 * gluBeginSurface (GLU32.@)
456 void WINAPI
wine_gluBeginSurface( GLUnurbs
*nobj
)
458 p_gluBeginSurface( nobj
);
461 /***********************************************************************
462 * gluEndSurface (GLU32.@)
464 void WINAPI
wine_gluEndSurface( GLUnurbs
*nobj
)
466 p_gluEndSurface( nobj
);
469 /***********************************************************************
470 * gluNurbsSurface (GLU32.@)
472 void WINAPI
wine_gluNurbsSurface( GLUnurbs
*nobj
, GLint sknot_count
, float *sknot
, GLint tknot_count
,
473 GLfloat
*tknot
, GLint s_stride
, GLint t_stride
, GLfloat
*ctlarray
,
474 GLint sorder
, GLint torder
, GLenum type
)
476 p_gluNurbsSurface( nobj
, sknot_count
, sknot
, tknot_count
, tknot
,
477 s_stride
, t_stride
, ctlarray
, sorder
, torder
, type
);
480 /***********************************************************************
481 * gluBeginTrim (GLU32.@)
483 void WINAPI
wine_gluBeginTrim( GLUnurbs
*nobj
)
485 p_gluBeginTrim( nobj
);
488 /***********************************************************************
489 * gluEndTrim (GLU32.@)
491 void WINAPI
wine_gluEndTrim( GLUnurbs
*nobj
)
493 p_gluEndTrim( nobj
);
496 /***********************************************************************
497 * gluPwlCurve (GLU32.@)
499 void WINAPI
wine_gluPwlCurve( GLUnurbs
*nobj
, GLint count
, GLfloat
*array
, GLint stride
, GLenum type
)
501 p_gluPwlCurve( nobj
, count
, array
, stride
, type
);
504 /***********************************************************************
505 * gluNurbsCallback (GLU32.@)
507 void WINAPI
wine_gluNurbsCallback( GLUnurbs
*nobj
, GLenum which
, void (CALLBACK
*fn
)(void) )
509 /* FIXME: callback calling convention */
510 p_gluNurbsCallback( nobj
, which
, (_GLUfuncptr
)fn
);
513 /***********************************************************************
514 * gluGetString (GLU32.@)
516 const GLubyte
* WINAPI
wine_gluGetString( GLenum name
)
518 return p_gluGetString( name
);
521 /***********************************************************************
522 * gluCheckExtension (GLU32.@)
524 GLboolean WINAPI
wine_gluCheckExtension( const GLubyte
*extName
, const GLubyte
*extString
)
529 /***********************************************************************
530 * gluNewTess (GLU32.@)
532 wine_GLUtesselator
* WINAPI
wine_gluNewTess(void)
535 wine_GLUtesselator
*ret
;
537 if((tess
= p_gluNewTess()) == NULL
)
540 ret
= HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY
, sizeof(*ret
));
542 p_gluDeleteTess(tess
);
549 /***********************************************************************
550 * gluDeleteTess (GLU32.@)
552 void WINAPI
wine_gluDeleteTess( wine_GLUtesselator
*wine_tess
)
554 p_gluDeleteTess(wine_tess
->tess
);
555 HeapFree(GetProcessHeap(), 0, wine_tess
);
559 /***********************************************************************
560 * gluTessBeginPolygon (GLU32.@)
562 void WINAPI
wine_gluTessBeginPolygon( wine_GLUtesselator
*wine_tess
, void *polygon_data
)
564 wine_tess
->polygon_data
= polygon_data
;
566 p_gluTessBeginPolygon(wine_tess
->tess
, wine_tess
);
569 /***********************************************************************
570 * gluTessEndPolygon (GLU32.@)
572 void WINAPI
wine_gluTessEndPolygon( wine_GLUtesselator
*wine_tess
)
574 p_gluTessEndPolygon(wine_tess
->tess
);
578 static void wine_glu_tess_begin_data(int type
, wine_GLUtesselator
*wine_tess
)
580 if(wine_tess
->cb_tess_begin_data
)
581 wine_tess
->cb_tess_begin_data(type
, wine_tess
->polygon_data
);
583 wine_tess
->cb_tess_begin(type
);
586 static void wine_glu_tess_vertex_data(void *vertex_data
, wine_GLUtesselator
*wine_tess
)
588 if(wine_tess
->cb_tess_vertex_data
)
589 wine_tess
->cb_tess_vertex_data(vertex_data
, wine_tess
->polygon_data
);
591 wine_tess
->cb_tess_vertex(vertex_data
);
594 static void wine_glu_tess_end_data(wine_GLUtesselator
*wine_tess
)
596 if(wine_tess
->cb_tess_end_data
)
597 wine_tess
->cb_tess_end_data(wine_tess
->polygon_data
);
599 wine_tess
->cb_tess_end();
602 static void wine_glu_tess_error_data(int error
, wine_GLUtesselator
*wine_tess
)
604 if(wine_tess
->cb_tess_error_data
)
605 wine_tess
->cb_tess_error_data(error
, wine_tess
->polygon_data
);
607 wine_tess
->cb_tess_error(error
);
610 static void wine_glu_tess_edge_flag_data(int flag
, wine_GLUtesselator
*wine_tess
)
612 if(wine_tess
->cb_tess_edge_flag_data
)
613 wine_tess
->cb_tess_edge_flag_data(flag
, wine_tess
->polygon_data
);
615 wine_tess
->cb_tess_edge_flag(flag
);
618 static void wine_glu_tess_combine_data(double *coords
, void *vertex_data
, float *weight
, void **outData
,
619 wine_GLUtesselator
*wine_tess
)
621 if(wine_tess
->cb_tess_combine_data
)
622 wine_tess
->cb_tess_combine_data(coords
, vertex_data
, weight
, outData
, wine_tess
->polygon_data
);
624 wine_tess
->cb_tess_combine(coords
, vertex_data
, weight
, outData
);
628 /***********************************************************************
629 * gluTessCallback (GLU32.@)
631 void WINAPI
wine_gluTessCallback( wine_GLUtesselator
*tess
, GLenum which
, void (CALLBACK
*fn
)(void))
637 tess
->cb_tess_begin
= (void *)fn
;
638 new_fn
= wine_glu_tess_begin_data
;
641 case GLU_TESS_VERTEX
:
642 tess
->cb_tess_vertex
= (void *)fn
;
643 new_fn
= wine_glu_tess_vertex_data
;
647 tess
->cb_tess_end
= (void *)fn
;
648 new_fn
= wine_glu_tess_end_data
;
652 tess
->cb_tess_error
= (void *)fn
;
653 new_fn
= wine_glu_tess_error_data
;
656 case GLU_TESS_EDGE_FLAG
:
657 tess
->cb_tess_edge_flag
= (void *)fn
;
658 new_fn
= wine_glu_tess_edge_flag_data
;
661 case GLU_TESS_COMBINE
:
662 tess
->cb_tess_combine
= (void *)fn
;
663 new_fn
= wine_glu_tess_combine_data
;
666 case GLU_TESS_BEGIN_DATA
:
667 tess
->cb_tess_begin_data
= (void *)fn
;
668 new_fn
= wine_glu_tess_begin_data
;
670 case GLU_TESS_VERTEX_DATA
:
671 tess
->cb_tess_vertex_data
= (void *)fn
;
672 new_fn
= wine_glu_tess_vertex_data
;
674 case GLU_TESS_END_DATA
:
675 tess
->cb_tess_end_data
= (void *)fn
;
676 new_fn
= wine_glu_tess_end_data
;
678 case GLU_TESS_ERROR_DATA
:
679 tess
->cb_tess_error_data
= (void *)fn
;
680 new_fn
= wine_glu_tess_error_data
;
682 case GLU_TESS_EDGE_FLAG_DATA
:
683 tess
->cb_tess_edge_flag_data
= (void *)fn
;
684 new_fn
= wine_glu_tess_edge_flag_data
;
686 case GLU_TESS_COMBINE_DATA
:
687 tess
->cb_tess_combine_data
= (void *)fn
;
688 new_fn
= wine_glu_tess_combine_data
;
691 ERR("Unknown callback %d\n", which
);
694 p_gluTessCallback(tess
->tess
, which
, new_fn
);
697 /***********************************************************************
698 * gluTessBeginContour (GLU32.@)
700 void WINAPI
wine_gluTessBeginContour( wine_GLUtesselator
*tess
)
702 p_gluTessBeginContour(tess
->tess
);
705 /***********************************************************************
706 * gluTessEndContour (GLU32.@)
708 void WINAPI
wine_gluTessEndContour( wine_GLUtesselator
*tess
)
710 p_gluTessEndContour(tess
->tess
);
713 /***********************************************************************
714 * gluTessVertex (GLU32.@)
716 void WINAPI
wine_gluTessVertex( wine_GLUtesselator
*tess
, GLdouble coords
[3], void *data
)
718 p_gluTessVertex( tess
->tess
, coords
, data
);
721 /***********************************************************************
722 * gluGetTessProperty (GLU32.@)
724 void WINAPI
wine_gluGetTessProperty( wine_GLUtesselator
*tess
, GLenum which
, GLdouble
*value
)
726 p_gluGetTessProperty( tess
->tess
, which
, value
);
729 /***********************************************************************
730 * gluTessProperty (GLU32.@)
732 void WINAPI
wine_gluTessProperty( wine_GLUtesselator
*tess
, GLenum which
, GLdouble value
)
734 p_gluTessProperty( tess
->tess
, which
, value
);
737 /***********************************************************************
738 * gluTessNormal (GLU32.@)
740 void WINAPI
wine_gluTessNormal( wine_GLUtesselator
*tess
, GLdouble x
, GLdouble y
, GLdouble z
)
742 p_gluTessNormal( tess
->tess
, x
, y
, z
);
745 /***********************************************************************
746 * gluBeginPolygon (GLU32.@)
748 void WINAPI
wine_gluBeginPolygon( wine_GLUtesselator
*tess
)
750 tess
->polygon_data
= NULL
;
751 p_gluTessBeginPolygon(tess
->tess
, tess
);
752 p_gluTessBeginContour(tess
->tess
);
755 /***********************************************************************
756 * gluEndPolygon (GLU32.@)
758 void WINAPI
wine_gluEndPolygon( wine_GLUtesselator
*tess
)
760 p_gluTessEndContour(tess
->tess
);
761 p_gluTessEndPolygon(tess
->tess
);
764 /***********************************************************************
765 * gluNextContour (GLU32.@)
767 void WINAPI
wine_gluNextContour( wine_GLUtesselator
*tess
, GLenum type
)
769 p_gluTessEndContour(tess
->tess
);
770 p_gluTessBeginContour(tess
->tess
);