You make the typical OpenGL newbie mistake and scatter your matrix manipulations all around the place. You never initialize OpenGL matrix state. Always set it up fresh when entering the display function. This makes things much easier to spot.
Also you may mistake OpenGL for a scene graph with glPush/PopMatrix "magically" establishing a transformation hierachy.
glPushMatrix
– as you probably know – makes a copy of the current top of the stack matrix and pushes it on the stack. The idea is to make temporary copies which further transformations can be multiplied onto.
Now let's look at your code in slightly different form:
void display(void) {
glViewport(…);
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
glFrustum(xwMin, xwMax, ywMin, ywMax, dnear, dfar);
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
gluLookAt(x_0, y_0, z_0, xref, yref, zref, Vx, Vy, Vz);
glColor3f(1.0, 1.0, 1.0);
{
GLfloat x = maj * cosf(theta) + x0;
GLfloat y = min * sinf(theta);
glMatrixMode(GL_MODELVIEW);
glPushMatrix();
glLoadIdentity(); // <<<<<<<<<
glTranslatef(x, y, 0);
glutSolidSphere(size, 25, 25);
glPopMatrix();
}
You see what's happening here? You're resetting your modelview matrix to identity, then translate that. The look-at matrix you create previously is completely discarded, and has no effect on the sphere drawing.
Remove that glLoadIdentity()
I marked and things should work just fine.