OpenGL Nurbs

88dc730f0f71e55be39de0ad103bd9ff
0
Alienizer 109 Aug 29, 2012 at 15:11

I’ve made an app to create a nurb terrain using gluNurbsSurface() and everything works fine, knots, control points and all. But how do you read back all the poly from the surface so it can be exported???

3 Replies

Please log in or register to post a reply.

88dc730f0f71e55be39de0ad103bd9ff
0
Alienizer 109 Aug 30, 2012 at 18:58

I found the answer, which is…

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)
{
  std::cout<<"("<<vertex[0]<<","<<vertex[1]<<","<<vertex[2]<<")"<<std::endl;
  std::cout.flush();
}
6837d514b487de395be51432d9cdd078
0
TheNut 179 Aug 31, 2012 at 10:44

Because it happens, it’s always a good idea to post your solution to your own question. You never know when someone comes looking for the same answer and is saddened when they read this post. I haven’t touch GLU in ages, but I believe your solution was to use gluNurbsCallback, correct?

88dc730f0f71e55be39de0ad103bd9ff
0
Alienizer 109 Aug 31, 2012 at 18:39

You’re right! I didn’t think of this. So I changed my post so people don’t have to look down for the answer!