Defining the Viewport and Scissor

The viewport and scissor specify how images will appear on screen

The viewport and scissor are used to specify how the images will appear on screen.

The viewport acts as a transformation describing how the image's coordinates map to the coordinates on the surface. In simple terms, it is the rectangle in which the rendered images appear on screen.

The scissor is the sub-section of the viewport where rendering will actually occur. Any pixels which are outside the scissor area are discarded. If the scissor is larger than the viewport then all pixels will be stored.

Example: initViewportandScissor()

In the example code, both the viewport and scissor are set to match the size of the surface, so the entire image will be rendered to the surface.