Properly resizing render target and view

simple_math_single_header
Martin Felis 2018-02-13 17:46:31 +01:00
parent ad4d671344
commit 8d718eb71f
1 changed files with 6 additions and 2 deletions

View File

@ -160,7 +160,8 @@ void Renderer::Shutdown() {
void Renderer::RenderGl() {
int width, height;
glfwGetWindowSize(gWindow, &width, &height);
mRenderTarget.Resize(width, height);
if (width != mWidth || height != mHeight)
Resize(width, height);
// enable the render target
glBindFramebuffer(GL_FRAMEBUFFER, mRenderTarget.mFrameBufferId);
@ -220,5 +221,8 @@ void Renderer::RenderGui() {
}
void Renderer::Resize (int width, int height) {
assert(false);
mWidth = width;
mHeight = height;
mRenderTarget.Resize(mWidth, mHeight);
glViewport(0, 0, mWidth, mHeight);
}