Resizing causes rendering to scale

Im creating a GUI and having trouble resizing my window. What is happening is that when my application starts at its initial size, everything is normal. But when I try to resize my window, my menu bar and text grows and shrinks proportionately like scaling a single image.

What Im trying to achieve on a basic level is that whatever I render stays statically the same size regardless of shrinking or growing the window’s dimensions.

Hi @cappah welcome to the GLFW forum!

This is a general rendering issue rather than a GLFW one, so do feel free to google online for help in rendering GUIs.

In your case it sounds like you are using coordinates relative to your window to position your GUI elements, so as you resize the window they change size. Instead, you need to use absolute units such as pixels to specify the height and distance between elements.

If you are simple looking for a way to render a decent GUI rather than make one yourself, do have a look at some of the available solutions such as:



Cheers,

Doug.

Just decouple your interface from other elements with it’s own projection matrix. Usually with UI’s, you’re going to be using orthographic projection. Just make sure that you’re recalculating the orthographic projection matrix to take into account the new framebuffer dimensions after the resizing.

See these links…