Original Post
I've tried to adapt the "Creating a Useful Camera Class" article to OpenGL but, it doesn't seem to be working at all well. It's kind of behavior I see but, basically, nothing works properly. Even just calling the move function completely throws everything out of whack. Does anyone see anything immediately wrong here or do I need to be more specific? void camera::update() { gluLookAt(eye.x, eye.y, eye.z, look.x, look.y, look.z, up.x, up.y, up.z); /* cout << "eye.x: " << eye.x << endl; cout << "eye.y: " << eye.y << endl; cout << "eye.z: " << eye.z << endl; cout << "look.x: " << look.x << endl; cout << "look.y: " << look.y << endl; cout << "look.z: " << look.z << endl; cout << "up.x: " << up.x << endl; cout << "up.y: " << up.y << endl; cout << "up.z: " << up.z << endl; */ }; void camera::rotate(const double & new_h, const double & new_v) { h += new_h; v += new_v; look.x = eye.x + (cos(v) * cos(h)); look.y = eye.y + sin(v); look.z = eye.z + (cos(v) * sin(h)); up.x = eye.x - look.x; up.y = abs(look.y + sin(v + Pi / 2)) ; up.z = eye.z - look.z; }; void camera::slide(const double & h, const double & v) { eye.x += h * cos(h + Pi / 2); eye.y += v; eye.z += h * sin(h + Pi / 2); rotate(0.0, 0.0); }; void camera::move(const double & d){ eye.x += d * cos(v) * cos(h); eye.y += d * sin(v); eye.z += d * cos(v) * sin(h); rotate(0.0, 0.0); };