Jump to content
  • Advertisement
Sign in to follow this  

Problem in glnurbscurve for drawing circle

This topic is 4415 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi , I have a hexagon gving me six control points.I need to draw a circle using glNurbsCurve. Following is a snippet of my code :
void drawNurbsCurve(float** ObjectCtrPts , int iTotalCtrlPts) 
    //GLUnurbsObj *pNurb = NULL;
	int i = 0 ;
    //int iKnotCount =  ORDER + iTotalCtrlPts  ; 
	int iKnotCount = 13;
	int  kStride = 2;
GLfloat Knots[13] = {0.0,1.0,2.0,3.0,4.0,5.0,6.0,7.0,8.0,9.0,10.0,11.0,12.0} ;

    glNewList(3, GL_COMPILE);
// Begin the NURB definition
//Enable the following	
// Send the Non Uniform Rational BSpline
gluNurbsCurve(pNurb, 13, Knots, kStride, &ObjectCtrPts[0][0] , 4, GL_MAP1_VERTEX_3);
		  glVertex3f(0.0f, 0.0f , 0.0f);

I am passing Object control points as follows: ObjCtrPts[][] = { 1.0 , 0.0 ; 0.5, sqrt(3)/4 ; -0.5, sqrt(3)/4; - 1.0 , 0.0 ; -0.5, -sqrt(3)/4}; 0.5, -sqrt(3)/4 } And I am using function call as : gluNurbsCurve(pNurb, 13, Knots, kStride, &ObjectCtrPts[0][0] , 4, GL_MAP1_VERTEX_3); Where my order is 4 , num of knots is 13 ( since control points are 9, for drawing a circle) and knotcount is 13. I am using GL_MAP1_VERTEX_3 RESULT : Getting two perpendicular lines meeting at coordinate (0.0f , 0.0f) i.e at origin. When i use GL_MAP_VERTEX_4 I get a straigh line starting from Control point number 1 and goes out of screen(viewport). I want to get a circle.Where am I going wrong.I searched the RED Book and other sites on google but could not get any help.Hope I will be fortunate this time.

Share this post

Link to post
Share on other sites
Sign in to follow this  

  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!