PDA

View Full Version : Visual Basic syntax for gluTessCallback()



jpmorgan
10-18-2000, 05:23 AM
Is anyone familiar with the Visual Basic 6.0 syntax for Tessellation callback routines?

Here's my coding and compilation errors:

tess = gluNewTess()

gluTessCallback tess, tcbTessBegin, glBegin
gluTessCallback tess, tcbTessVertex, glVertex3fv
gluTessCallback tess, tcbTessEnd, glEnd

' Last arguments above give compile errors
' "argument not optional",
' "expected function", and
' "syntax error"

gluBeginPolygon tess
gluTessBeginContour tess
' (Loop)

tessVector(0) = x
tessVector(1) = y
tessVector(2) = z
gluTessVertex tess, tessVector(0), tessVector(0)

' Second argument above gives compile error
' "Byref argument type mismatch"

' (End Loop)
gluTessEndContour tess
gluEndPolygon tess


Thanks for your help!

geostjb
03-06-2001, 06:47 AM
I know it has been a while since you posted this message but I ran across the same problem and have spent the last day and a half figuring it out. This is what I have found so far. You need to use the "AddressOf" operator to get a function pointer.
gluTessCallBack tobj, GLU_BEGIN, AddressOf glBegin

There is a catch however, you can't use the AddressOf operator on a function from a type library so you have to define a new function that calls the function you really want. I found one example on the internet at the following url:
http://is6.pacific.net.hk/~edx/meshes.htm

I haven't totally solved the problems that I have been having with tesselation in VB but this has got me passed the syntax hurdle atleast. Hope this helps.