Jump to content
  • Advertisement
Sign in to follow this  
ahmadka

Help needed with curved surfaces and their normals..

This topic is 4030 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 guys...I need some help regarding curved surfaces and their normals...I got 2 questions... 1) I know of Bezier surfaces, which only pass through the end points defined in the control points array, and interpolate from the rest of the points (dont 'pass through' them though)...Is their any curved surface will passes through *all* of the points defined and only interpolates everywhere else ? 2) Right now I was just defining some curved surfaces using the Bezier surface method....The problem I am having is that the normals calculated, at pointing in the wrong direction...That is, when I apply the lights, the light is bouncing off the wrong side of the curved surface....how can I invert the direction of the normals being calculated for the curved surface...I have tried inverting the order of the points in the control points array, but that doesnt change anything...Also, I have tried glEnable(GL_AUTO_NORMAL)..again, no effect... help dudes... thanx in advance...

Share this post


Link to post
Share on other sites
Advertisement
Quote:
Original post by ahmadka
how can I invert the direction of the normals being calculated for the curved surface...


It might have helped if you'd posted your code calculating the normals. However, if there is any cross product involved, try changing the order of operands. That is instead of A x B, do B x A.

HTH.

Share this post


Link to post
Share on other sites
OK well here is the basic code...First of all, the points array is this:

GLfloat modelFrontHalfI[5][4][3] =
{
{{0, 0, 0},{-1.5f, 0, -6},{-2, 0, -8},{-2, 0, -20}},
{{0, 6, 0},{-2, 6, -6},{-2.5f, 6, -8},{-2.5f, 6, -20}},
{{7, 7, 0},{7, 7, -5},{7, 8, -10},{6, 8, -20}},
{{23, 15, 0},{21, 16, -4},{19, 17, -13},{18, 18, -20}},
{{33, 16, 0},{29, 17, -3},{26, 18, -14},{24, 19, -20}}
};

The curved surface plotting code is this:

glMap2f(GL_MAP2_VERTEX_3, 0, 1, 3, 4,0, 1, 12, 5, &modelFrontHalfI[0][0][0]);
glEnable(GL_MAP2_VERTEX_3);
glEnable(GL_AUTO_NORMAL);
glMapGrid2f(8, 0.0, 1.0,8, 0.0, 1.0);
glPushMatrix ();
glTranslatef(0,0,-10);
glEvalMesh2(GL_FILL, 0, 8, 0, 8);
glPopMatrix ();

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.

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

Sign me up!