Hello, I am rendering a scene in which I have two spheres. I am revolving a camera around one of them. What happens is counter-intuitive. When the camera goes around the sphere the other gets in front of it when you'd expect it to be behind. So it appears as though the spheres aren't revolving around each other and the one the should go around is always upfront. Please help.
Here is the code that renders the scene:
glLoadIdentity();
[self positionCamera];
glutSolidSphere(2, 12,12);
glPushMatrix();
glTranslatef(5, 0, 0);
glutSolidSphere(0.5, 12,12);
glPopMatrix();
glFlush();
This block is part of a class that gets called on using.
[NSTimer scheduledTimerWithTimeInterval:DEFAULT_ANIMATION_INTERVAL
target:self
selector:@selector(drawRect)
userInfo:nil
repeats:YES];
And
-(void)positionCamera{}
Contains math do camera revolution and gluLookAt()