Following my comment, it looks like this: the translation is performed in another frame of coordinates in rendering, which tells me that it is tied to another stack of matrices.
So, in the old viewport (where your result is “correct”) you combine the translation into the model’s viewing matrix, but in case of 2.0, you probably combine the translation into the projection matrix, which will lead to the translation apparently relative to the screen, and not to the view .
I would recommend that all the correct state be properly configured in your render call, for example by setting the desired glMatrixMode () before messing with the matrix stack, etc.
source share