Module Expr Str ImportFrom alias ClassDef bases NameLoad body Assign NameStore NameLoad decorator_list ClassDef bases NameLoad body FunctionDef arguments args NameParam NameParam NameParam NameParam defaults Num Num body Assign AttributeStore NameLoad attr NameLoad Assign AttributeStore NameLoad attr NameLoad Assign AttributeStore NameLoad attr NameLoad decorator_list FunctionDef arguments args NameParam defaults body Expr Call AttributeLoad AttributeLoad NameLoad attr attr Expr Call NameLoad NameLoad Expr Call NameLoad Num AttributeLoad AttributeLoad NameLoad attr attr Num AttributeLoad AttributeLoad NameLoad attr attr AttributeLoad NameLoad attr AttributeLoad NameLoad attr Expr Call NameLoad NameLoad decorator_list decorator_list ClassDef bases NameLoad body FunctionDef arguments args NameParam NameParam NameParam NameParam NameParam defaults Num Num Num body Assign AttributeStore NameLoad attr NameLoad Assign AttributeStore NameLoad attr NameLoad Assign AttributeStore NameLoad attr NameLoad Assign AttributeStore NameLoad attr NameLoad decorator_list FunctionDef arguments args NameParam defaults body Expr Call AttributeLoad AttributeLoad NameLoad attr attr Expr Call NameLoad NameLoad Expr Call NameLoad AttributeLoad NameLoad attr BinOpDiv AttributeLoad AttributeLoad NameLoad attr attr Call NameLoad AttributeLoad AttributeLoad NameLoad attr attr AttributeLoad NameLoad attr AttributeLoad NameLoad attr Expr Call NameLoad NameLoad decorator_list decorator_list ClassDef bases NameLoad body Assign NameStore NameLoad Assign NameStore Num Assign NameStore Num decorator_list ClassDef bases NameLoad body FunctionDef arguments args NameParam NameParam defaults body Assign AttributeStore NameLoad attr NameLoad decorator_list FunctionDef arguments args NameParam defaults body Expr Call NameLoad NameLoad Expr Call NameLoad Expr Call NameLoad NameLoad Expr Call NameLoad Expr Call NameLoad Num Num AttributeLoad AttributeLoad NameLoad attr attr AttributeLoad AttributeLoad NameLoad attr attr Expr Call NameLoad NameLoad Expr Call NameLoad NameLoad Expr Call NameLoad NameLoad Expr Call NameLoad NameLoad decorator_list Assign NameStore Call NameLoad Lambda arguments args NameParam defaults AttributeLoad AttributeLoad NameLoad attr attr Assign NameStore Call NameLoad Lambda arguments args NameParam defaults AttributeLoad AttributeLoad NameLoad attr attr decorator_list ClassDef bases NameLoad body FunctionDef arguments args NameParam NameParam NameParam NameParam NameParam NameParam NameParam NameParam defaults Num Num body Assert Call NameLoad NameLoad NameLoad Assign AttributeStore NameLoad attr NameLoad Assign AttributeStore NameLoad attr NameLoad Assign AttributeStore NameLoad attr NameLoad Assign AttributeStore NameLoad attr NameLoad Assign AttributeStore NameLoad attr NameLoad Assign AttributeStore NameLoad attr NameLoad Assign AttributeStore NameLoad attr NameLoad decorator_list FunctionDef arguments args NameParam defaults body Assign NameStore AttributeLoad NameLoad attr Assign NameStore BinOpAdd AttributeLoad NameLoad attr AttributeLoad NameLoad attr Assign NameStore AttributeLoad NameLoad attr Assign NameStore BinOpAdd AttributeLoad NameLoad attr AttributeLoad NameLoad attr Assign NameStore AttributeLoad NameLoad attr Assign NameStore AttributeLoad NameLoad attr Expr Call AttributeLoad AttributeLoad NameLoad attr attr Expr Call NameLoad NameLoad Expr Call NameLoad Call BinOpMult NameLoad Num BinOpDiv BinOpSub NameLoad NameLoad Num Num Num Num Num BinOpDiv BinOpSub NameLoad NameLoad Num Num Num Num Num BinOpDiv BinOpSub NameLoad NameLoad Num Num BinOpDiv BinOpAdd NameLoad NameLoad Num BinOpDiv BinOpAdd NameLoad NameLoad Num BinOpDiv BinOpAdd NameLoad NameLoad Num Num Expr Call NameLoad NameLoad Expr Call NameLoad NameLoad Call BinOpMult NameLoad Num Num Num Num Num Expr Call NameLoad NameLoad Call BinOpMult NameLoad Num Num Num Num AttributeLoad NameLoad attr Expr Call NameLoad NameLoad Call BinOpMult NameLoad Num Num Num Num Num Expr Call NameLoad NameLoad Call BinOpMult NameLoad Num Num Num Num AttributeLoad NameLoad attr Expr Call NameLoad NameLoad Expr Call NameLoad NameLoad Expr Call NameLoad NameLoad Expr Call NameLoad NameLoad decorator_list decorator_list
N/A N/A OpenGL viewports and projections.

This is a simplified interface for setting up projections, and viewports
within projections.

