Hi everyone!

I am a beginner with OpenGL so any help would be really appreciated.

I have the following problem:

When I zoom in, the model moves towards the screen, but
then it is flipped and then starts moving back to the z direction
of the screen.

I use the glOrtho(left, right, bottom, top, near, far) function,
so I noticed that the flip happens when bottom and top change
their sign (from positive to negative and vice versa).

Some details about the code:

I have setup the mouseMoveEvent (in Qt) where I calculate
the Z translation according to the mouse Y movement.

zTranslation -= mouseClickYPosition - mouseLastYPosition;

then while drawing the objects I setup the glOrtho parameters:

left = -2.1 + zTranslation;
right = 2.1 - zTranslation;
bottom = -2.1 + zTranslation;
top = 2.1 - zTranslation;
near = -3.1 - zTranslation;
far = -3.1 ;

glOrtho(left, right, bottom, top, near, far);


So what is wrong here?

In general it is better to use glTranslatef, glRotatef, glScalef or glOrtho?