• Advertisement


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

Help with Polygons

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

glBegin (GL_TRIANGLES); // Begin Drawing Triangles Point3 help; Point3 help2; Point3 help3; help.x = -1.0f; help.y = -1.0f; help.z = 0.0f; help2.x = 1.0f; help2.y = 1.0f; help2.z = 0.0f; help3.x = -1.0f; help3.y = 1.0f; help3.z = 0.0f; tempNormal = normal(help, help2, help3); glNormal3f(tempNormal.x,tempNormal.y,tempNormal.z); glVertex3f(-1.0f, -1.0f, 0.0f); glVertex3f(1.0f, 1.0f, 0.0f); glVertex3f(-1.0f,1.0f,0.0f); glEnd(); Ok heres code, this draws a triangle, this makes 1 side shaded, and the other side adjusts with light. How do i make both sides adjusting with light?

Share this post

Link to post
Share on other sites
Im sure there''s a command to light up both sides of the polygon no matter which side the light is pointing at, but i dont know it

so why not use the normal to determine if the light is behind the object or not, and if it is, just make the normal negative?


result = (normal.x * lightpos.x) + (normal.y * lightpos.y) + (normal.z * lightpos.z) + normal.d

if (result < 0)
normal.x = -normal.x;
normal.y = -normal.y;
normal.z = -normal.z;

that should do what you want

Share this post

Link to post
Share on other sites

  • Advertisement