OpenGL-1.1.0 compile problem in cygwin-1.7

Phan, Linh H linh.h.phan@jpl.nasa.gov
Tue Dec 9 20:22:00 GMT 2008


Hi Andre,

  This:

  gluTessCallback(tobj, (GLenum)GLU_BEGIN, glBegin);
  gluTessCallback(tobj, (GLenum)GLU_END, glEnd);
  gluTessCallback(tobj, (GLenum)GLU_VERTEX, glVertex2fv);

Would give me these errors:
x.c++: In function `void test()':
x.c++:7: error: invalid conversion from `void (*)(GLenum)' to `void (*)()'
x.c++:7: error:   initializing argument 3 of `void gluTessCallback(GLUtesselator*, GLenum, void (*)())'
x.c++:9: error: invalid conversion from `void (*)(const GLfloat*)' to `void (*)()'
x.c++:9: error:   initializing argument 3 of `void gluTessCallback(GLUtesselator*, GLenum, void (*)())'

But the below fixes the problem:
  gluTessCallback(tobj, (GLenum)GLU_BEGIN, (_GLUfuncptr)glBegin);
  gluTessCallback(tobj, (GLenum)GLU_END, glEnd);
  gluTessCallback(tobj, (GLenum)GLU_VERTEX, (_GLUfuncptr)glVertex2fv);

Thanks Andre,

Linh

-----Original Message-----
From: cygwin-xfree-owner@cygwin.com [mailto:cygwin-xfree-owner@cygwin.com] On Behalf Of André Bleau
Sent: Tuesday, December 09, 2008 5:38 AM
To: cygwin-xfree@cygwin.com
Subject: RE: OpenGL-1.1.0 compile problem in cygwin-1.7


"Phan, Linh H"  wrote:
>
> Hi Brian,
>
> Can you show me how I can fix the cast?  I tried this:
>
> #include
> #include
> void test (void)
> {
>   GLUtesselator *tobj = (GLUtesselator *)gluNewTess();
>   gluTessCallback(tobj, (GLenum)GLU_BEGIN, (void (*)())glBegin);
>   gluTessCallback(tobj, (GLenum)GLU_END, glEnd);
>   gluTessCallback(tobj, (GLenum)GLU_VERTEX, (void (*)())glVertex2fv);
> }
>
> And that fixed it for glEnd, but I don't know how to fix the glBegin and glVertex2fv.
> This is not my code; it's part of the SGI OpenInventor library.
>
> Thank you,
>
> Linh
>

Hi Linh,

Did you try:

#include
#include
void test (void)
{
  GLUtesselator *tobj = gluNewTess();
  gluTessCallback(tobj, (GLenum)GLU_BEGIN, glBegin);
  gluTessCallback(tobj, (GLenum)GLU_END, glEnd);
  gluTessCallback(tobj, (GLenum)GLU_VERTEX, glVertex2fv);
}

Anyway, glu.h shows that the prototype for gluTessCallback is:

GLAPI void APIENTRY gluTessCallback (GLUtesselator* tess, GLenum which, _GLUfuncptr CallBackFunc);

so (_GLUfuncptr) is the obvious cast, no?


- André Bleau, Cygwin's volunteer OpenGL package maintainer.

Please direct any question or comment about the OpenGL package to cygwin at cygwin dot com
_________________________________________________________________


--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://x.cygwin.com/docs/
FAQ:                   http://x.cygwin.com/docs/faq/


--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://x.cygwin.com/docs/
FAQ:                   http://x.cygwin.com/docs/faq/



More information about the Cygwin-xfree mailing list