Java examples for javax.media.opengl:GL
draw Pie opengl
import javax.media.opengl.GL2; public class Main{ public static void drawPie(GL2 gl2, double x, double y, double z, double r, double start, double end, int seg) { double ang = (end - start) / (double) seg; gl2.glBegin(GL2.GL_TRIANGLE_FAN); gl2.glVertex3d(x, y, z);//from ww w . j av a2 s . c o m for (int i = 0; i <= seg; i++) { double rx = r * Math.cos((start + ang * i) * 3.1416 / 180.0); double ry = r * Math.sin((start + ang * i) * 3.1416 / 180.0); gl2.glVertex3d(x + rx, y + ry, z); } gl2.glEnd(); } }