# Resizing causes rendering to scale

**URL:** <https://discourse.glfw.org/t/resizing-causes-rendering-to-scale/1654>\
**Category:** support\
**Created:** [September 14, 2020, 11:00am UTC](https://discourse.glfw.org/t/resizing-causes-rendering-to-scale/1654 "2020-09-14T11:00:04Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![cappah](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.glfw.org/cappah/32/403_2.png) [@cappah](https://discourse.glfw.org/u/cappah)\
**Post date:** [September 14, 2020, 11:00am UTC](https://discourse.glfw.org/t/resizing-causes-rendering-to-scale/1654/1 "2020-09-14T11:00:04Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![dougbinks](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.glfw.org/dougbinks/32/39_2.png) [@dougbinks](https://discourse.glfw.org/u/dougbinks)\
**Post date:** [September 14, 2020, 12:01pm UTC](https://discourse.glfw.org/t/resizing-causes-rendering-to-scale/1654/2 "2020-09-14T12:01:59Z")

</div>

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:

> **[ocornut/imgui](https://github.com/ocornut/imgui)**
>
> Dear ImGui: Bloat-free Graphical User interface for C++ with minimal dependencies - ocornut/imgui

  

> **[vurtun/nuklear](https://github.com/vurtun/nuklear)**
>
> A single-header ANSI C gui library. Contribute to vurtun/nuklear development by creating an account on GitHub.

  

> **[memononen/nanovg](https://github.com/memononen/nanovg)**
>
> Antialiased 2D vector drawing library on top of OpenGL for UI and visualizations. - memononen/nanovg

Cheers,

Doug.

---

<div class="post-metadata">

**Author:** ![brianzuvich](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.glfw.org/brianzuvich/32/412_2.png) [@brianzuvich](https://discourse.glfw.org/u/brianzuvich)\
**Post date:** [September 15, 2020, 7:17pm UTC](https://discourse.glfw.org/t/resizing-causes-rendering-to-scale/1654/3 "2020-09-15T19:17:04Z")

</div>

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…

> **[GLFW: Window guide](https://www.glfw.org/docs/3.3.2/window_guide.html#window_size)**

  

> **[LearnOpenGL - Rendering Sprites](https://learnopengl.com/In-Practice/2D-Game/Rendering-Sprites)**
