I am trying to perform zoom in OpenGL ES 2.0 based on mouse position. I am using Qt OpenGL support and I use ortho projection. My zoom in center works fine, but when I want to zoom in the mouse position I got into trouble.

This is what I have done so far. this is function that calculates the zoom based on wheel event and mouse current position relative to OpenGL coordinates.

Code :
void wheelEvent(QWheelEvent* event)
    {
 
        QPoint numDegreesA = event->angleDelta() / 8;
 
        if (!numDegreesA.isNull())
        {
            int numDegrees = event->delta() / 8;
            int numSteps = numDegrees / 15;
 
            if(numSteps > 0)
            {
 
                _translateX = ( (event->x() / _w * 2 - 1));  // mouse position in x OpenGL coord.
                _translateY = ( ((1-(event->y() / _w)) * 2 - 1)) ;
            }
             _zoom += _zoom * numSteps * 0.1f;
        }
        event->accept();
        renderNow();
    }

This is where the zoom is performed on matrix. I use orthogonal projection.

Code :
glViewport(0, 0, _w, _h);
float orthoScale = 1.f/_zoom;
matrix.ortho(_translateX -_w*orthoScale/2,_translateX + _w*orthoScale/2, _translateX -_h*orthoScale/2,_translateX + _h*orthoScale/2, -1, 1);

Where _w is width of the screen and _h is screen height.

If someone could help with this I would appreciate