VisionEgg.Core.Viewport

Package VisionEgg :: Module Core :: Class Viewport |
[frames] | no frames]

# Class Viewport

source code

             object --+
                      |
    ClassWithParameters --+
                          |
                         Viewport

    Connects stimuli to a screen.

    A viewport defines a (possibly clipped region) of the screen on
    which stimuli are drawn.

    A screen may have multiple viewports.  The viewports may be
    overlapping.

    A viewport may have multiple stimuli.

    A single stimulus may be drawn simultaneously by several
    viewports, although this is typically useful only for 3D stimuli
    to represent different views of the same object.

    The coordinates of the stimulus are converted to screen
    coordinates via several steps, the most important of which is the
    projection, which is defined by an instance of the Projection
    class.

    By default, a viewport has a projection which maps eye coordinates
    to viewport coordinates in 1:1 manner.  In other words, eye
    coordinates specify pixel location in the viewport.

    For cases where pixel units are not natural to describe
    coordinates of a stimulus, the application should specify the a
    projection other than the default.  This is usually the case for
    3D stimuli.

    For details of the projection and clipping process, see the
    section 'Coordinate Transformations' in the book/online document
    'The OpenGL Graphics System: A Specification'

    Parameters
    ==========
    anchor        -- How position parameter is interpreted (String)
                     Default: lowerleft
    camera_matrix -- extrinsic camera parameter matrix (position and orientation) (Instance of <class 'VisionEgg.Core.ModelView'>)
                     Default: (determined at runtime)
    depth_range   -- depth range (in object units) for rendering (Sequence2 of Real)
                     Default: (0, 1)
    position      -- Position (in pixel units) within the screen (Sequence2 of Real)
                     Default: (0, 0)
    projection    -- intrinsic camera parameter matrix (field of view, focal length, aspect ratio) (Instance of <class 'VisionEgg.Core.Projection'>)
                     Default: (determined at runtime)
    screen        -- The screen in which this viewport is drawn (Instance of <class 'VisionEgg.Core.Screen'>)
                     Default: (determined at runtime)
    size          -- Size (in pixel units) (Sequence2 of Real)
                     Default: (determined at runtime)
    stimuli       -- sequence of stimuli to draw in screen (Sequence of Instance of <class 'VisionEgg.Core.Stimulus'>)
                     Default: (determined at runtime)

Instance Methods
__init__(self, **kw) Create a new instance. | source code
make_new_pixel_coord_projection(self) Create instance of Projection mapping eye coordinates 1:1 with pixel coordinates. | source code
make_current(self) | source code
draw(self) Set the viewport and draw stimuli. | source code
norm_device_2_window(self, norm_device_vertex) Transform normalized device coordinates to window coordinates | source code
clip_2_window(self, eye_coords_vertex) Transform clip coordinates to window coordinates | source code
eye_2_window(self, eye_coords_vertex) Transform eye coordinates to window coordinates | source code
Inherited from `ClassWithParameters`: `__getstate__`, `__setstate__`, `get_specified_type`, `is_constant_parameter`, `set`, `verify_parameters` Inherited from `object`: `__delattr__`, `__getattribute__`, `__hash__`, `__new__`, `__reduce__`, `__reduce_ex__`, `__repr__`, `__setattr__`, `__str__`

Class Variables
| parameters_and_defaults = `VisionEgg.ParameterDefinition({'scre`...``
Inherited from `ClassWithParameters`: `__safe_for_unpickling__`, `constant_parameters_and_defaults`

Properties
Inherited from `object`: `__class__`

Method Details

### __init__(self, **kw) (Constructor) | source code
    Create a new instance.

    Required arguments:

    screen

    Optional arguments (specify parameter value other than default):

    position -- defaults to (0,0), position relative to screen by anchor (see below)
    anchor -- defaults to 'lowerleft'
    size -- defaults to screen.size
    projection -- defaults to self.make_new_pixel_coord_projection()
    stimuli -- defaults to empty list
Overrides: ClassWithParameters.__init__

Class Variable Details

  ### parameters_and_defaults Value:
      VisionEgg.ParameterDefinition({'screen':(None, ve_types.Instance(Scree
      n), 'The screen in which this viewport is drawn'), 'position':((0, 0),
       ve_types.Sequence2(ve_types.Real), 'Position (in pixel units) within
      the screen'), 'anchor':('lowerleft', ve_types.String, 'How position pa
      rameter is interpreted'), 'depth_range':((0, 1), ve_types.Sequence2(ve
      _types.Real), 'depth range (in object units) for rendering'), 'size':(
      None, ve_types.Sequence2(ve_types.Real), 'Size (in pixel units)'), 'pr
      ojection':(None, ve_types.Instance(Projection), 'intrinsic camera para
      ...