A `Viewport` is a rectangular area in space that can be rendered into.  Most
viewports, with the exception of the top-level viewport, belong to an owning
projection. A `Projection` is a function for mapping 2D or 3D objects into an
owning viewport.

The top-level Viewport is an instance of `WindowViewport`, which fills
the entire window.  This viewport will automatically resize when the window
is resized.

The two possible projections are `OrthographicProjection` and
`PerspectiveProjection`.  OrthographicProjection maps to the same coordinate
space as the viewport it belongs to.  PerspectiveProjection uses an arbitrary
unit and a specified field-of-view, and is used to map 3D objects into the
2D viewport.

To use the projection module to render in 2D in a window:

    from pyglet.ext import projection

    w = window.Window()
    viewport = projection.WindowViewport(w)
    projection = projection.OrthographicProjection(viewport)

    @w.event
    def on_resize(width, height):
        projection.apply()

You can also embed additional viewports within a projection.  For example,
a 3D scene can be created within a 2D user interface::

    # x, y, width, height give dimensions of inner viewport within window
    inner_viewport = OrthographicViewport(projection, x, y, width, height)
    inner_projection = PerspectiveProjection(inner_viewport, fov=75)

    @w.event
    def on_resize(width, height):
        inner_projection.apply()

    while not w.has_exit:
        w.dispatch_events()

        w.projection.apply()
        # Draw 2D user interface...

        inner_projection.apply()
        # Draw 3D scene...

        w.flip()

 pyglet.gl * Projection N/A object N/A N/A viewport None N/A OrthographicProjection N/A Projection N/A __init__ N/A N/A self viewport near far N/A -1 1 N/A N/A N/A self viewport viewport N/A N/A self near near N/A N/A self far far N/A apply N/A N/A self N/A N/A N/A N/A N/A N/A self viewport apply N/A N/A glMatrixMode GL_PROJECTION N/A N/A glOrtho 0 N/A N/A self viewport width 0 N/A N/A self viewport height N/A self near N/A self far N/A N/A glMatrixMode GL_MODELVIEW N/A N/A PerspectiveProjection N/A Projection N/A __init__ N/A N/A self viewport fov near far N/A 60 0.1 1000 N/A N/A N/A self viewport viewport N/A N/A self fov fov N/A N/A self near near N/A N/A self far far N/A apply N/A N/A self N/A N/A N/A N/A N/A N/A self viewport apply N/A N/A glMatrixMode GL_PROJECTION N/A N/A gluPerspective N/A self fov N/A N/A N/A self viewport width N/A float N/A N/A self viewport height N/A self near N/A self far N/A N/A glMatrixMode GL_MODELVIEW N/A N/A Viewport N/A object N/A N/A projection None N/A width 0 N/A height 0 N/A WindowViewport N/A Viewport N/A __init__ N/A N/A self window N/A N/A N/A N/A self window window N/A apply N/A N/A self N/A N/A N/A N/A glMatrixMode GL_PROJECTION N/A N/A glLoadIdentity N/A N/A glMatrixMode GL_MODELVIEW N/A N/A glLoadIdentity N/A N/A glViewport 0 0 N/A N/A self window width N/A N/A self window height N/A N/A glDisable GL_CLIP_PLANE0 N/A N/A glDisable GL_CLIP_PLANE1 N/A N/A glDisable GL_CLIP_PLANE2 N/A N/A glDisable GL_CLIP_PLANE3 N/A N/A width N/A property N/A N/A N/A self N/A N/A N/A self window width N/A height N/A property N/A N/A N/A self N/A N/A N/A self window height N/A OrthographicViewport N/A Viewport N/A __init__ N/A N/A self projection x y width height near far N/A -1 1 N/A N/A N/A isinstance projection OrthographicProjection N/A N/A self projection projection N/A N/A self x x N/A N/A self y y N/A N/A self width width N/A N/A self height height N/A N/A self near near N/A N/A self far far N/A apply N/A N/A self N/A N/A N/A l N/A self x N/A r N/A N/A self x N/A self width N/A b N/A self y N/A t N/A N/A self y N/A self height N/A n N/A self near N/A f N/A self far N/A N/A N/A N/A self projection apply N/A N/A glMatrixMode GL_PROJECTION N/A N/A glMultMatrixf N/A N/A GLfloat 16 N/A N/A r l 2 0 0 0 0 N/A N/A t b 2 0 0 0 0 N/A N/A f n 2 0 N/A N/A r l 2 N/A N/A t b 2 N/A N/A f n 2 1 N/A N/A glMatrixMode GL_MODELVIEW N/A N/A glClipPlane GL_CLIP_PLANE0 N/A N/A GLdouble 4 1 0 0 0 N/A N/A glClipPlane GL_CLIP_PLANE1 N/A N/A GLdouble 4 -1 0 0 N/A self width N/A N/A glClipPlane GL_CLIP_PLANE2 N/A N/A GLdouble 4 0 1 0 0 N/A N/A glClipPlane GL_CLIP_PLANE3 N/A N/A GLdouble 4 0 -1 0 N/A self height N/A N/A glEnable GL_CLIP_PLANE0 N/A N/A glEnable GL_CLIP_PLANE1 N/A N/A glEnable GL_CLIP_PLANE2 N/A N/A glEnable GL_CLIP_PLANE3 N/A N/A