filled polgon not working for star-shape...

I have a set of coordinates ( 10 of them ) that forms a star-shape. When I use GL.glBegin(GL_LINE_STRIP ), the lines show up as a star-shape ( as expected ) but not filled. When I try to use GL_POLYGON, I see that the first coordinate and the last coordinate dont complete. Rather polygon 1-2-3 get filled and then the rest are filled correctly.

Any ideas ?

Thanks

– pady

GL_POLYGON is only for convex shapes, RTFM. You’ll have to chop it up into triangles yourself.

For star shape, you have to tesselate your polygon (break into triangles). You can use GLUtesselator that comes with JOGL. You will find a demo in jogl-demos project at java.net, src\demos\tess\Tess.java.

Yuri