PDA

View Full Version : gluLookAt



CoolBeanJ
03-27-2011, 10:19 PM
Hi guys I could really use some help.

I was wondering if anyone could help me with rotating my camera around a point on the screen here my code to do it at the moment and I think some of it is incorrect:



//rotating down
testAngleX += 0.1;

cenZ = 10 * Math.Cos(testAngleX);
cenY = 10 * Math.Sin(testAngleX);

Render(eyeX, eyeY, eyeZ, cenX, cenY, cenZ, uX, uY, uZ);
if (testAngleX >= 360.0f)
testAngleX = 0.0f;
if (testAngleX <= -360.0f)
testAngleX = 0.0f;
this.Refresh();

//rotating left

testAngleY -= 0.1;

cenX = 10 * Math.Cos(testAngleY);
cenZ = 10 * Math.Sin(testAngleY);

Render(eyeX, eyeY, eyeZ, cenX, cenY, cenZ, uX, uY, uZ);
if (testAngleY >= 360.0f)
testAngleY = 0.0f;
if (testAngleY <= -360.0f)
testAngleY = 0.0f;
this.Refresh();