0

I want to allow the user to tweak windowed-mode performance by lowering the resolution without altering the size of the actual window which must remain fixed. If I alter it with glViewport, will it actually process fewer fragments, or is that purely a visual transformation? Assume I have early depth-testing on in my shader, if that matters at all.

1 Answer 1

2

If you set the viewport to a subset of the window size then fewer fragments will be drawn. The question is if you really want your rendering to cover only a portion of the window?

What you typically do is to render to a framebuffer object (FBO) with a lower resolution. As a last step you blit the FBO to the default framebuffer (scaling the result up to the window size in the process).

When you render to the FBO you will have to set glViewport to the resolution of the FBO.

5
  • That sounds like it eliminates much of the saved time by having to do the additional rendering step, plus disabling shaders during the copy. Is there no way to get it toautomatically stretch?
    – JAKJ
    Oct 30, 2012 at 14:48
  • @JAKJ The second pass of rendering a single textured quad will be comparatively cheap. Your other option is if course to always render to the full resolution of your window. There is to magic way to do it, all pixels have to be filled some way.
    – Plow
    Oct 30, 2012 at 15:02
  • That's a shame, but I suppose some performance gained is better than none.
    – JAKJ
    Oct 30, 2012 at 15:15
  • 1
    @JAKJ: You can blit the texture rather than drawing a triangle. It's even right there on the linked page, the section titled "Framebuffer Blitting." Oct 30, 2012 at 16:32
  • I did not realize that you could blit between rectangles with different sizes, but that is of course preferable to drawing.
    – Plow
    Oct 30, 2012 at 17:47

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.