PDA

View Full Version : problem with Normal



02-02-2004, 07:44 AM
i tried to draw a 3D figure and to redraw it on the other face to have a 360 D object but the normals of the first face seem to be replace by these from the face behind.

for 2nd face, i do only *(-1) to the z coordonate of each vertex and normal.

here is an image of what happen : http://membres.lycos.fr/ioda100/3D/normals.jpg
here is the code : http://membres.lycos.fr/ioda100/3D/normal%20code.txt

thx in advance for your help

endash
02-03-2004, 09:02 AM
I'm not quite sure how you are trying to draw these things, but if you are trying to draw the front and back of one polygon, you might be having depth buffer p roblems. Are these planes being drawn such that they are coplanar?

A suggestion: Your source is a little hard to read, If you are going to use large arguments, you might break them across lines. eg:




glVertex3f(mylongargument.x
mylongargument.y,
mylongargument.y);

02-03-2004, 11:18 AM
yes, it's a depht buffer problem i think but when i enable it, there is almost nothink drawn.

endash
02-03-2004, 02:35 PM
If you want to draw the front and back of something as two separate polygons, you'll have to use glPolygonOffset(). Or else, just separate the two sides by some tiny ammount, which may work better since then you don't have to worry about drawing order.

Using the depth buffer, be sure to clear it, otherwise you'll have things not get drawn right.