# theJuniorOne

Member

4

100 Neutral

• Rank
Newbie
1. ## OpenGL Camera Rotation problems

Hey so I have spent the past weekend trying to get my Camera to rotate in opengl, using quaternions. From what I understand the Math appears to be correct but when it runs, the camera just rotates to apparently wherever it feels like. Anyways here is the code hopefully some one can help me out here. [code]void Camera:: RotateCamera(double Angle, double _x, double _y, double _z) { std::cout<<" before point of focus ("<<pointOfFocus.x<<","<<pointOfFocus.y<<","<<pointOfFocus.z<<")"<<std::endl; //create a quaternion given the angle and vector Quaternion4f temp,temp2, Dist, result; //get both sides of the rotation quaternion temp.FromAxis(Vector3f(_x,_y,_z), Angle); temp2 = temp.getConjugate(); //make the quaternion out of the direction vector Dist = Quaternion4f(0,direction.x,direction.y,direction.z); //rotate the DIST quaternion by temp result = (temp * Dist) * temp2; //set the new direction to be the result direction.set(result.x, result.y, result.z); //solve for new point of focus pointOfFocus = direction + position; //normalize the direction direction.normalize(); std::cout<<" after point of focus ("<<pointOfFocus.x<<","<<pointOfFocus.y<<","<<pointOfFocus.z<<")"<<std::endl; }[/code] [code]void Camera:: Render() { gluLookAt( position.x, position.y, position.z, pointOfFocus.x, pointOfFocus.y, pointOfFocus.z, up.x, up.y, up.z); }[/code] Thanks in advance
2. ## OpenGL Texture Mapping Issues

Yeah Thanks for the quick response, one of the other programmers was actually able to come up with that solution and it worked, thanks though.
3. ## OpenGL Texture Mapping Issues

Yeah that is what I figured but I cant figure out why and I have asked my artist over and over again if its UV mapped correctly and according to him and maya it is. So I dont know why it is getting incorrect values for the UV's