Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

Pingvin

bezier surface

This topic is 5544 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

Hello, I would like to implement normal-calculation. This is the part that does the surface-calculation:
  
bezierCurve4 prev=bezierCurve4(cCurves[0].nextPoint(),cCurves[1].nextPoint(),cCurves[2].nextPoint(),cCurves[3].nextPoint(),1.0f/20.0f);	//last argument is step

while(cCurves[0].hasNext()==true && cCurves[1].hasNext()==true && cCurves[2].hasNext()==true && cCurves[3].hasNext()==true) {

bezierCurve4 stepy=bezierCurve4(cCurves[0].nextPoint(),cCurves[1].nextPoint(),cCurves[2].nextPoint(),cCurves[3].nextPoint(),1.0f/20.0f);		
glBegin(GL_TRIANGLE_STRIP);
	while (prev.hasNext()==true && stepy.hasNext()==true) {
			Point3 p=prev.nextPoint();
		        glVertex3f(p.x,p.y,p.z);
			p=stepy.nextPoint();
			glVertex3f(p.x,p.y,p.z);
	}
glEnd();
prev=stepy;
prev.reset();  //starts over

}
  
Any ideas on implementing this? Maybe one way is to calculate two vectors on each triangle, and then calculate the crossproduct? Should I specify a normal on every vertex?

Share this post


Link to post
Share on other sites
Advertisement

  • Advertisement
×

Important Information

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

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!