building custom plane: is there an addTriangle() order?

Started by stormp, June 14, 2007, 11:24:20 AM

Previous topic - Next topic

stormp

Hi,

I was experimenting with building a custom plane.  Is there any order which the addTriangle() or the vectors must be added?

This works:

objSurface.addTriangle(new SimpleVector(-8.0f,  8.0f, 0.0f),
                       new SimpleVector( 8.0f,  8.0f, 0.0f),
                       new SimpleVector( 8.0f, -8.0f, 0.0f));

objSurface.addTriangle(new SimpleVector( 8.0f, -8.0f, 0.0f),
                       new SimpleVector(-8.0f, -8.0f, 0.0f),
                       new SimpleVector(-8.0f,  8.0f, 0.0f));


Where as this doesn't work:

       
objSurface.addTriangle(new SimpleVector(-8.0f, 8.0f, 0.0f),
                       new SimpleVector( 8.0f,  8.0f, 0.0f),
                       new SimpleVector( 8.0f, -8.0f, 0.0f));

objSurface.addTriangle(new SimpleVector(-8.0f,  8.0f, 0.0f),
                       new SimpleVector(-8.0f, -8.0f, 0.0f),
                       new SimpleVector( 8.0f, -8.0f, 0.0f));



Can someone explain? :)

Thanks.

EgonOlsen

Quote from: stormp on June 14, 2007, 11:24:20 AM
Can someone explain? :)
The docs for addTriangle already do so:

Quote
The vertices have to be defined counter-clockwise because jPCT backface culls them by default.

Your second code works...it's just that the object will be visible from the other side.

stormp