Original Post
Searching this forum I found a thread with a link to www.ultimategameprogramming.com which would contain a tutorial on gluLookAt and camera movement but the site is down. I have some problems with my gluLookAt function. It skips around when moving the camera. The desirable behaviour is for the camera to move in the x, y, z-directions when pressing the right mouse button and moving the mouse. This is working. Sort of. It's like the camera has decided to skip way too many degrees when moving the mouse. Code snippets regarding the camera: Global int DrawGLScene(GLvoid) LRESULT CALLBACK I guess you can tell what a newbie I am :) Still, I'm learing fast but I just can't get a grip around this. Why is my camera skipping around/rotating waaaaay too fast? I'm trying to get the camera to orbit a sphere (planet). If you need more code, just ask. Thanks! Marcus
#define PI (3.14159265359f)
#define DEG2RAD(a) (PI/180*(a))
#define EYE_RADIUS 40.0f
int dx;
int dy;
void RightMouseMove(int dx, int dy);
float m_fRotTheta = 0;
float m_fRotPhi = 0;
float fEyeX = EYE_RADIUS * cos(m_fRotTheta) * sin(m_fRotPhi),
fEyeY = EYE_RADIUS * sin(m_fRotTheta) * sin(m_fRotPhi),
fEyeZ = EYE_RADIUS * cos(m_fRotPhi);
gluLookAt(fEyeX, fEyeY, fEyeZ, 0.0f, 0.0f, 0.0f, 0.0f, -1.0f, 0.0f);
m_fRotTheta += DEG2RAD((float)dx/3.0f);
m_fRotPhi += DEG2RAD((float)dy/3.0f);
case WM_RBUTTONDOWN:
bMouseRBDown = true;
return 0;
case WM_RBUTTONUP:
bMouseRBDown = false;
return 0;
case WM_MOUSEMOVE:
if(bMouseRBDown){
RightMouseMove(LOWORD(lParam), HIWORD(lParam));
}
iOldMouseX = LOWORD(lParam);
iOldMouseY = HIWORD(lParam);
