Jump to content


OpenGL Nurbs


3 replies to this topic

#1 Alienizer

    Member

  • Members
  • PipPipPipPip
  • 435 posts

Posted 29 August 2012 - 03:11 PM

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???

#2 Alienizer

    Member

  • Members
  • PipPipPipPip
  • 435 posts

Posted 30 August 2012 - 06:58 PM

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();
}


#3 TheNut

    Senior Member

  • Moderators
  • 1699 posts
  • LocationThornhill, ON

Posted 31 August 2012 - 10:44 AM

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?
http://www.nutty.ca - Being a nut has its advantages.

#4 Alienizer

    Member

  • Members
  • PipPipPipPip
  • 435 posts

Posted 31 August 2012 - 06:39 PM

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!





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users