View Full Version : Wireframe

06-10-2002, 02:15 PM
I'm just trying out simple things in opengl to get started.

For example wireframe(GL_LINES) 3d objects, though it looks a bit messy. How would i go about to make wireframes that have a different color when the wire is viewed from the backside.

Do i have to calculate the rotation and projection myself with pseudo faces and determine which color to use(front face or back face) or could opengl help with that on lines?

06-10-2002, 05:51 PM
how about using lights? you can use 2 different colors (or any other materials) for the front and back faces with their respective normals. See if that helps http://www.opengl.org/discussion_boards/ubb/smile.gif

06-10-2002, 08:47 PM
yes u can supply different materials for front + back, use glPolyMode( GL_LINE );

06-11-2002, 08:11 AM
I had success with using lights, having different colors to ambient and diffuse.

No luck with materials though, i set up as described below before sending normal and vertex information. if i change the ambient light color the results are that backfaced lines will change color, but not if it's pure white and i set up materials.

GLfloat light_diffuse[] = { 1.0, 1.0, 1.0, 1.0 };
GLfloat light_ambient[] = { 1.0, 1.0, 1.0, 1.0 };
GLfloat light_position[] = { 0.0, 0.0, -100.0, 0.0 };

glLightfv(GL_LIGHT0, GL_AMBIENT, light_ambient);
glLightfv(GL_LIGHT0, GL_DIFFUSE, light_diffuse);
glLightfv(GL_LIGHT0, GL_POSITION, light_position);
GLfloat frontcol[] = { 1,1,1,1 };
GLfloat backcol[] = { 1,0,0,1 };