+3  A: 

It looks like you're using 1.0 as the aspect when you call gluPerspective(). You should use width/height. For example, if your viewport is 640x480, you would use 1.33333 as the aspect argument.

shea241
Ah, I was dividing window width by height in my glutReshapeFunc() callback to get my aspect ratio, but I forgot to cast my width to a float first. Bada-bing, Bada-boom, rounding error. Thanks.
rampion
+2  A: 

According to the OpenGL Spec:

void gluPerspective( GLdouble fovy,
               GLdouble aspect,
               GLdouble zNear,
             GLdouble zFar )

Aspect should be a function of your window width and height. Specifically width divided by height (but watch out for division by zero).

Perhaps you are using 1 as the aspect which is not accurate unless your window is a square.

Martin
A: 

It looks like the aspect parameter on your gluPerspective call need tweaking. See The Man Page. If your window were physically square, the aspect ratio would be 1 and your problem would go away. However, your window is rectangular, so the viewing frustum needs to be non-square.

Set the aspect ratio to window_width / window_height, and your ellipse should look correct. Note that you'll need to update this whenever the window resizes; if you're using GLUT set a glutReshapeFunc and recalculate the projection matrix in there.

Jeff Hill
A: 

Hi, I am a newbe in iphone and i want to draw such ellipses. Actually i have drawn one ellipse but i want to set perspective to give such shape that you have done. but i am not succeed. so please can you give me the sample code for this. and also want to set texture where you have set green color. so if you know the solution then tell me please. and also i have refer the Texture2D and set texture but it place the texture at each points. i want to set only one texture at the width of the ellipse.

Thanks in advance,