PDA

View Full Version : gluNurbsCurve example plz...



Oscar Ugolini
20-09-2012, 19:51
i try to convert my little function frome codeblocks (it works ok...) to thinbasic,
using "gluNurbsCurve" but TB don't show me nothing.
in thinbasic_glu.inc the declare of the ext function seems different from c declare...

Can someone show me a little working example in thinbasic to use this function???
thanks all

Bye Oscar

Petr Schreiber
21-09-2012, 08:54
Hi Oscar,

the signature in C is this:



gluNurbsCurve (GLUnurbs* nurb, GLint knotCount, GLfloat *knots, GLint stride, GLfloat *control, GLint order, GLenum type);

the signature in ThinBASIC is this:


gluNurbsCurve (BYVAL nobj AS DWORD, BYVAL nknots AS GLint, BYREF knot AS GLFloat, BYVAL stride AS GLInt, BYREF ctlarray() AS GLFLoat, BYVAL order AS GLint, BYVAL ntype AS GLEnum)


So the main change is from pointer to byref (which lets ThinBASIC retrieve pointer automatically, based on variable). So where ByRef is specified, you pass variable directly, not the pointer.

I have not worked with gluNurbsCurve, but I posted few examples on nurbsy surfaces here (both 2D and 3D):
http://www.thinbasic.com/community/showthread.php?9525-qt-Nurbs-Primitives-and-more&p=72061&viewfull=1#post72061

Maybe if you could post piece of your code, I could have a look at it.


Petr

Oscar Ugolini
21-09-2012, 12:59
Hi Petr,
last night i have worked hard on my test... and i resolved :)
I've seen your posts on "nurbs" :) but i'm working on import of IGES format file, and the nurbs stored in it need "knots" value to render it, and gluNurbsCurve can render it automatically without mathematic algorytm... and work fine :) ALSO with ThinBasic and your megaFaNtAsTiC TBGL module!!!
I'll post a simple code soon :) thanks

bye, Oscar

Petr Schreiber
21-09-2012, 22:30
I am happy to hear that, looking forward to the example!


Petr