View Full Version : glViewport Local to FBO?

11-08-2013, 01:58 PM
If you change the glViewport in a FBO, is it then a local change for that FBO? Or is it a global change, also affecting the default screen?

carsten neumann
11-09-2013, 02:06 AM
The viewport is global state.

Dan Bartlett
11-09-2013, 05:04 AM
Also, since OpenGL 4.1 / GL_ARB_viewport_array (http://www.opengl.org/registry/specs/ARB/viewport_array.txt), you can have an array of viewports/scissor rectangles/depth ranges used at the same time (still global). The viewport that is used is controlled by specifying gl_ViewportIndex in the geometry shader (min value of GL_MAX_VIEWPORTS >= 16). A common use case for this would be to render multiple views of your scene from different angles (eg. front, left, top & perspective or left and right eyes with a slight offset) in a single pass.