hi… can you guys help me with this…
i want to implement a draw oval function for opengl… i am using lwjgl btw… here is my code so far…
public void drawOval(int x, int y, int width, int height) {
float theta;
float angle_increment;
float x1;
float y1;
angle_increment = (float) Math.PI / 500;
GL11.glPushMatrix();
GL11.glTranslatef(x+(width/2), y+(height/2), 0);
GL11.glColor4f(
this.color.getRedComponent()/255,
this.color.getGreenComponent()/255,
this.color.getBlueComponent()/255,
this.color.getAlpha()/255
);
GL11.glBegin(GL11.GL_LINE_LOOP);
for(theta = 0.0f; theta < Math.PI; theta += angle_increment) {
x1 = (float) (width/2 * Math.cos(theta));
y1 = (float) (height/2 * Math.sin(theta));
GL11.glVertex2f(x1, y1);
}
GL11.glEnd();
GL11.glPopMatrix();
}
this function draws only the lower half of the circle… idk how to fix it, any help is appreciated… thanks in advance