Trying to keep the mouse in the center of the screen seemed to be the best solution to me. But the camera wont move fluently anymore because the function glutwarppointer is called every time the mouse is moved.
But I got another idea after 3 months of thinking
Now the mouse jumps back to the center of the screen every time it reaches the edges.
My solution is as follows:
I got a class that controls the OpenGL device functions.
The class is called inside the glut function and given the parameters.
Heres the function prototype.
Inside the class I save the old point of the mouse within 2 int variables.
When I move the mouse the old and new values are given to my camera class.
In the first line i check if the difference between old and new is bigger than 500 in the horizontal(x) axis.
I may add the y-axis too. This is because after glutwarppointer the function glutpassivemotion is called and the difference is bigger than 500 and is ignored. Then I call my surroungviewpoint function with the rotation radius.