Obtaining vertices from a NURB surface.

Hello. Thanks in advance for your help.

I am rendering a NURB surface:

                sKnotCount, sKnot,
	        tKnotCount, tKnot,
		sStride, tStride,
		sOrder, tOrder,

What do I need to to in order to obtain the 3D coordinate points that describe this surface?

You need to call gluNurbsProperty(theNurb,GLU_NURBS_MODE,GLU_NURBS_TESSELLATOR);. Then you have to register a callback function gluNurbsCallback(theNurb,GLU_NURBS_VERTEX,(GLvoid (*)())vertex_callback);. Here is a simple callback function:

void CALLBACK vertex_callback(GLfloat *vertex)

For more information see gluNurbsProperty and gluNurbsCallback.

Thank you. However, I cannot build the project because GLU_NURBS_MODE and GLU_NURBS_TESSELATOR are undeclared identifiers. Is there anything else I need to do?

What version of GLU you have? I think you need version 1.3 or better to be able to use the GLU nurbs tessellator. Use gluGetString to retrieve the version number.

It says “ Microsoft Corporation”. Is there any way to upgrade? Thanks for all your help.

It seem that you have the default Microsoft implementation of OpenGL. What is your video card? Try to get the latest driver release for your video card.

I have an ATI card 4870x2. I also have the latest driver release. Catalyst 8.11. Is there any way other way to get the vertex data out of the NURB surface? I’ve searched for Glu 1.3 without any luck. I can only find the spec, but I cannot find the files I need. Is there a place where I can just download the library and header files?

I think that the Mesa project include also the source code for GLU. But I don’t know if it is possible to just install the glu portion of this software on a computer. Just to compare, my video card is a NVidia TnT2 (1999) an I have at least GLU 1.3 supported. It is strange that your card have a version older than mine. Can you verify that your OpenGL renderer is ATI/AMD, not the Microsoft 1.1 implementation version => check to see if your video driver is installed properly.

How do I check for my OpenGL renderer specifically? I know that my video driver is installed properly because of benchmarks, and the Catalyst control panel. I use a Quadro 5xx card at work, should I try that one?

Check for glGetString with GL_VENDOR,GL_RENDERER and GL_VERSION. The Mesa project include the latest GLU version provided by SGI.

check thos strings :
… etc …

I am at my job. I got:
Quadro FX 550/PCI/SSE2
NVIDIA Corporation

I am at my job. I got: Quadro FX 550/PCI/SSE2 NVIDIA Corporation
This one is correct and the software that come with the driver should support GLU 1.3. Now you have to check for your ATI graphic card.

It is still using GLU verssion 1.2.2 by Microsoft. I think it is a problem with the Visual Studio and its version of GLU. Even at work I cannot get it working. Thanks for your help.

I think I got it working. I downloaded the .h, .dll, and .lib files from here.


I have not tested all the functionality I need, but so far so good.

Thanks for your help.

I am using the code recommended in post #2 of this thread, and I am getting this error.

Error 2 error C2664: ‘gluNurbsCallback’ : cannot convert parameter 3 from ‘GLvoid (__cdecl *)(void)’ to ‘_GLUfuncptr’ c:\documents and settings\cen\my documents\572
urbseditor.cpp 457

So the problem is with my third argument not being a _GLUfuncptr. Any suggestions?

If you pass only the function name without the cast what happen. My compiler is GCC, it seem that it have a different behavior than the Microsoft compiler.

If I pass it without the cast I get the following error:

Error 2 error C2664: ‘gluNurbsCallback’ : cannot convert parameter 3 from ‘void (__stdcall *)(GLfloat *)’ to ‘_GLUfuncptr’ c:\documents and settings\cen\my documents\572
urbseditor.cpp 581

Try that:

_GLUfuncptr func;
  func = (GLvoid (*)()) vertex_callback;

It work for me. In theory, _GLUfuncptr is for GLU internal purpose.

I got it to compile by doing this cast

gluNurbsCallback(nurbRenderer, GLU_NURBS_VERTEX, (_GLUfuncptr) vertex_callback); 

Got it working on Linux (should have tried this from the begining).

Now, my problem is that when I set gluNurbsProperty and enable the gluNurbsCallback, the patch won’t render. I still get the vertices dumped to the output, but I don’t see the patch. If I comment out the property and callback, it will render.