Clipping in case of viewport being larger than the frame buffer


  1. rendering is happening to an FBO and the texture attached to it is 100x100 in size
  2. viewport is set to (0,0,200,200) (i.e. 100px larger than the frame buffer in both dimensions)
  3. and a draw call is made to render a full screen rectangle.

Will rasterization happen for points that essentially lie within the viewport but are not going to be visible cause they lie outside the FBO ?

A fragment which lies outside of a bound FBO will fail the pixel ownership test. According to §14.9 of the specification (4.3 core profile), if a fragment fails the pixel ownership test or the scissor test, no further processing is performed, and the fragment shader will not be executed for that fragment.

The viewport only defines the mapping between normalised device coordinates and window coordinates. It doesn’t directly affect which fragments are drawn (e.g. wide points and lines can extend outside the viewport). The bounds of the viewport aren’t required to lie entirely within the current render target (window, pixmap, FBO, etc).

Thanks for the clarification.