PDA

View Full Version : Really no way to get the points calculated from nurbs objects in opengl???



BigShooter
11-04-2003, 12:11 PM
I have a problem... hopefully someone here (as always :-) can help me out...
Here's what I would like to do:
have the user click on screen and generate b-spline profile, then drag the mouse and have that curve revolve and produce a swept/revolved surface, then have the program output a list of points to a file, so that a file could be read back and the surface could be regenerated (using GL_POLYGON or GL_TRIANGLES). I can not use any external libraries, only the standard ones in ogl. I know that I will have to use unproject function to get 3de coordinates and I know that I will need to generate a new curve each time, as ogl doens't let for interactive editing (i.e. the curve could not be previsualized as the user clicks, creating more points...). Here's what I can't figure out:
- what parameters do I have to pass to nurbs object or curve (the ones build into ogl), to make it behave like b-spline curve or surface?
- Most important one: how can I pass the control points to nurbs object and somehow get a list of points or triangles that the nurbs evaluation function came up with. For instance. Input: control points. u,v step 0.05. Query: all the points (or triangles) that got evaluated, so that I could save those points in a file and then read them and display the object, but this time as GL_POLYGONS or GL_TRIANGLES ? Is this possible or do I have to write my own b-spline functions ?
- finally, using just the nurbs surfaces that come in ogl... how could I create a surface that sweeps as the user moves the mouse? For instance... a wine glass profile curve is generated (using the nurbs curve (will actually have to be b-spline)) then as the curve is completed, the user drags the mouse, and the surface is swept from 0-360 degrees. Can this be accomplished with ogl nurbs? I guess what I'm asking here is 'how' ? :-) Should I add control points as the surface is swept, or can one specify a drawing range for nurbs surface. For instance, I could pass it all the control vertices and just say, draw u from 0-0.25 and draw v from 0-0.25 (to draw just 1/4 (or 1/8)of the surface?

sorry about the lenght of this post and thank you soo much for your help guys.

Luke

dorbie
11-04-2003, 02:08 PM
See my other reply for the entry points, as for producing one spline from the control points of a different basis, you have to convert the basis and that takes some scary math. Look for things like "converting spline basis" & other related keywords. Sometimes an exact match is not possible depending on the conversion required.

There may also be some libraries that provide the spline drawing functionality you want but sit on OpenGL instead of being a part of the core API, since evaluators probably aren't hardware accelerated this may be the prefferred approach anyway w.r.t. optimization, portability and ease of use.