<p>In OpenGL I'm trying to rotate a camera around a point, with camera being distance r from the point and facing the point when it rotates.  In other words, I want the camera to move along the circumference  of a circle at a radius r from the center, with the camera facing the center at any point along the circumference.</p>

<p>Lets say that in 3d space the center of the circle is (3, 0, 3);</p>

<p>I've tried:</p>

<pre><code>// move to center of circle    
glTranslatef(-3, 0, -3)
// move a distance away from the circle
glTranslatef(0, 0, r);
// rotate along the y "up" axis
glRotatef(CameraAngle, 0, 1, 0);
</code></pre>

<p>where CameraAngle is the degrees being moved around the circle.</p>

<p>My end result is the camera is still rotating along the origin, not the center of the circle.  Can anyone help me fix this problem?  Thanks!</p>

You need to either:
rotate the camera around the origin and then translate it (*)
or:
use
```
gluLookAt
```
to keep the camera pointing at the center of the circle
(*) rotation functions normally rotate about the origin.  To rotate around another point
```
P
```
you have to:
translate(-P)
rotate
translate(P)