PDA

View Full Version : object faces problem



orendavd
12-18-2007, 07:55 AM
hi there,
I've build my terrain as a mesh object from a STL file, the result was a mirror terrain from the original, so I transform the x value of every vertex to be -x. the new terrain was ok, except the faces are now wrong and I have no idea how to fix it.
for the first mirror image I used simple indices for the faces 0-71182, but now it does'nt work.

any help
10x

thinks
12-18-2007, 10:31 AM
When you "flip" the x-axis, the ordering is no longer correct, as you noted. The reason is that a vertex which was previously to the "right" of its neighbor, is now on the "left".

You can change the winding of your faces if you like. Assuming you have CCW now, you can change it to CW before the draw call of your program.

Hope that is enough to help you.

ZbuffeR
12-18-2007, 10:35 AM
Please define "the faces are now wrong".

Some possible pitfalls :
- inverting one axis means that the face winding is reversed. You need to tell it to OpenGL, see the doc for glFrontFace() :
http://www.opengl.org/sdk/docs/man/xhtml/glFrontFace.xml
- if you have normals, check that you also reverse x on them.