PDA

View Full Version : Help with drawing 30 circles going in a circle JOGL



Maatzu
11-13-2014, 06:36 AM
I have managed to draw a single circle, but i can't manage to craw 30 circles going in a circle.
They also need to change color for each circle drawn.
Can someone please help me with this?

Here is the code for the single circle.

public void drawGLScene1(GLAutoDrawable glDrawable) {
GL gl = glDrawable.getGL();
gl.glClear(GL.GL_COLOR_BUFFER_BIT | GL.GL_DEPTH_BUFFER_BIT);
gl.glLoadIdentity();
gl.glTranslatef(-10.0f, 0.0f, -20.0f);
gl.glColor3f(0f, 0f, 1f);
gl.glBegin(gl.GL_LINE_LOOP);
for (int i = 0; i < 100; i++){
double angle = 2*Math.PI*i/100;
double x = Math.cos(angle);
double y = Math.sin(angle);
gl.glVertex3f((float)x,(float)y, (float)0.0);
}
gl.glEnd();
}