OpenGL with Delphi

I have an OpenGL window under Delphi 4.0.

I’m trying to represent a view of the Solar System. I’ve defined the viewport as the size of the client area of the window, which is square and I’ve defined the clipping volume as follows:


I’ve put the Sun just in the (0,0) which is the center point of the window. All of this is OK but the problem appears when I try to put a planet in another point. I use the quadric “Sphere” but it doesn’t appear as a perfect round sphere at all and the situation is worst if I put the planet far away from the center point (0,0).

I hope you can help me. Thanks a lot and excuse my english.

Certain perspectives with a large field of view can give weird distortions at the edges like you are seeing. The field of view that you are using is pretty big. Think of it this way, your near clip plane is 2 units away and is 20 units wide and high. If you think of the viewing volume in terms of a pyramid, then that gives you a very short pyramid where the base is much wider than the hight. That means that the angle at the point of the pyramid is pretty big.

If you want to have an easier way to define the viewing volume without having to do the math involved with calculating the frustum you want from the field of view you want, you might want to look at gluPerspective, which will do all that for you and can be a bit easier to use.