Most window backends implements a size setter that redirects to the proper window shared library, that manages the internal states accordingly. Except headless, which is purely managed by moderngl and moderngl-window
This PR implements this work on moderngl_window.context.headless.window.Window class, to release the old FBO+attachments and create new objects when a window.size = width, height is called
A practical use is one project of mine, where I initialize the window and context at a default resolution for modules to create or load textures, but the final render resolution might be changed by a CLI or module itself (eg. scaling)
Implementation should be safe, and avoids recreating the FBO when same resolution is set
Most window backends implements a size setter that redirects to the proper window shared library, that manages the internal states accordingly. Except headless, which is purely managed by
moderngl
andmoderngl-window
This PR implements this work on
moderngl_window.context.headless.window.Window
class, to release the old FBO+attachments and create new objects when awindow.size = width, height
is calledA practical use is one project of mine, where I initialize the window and context at a default resolution for modules to create or load textures, but the final render resolution might be changed by a CLI or module itself (eg. scaling)
Implementation should be safe, and avoids recreating the FBO when same resolution is set