Skip to content
Snippets Groups Projects
Commit c0110908 authored by Philip Trettner's avatar Philip Trettner
Browse files

fixed auto viewport without attachements

parent e28e6c98
No related branches found
No related tags found
No related merge requests found
......@@ -247,7 +247,8 @@ bool BoundFramebuffer::isCurrent() const
void BoundFramebuffer::updateViewport()
{
tg::isize3 dim(32 * 1024);
auto sentinel = tg::max<int>();
auto dim = tg::isize3(sentinel);
if (buffer->mDepthAttachment.texture)
dim = tg::min(dim, buffer->mDepthAttachment.texture->getDimensions());
if (buffer->mStencilAttachment.texture)
......@@ -255,6 +256,7 @@ void BoundFramebuffer::updateViewport()
for (auto const& a : buffer->mColorAttachments)
if (a.texture)
dim = tg::min(dim, a.texture->getDimensions());
if (dim != tg::isize3(sentinel)) // at least one texture
glViewport(0, 0, dim.width, dim.height);
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment