I have an issue when my window resizes.
I have a simple MVP shader like this
gl_Position = projection * view * model * vec4(in_Position, 1.0);
to render a map in my game scene. The map is extremely simple that it simply offers a lane's vertex. And what I need to do is drawing it inside the window.
So I set up my MVP matrix individually, the "view" and "model" matrix remains the same because all I want to do is drawing a static map. "perspective" is the only matrix need to change since I want to have a zoom feature that I can zoom in/out by changing fovy. "perspective" is updated by calling
glm::perspective(glm::radians(fovy), (float)width/height, near, far)
and my view matrix is calculated by
glm::lookAt(camera_pos, camera_pos + camera_front, camera_up)
However, when I resize the viewport, I find everything changed. I mean by default, the resolution gonna drop when my window goes larger if I didn't do anything(like updating the glViewPort()). But the behavior I wanna achieve is like
"I could see more part of the map when I made my window size larger".
Therefore I believe that I should keep my viewport resolution same (glViewPort(0, 0, screen_width, screen_height)). And updating perspective matrix by changing the ratio when new window's width and height comes in. Then the final step is to update the camera's position to update view matrix. However I stuck here for a while coz I don't know how to adjust it. I believe this is a common issue but I cannot even find a source talking about it.
Do I think it the wrong way? Do I need to change Camera's position to update my view matrix to achieve the resize behavior?
Platform: Ubuntu 16.04, OpenGL3.3 , C++14