Page 1 of 1
Shifting GUI after resolution change
Posted: 08 Oct 2017, 04:38
by schragnasher
I cant seem to diagnose an issue i am having. Whenever i change the size of my window i get a weird artifact when resizing back to the original size. Gif below shows what i am seeing. I call SetSize on my view each time i change the window size, but that does not seem to help.
https://imgur.com/a/nwbnd
Re: Shifting GUI after resolution change
Posted: 09 Oct 2017, 18:34
by jsantos
This is a custom integration right? Are you restoring the framebuffer and viewport after the offscreen phase? This must be done per frame.
Re: Shifting GUI after resolution change
Posted: 10 Oct 2017, 02:59
by schragnasher
Like this? Doesn't change anything. This only happens after i change the window size to be smalller. So its starts ok, and its fine if i make the window larger, but if i ever make it smaller it starts shifting.
if (view.Renderer.NeedsOffscreen())
{
view.Renderer.RenderOffscreen();
view.SetSize(_gameWindow.Width, _gameWindow.Height);
GL.BindFramebuffer(FramebufferTarget.Framebuffer, 0);
}
Re: Shifting GUI after resolution change
Posted: 10 Oct 2017, 17:42
by jsantos
This
GL.BindFramebuffer(FramebufferTarget.Framebuffer, 0);
must be done before the normal render pass (IRenderer::Render). You also need to adjust the viewport (glViewport) because the offscreen may modify it.
Re: Shifting GUI after resolution change
Posted: 12 Oct 2017, 03:09
by schragnasher
I figured it out. Got it all working, thanks much!
Re: Shifting GUI after resolution change
Posted: 18 Oct 2017, 04:08
by jsantos
Thanks for the feedback! Closing this.