0
// baseballField
glColor3f(0.22, 0.36, 0.20);

GLUquadricObj *myobject;
myobject = gluNewQuadric();
glTranslatef(120.0, 655.0, 0.0);
gluDisk(myobject, 0.0, 40.0, 60, 4);

I'm trying to simulate the shape of a baseball field by creating a quarter circle (preferably the top right quarter). The code above successfully draws the circle with the correct size, location, and color. However, it is the whole circle. If anyone has any insights, please let me know. Thanks in advance!

genpfault
  • 51,148
  • 11
  • 85
  • 139
Ajom1795
  • 55
  • 7

2 Answers2

3

Sticking with the GLU call, the one you're looking for is, quite intuitively, gluPartialDisk(). For a quarter circle:

gluPartialDisk(myobject, 0.0, 40.0, 60, 4, 0.0, 90.0);

The last two arguments specify the starting angle and the sweep angle, both in degrees.

Note that GLU is very deprecated, and only works with legacy versions of OpenGL. For sample code that shows how to draw a circle with a more current version of OpenGL, see for example my answer here: How to draw a circle using VBO in ES2.0.

Community
  • 1
  • 1
Reto Koradi
  • 53,228
  • 8
  • 93
  • 133
0
void gluDisk(   
    GLUquadric* quad,
    GLdouble inner,
    GLdouble outer,
    GLint slices,
    GLint loops);

The disk is subdivided around the z axis into slices (like pizza slices)

Try playing with the slice, 2 means half circle i think.

[edit] dont forget with the loops too."and also about the z axis into rings (as specified by slices and loops, respectively)."

AchmadJP
  • 893
  • 8
  • 17