Take the 2-minute tour ×  I know that it is more efficient than
stencil test, but am I right assuming that the same
functionality could be achieved using projection transformations
with viewport?  share|improve this question  4 Answers 4  up
vote 15 down vote accepted  They are more complementary than
alternatives to each other. You almost always want to set the
scissor rectangle to the same values as the viewport.
glViewport() specifies a transformation from normalized
projection space to screen space. Polygons are clipped to the
edge of projection space, but other draw operations like
glClear() are not. So, you use glViewport() to determine the
location and size of the screen space viewport region, but the
rasterizer can still occasionally render pixels outside that
region.  That's where scissor in comes in. glScissor() defines a
screen space rectangle beyond which nothing is drawn (if the
scissor test is enabled).  So for example, the following code
will clear the whole screen, even though the viewport is