using Trackball to look Around


I am very new to OpenGL and all the math fun :sorrow: , I got some code form net which simulates the Trackball using the arcBall algorithm. It imagines the sphere on the screen with certain center, distance from center and up vector. Then internally it maintains a ModelView Matrix.

Now I want to somehow be able to let user lookaround the current position i.e. not move the camera around but have eye look up /down right left keeping the eye and center constant.

I tried to move the center of trackball to current distance and make distance zero, in order to simulate the lookaround using trackball but it somehow messes the modelView or the angle calculations are wrong

Second I was thinking of getting the eye and lookat position from the current modelView, and use it with gluLookAt, with pushing and poping the modelView Matrix, but I do not know how to find the eye and lookat from the modelview matrix.

Can anyone please suggest some easy approach with some pointer to code.


anyone Please, any suggestions