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

# Class Screen

source code

             object --+
                      |
    ClassWithParameters --+
                          |
                         Screen

    An OpenGL window, possibly displayed across multiple displays.

    A Screen instance is an OpenGL window for the Vision Egg to draw
    in.  For an instance of Screen to do anything useful, it must
    contain one or more instances of the Viewport class and one or
    more instances of the Stimulus class.

    Currently, only one OpenGL window is supported by the library with
    which the Vision Egg initializes graphics (pygame/SDL).  However,
    this need not limit display to a single physical display device.
    Many video drivers, for example, allow applications to treat two
    separate monitors as one large array of contiguous pixels.  By
    sizing a window such that it occupies both monitors and creating
    separate viewports for the portion of the window on each monitor,
    a multiple screen effect can be created.

    Public read-only variables
    ==========================
    size -- Tuple of 2 integers specifying width and height

    Parameters
    ==========
    bgcolor -- background color (AnyOf(Sequence3 of Real or Sequence4 of Real))
               Default: (0.5, 0.5, 0.5, 0.0)

    Constant Parameters
    ===================
    alpha_bits          -- number of bits per pixel for alpha channel. Can be set with VISIONEGG_REQUEST_ALPHA_BITS (UnsignedInteger)
                           Default: (determined at runtime)
    blue_bits           -- number of bits per pixel for blue channel. Can be set with VISIONEGG_REQUEST_BLUE_BITS (UnsignedInteger)
                           Default: (determined at runtime)
    double_buffer       -- use double buffering? Can be set with VISIONEGG_DOUBLE_BUFFER (Boolean)
                           Default: (determined at runtime)
    frameless           -- remove standard window frame? Can be set with VISIONEGG_FRAMELESS_WINDOW (Boolean)
                           Default: (determined at runtime)
    fullscreen          -- use full screen? Can be set with VISIONEGG_FULLSCREEN (Boolean)
                           Default: (determined at runtime)
    green_bits          -- number of bits per pixel for green channel. Can be set with VISIONEGG_REQUEST_GREEN_BITS (UnsignedInteger)
                           Default: (determined at runtime)
    hide_mouse          -- hide the mouse cursor? Can be set with VISIONEGG_HIDE_MOUSE (Boolean)
                           Default: (determined at runtime)
    is_stereo           -- allocate stereo framebuffers? Can be set with VISIONEGG_REQUEST_STEREO (Boolean)
                           Default: (determined at runtime)
    maxpriority         -- raise priority? (platform dependent) Can be set with VISIONEGG_MAXPRIORITY (Boolean)
                           Default: (determined at runtime)
    multisample_samples -- preferred number of multisamples for FSAA (UnsignedInteger)
                           Default: (determined at runtime)
    preferred_bpp       -- preferred bits per pixel (bit depth) Can be set with VISIONEGG_PREFERRED_BPP (UnsignedInteger)
                           Default: (determined at runtime)
    red_bits            -- number of bits per pixel for red channel. Can be set with VISIONEGG_REQUEST_RED_BITS (UnsignedInteger)
                           Default: (determined at runtime)
    size                -- size (units: pixels) Can be set with VISIONEGG_SCREEN_W and VISIONEGG_SCREEN_H (Sequence2 of Real)
                           Default: (determined at runtime)
    sync_swap           -- synchronize buffer swaps to vertical sync? Can be set with VISIONEGG_SYNC_SWAP (Boolean)
                           Default: (determined at runtime)

Instance Methods
__init__(self, **kw) Create self.parameters and set values. | source code
get_size(self) | source code
set_size(self, value) | source code
get_framebuffer_as_image(self, buffer='back', format=gl.GL_RGB, position=(0,0), anchor='lowerleft', size=None) get pixel values from framebuffer to PIL image | source code
get_framebuffer_as_array(self, buffer='back', format=gl.GL_RGB, position=(0,0), anchor='lowerleft', size=None) get pixel values from framebuffer to Numeric array | source code
put_pixels(self, pixels=None, position=(0,0), anchor='lowerleft', scale_x=1.0, scale_y=1.0, texture_min_filter=gl.GL_NEAREST, texture_mag_filter=gl.GL_NEAREST, internal_format=gl.GL_RGB) Put pixel values to screen. | source code
query_refresh_rate(self) | source code
measure_refresh_rate(self, average_over_seconds=0.1) Measure the refresh rate. | source code
clear(self) Called by Presentation instance. | source code
make_current(self) Called by Viewport instance. | source code
set_gamma_ramp(self, *args, **kw) Set the gamma_ramp, if supported. | source code
close(self) Close the screen. | source code
__del__(self) | 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__`

Static Methods
create_default() Alternative constructor using configuration variables. | source code

Class Variables
| parameters_and_defaults = `VisionEgg.ParameterDefinition({'bgco`...``
| constant_parameters_and_defaults = `VisionEgg.ParameterDefiniti`...``
| size = `property(get_size, set_size)`
Inherited from `ClassWithParameters`: `__safe_for_unpickling__`

Properties
Inherited from `object`: `__class__`

Method Details

### __init__(self, **kw) (Constructor) | source code
    Create self.parameters and set values.
Overrides: ClassWithParameters.__init__ (inherited documentation)

### put_pixels(self, pixels=None, position=(0,0), anchor='lowerleft', scale_x=1.0, scale_y=1.0, texture_min_filter=gl.GL_NEAREST, texture_mag_filter=gl.GL_NEAREST, internal_format=gl.GL_RGB) | source code
    Put pixel values to screen.

    Pixel values become texture data using the VisionEgg.Textures
    module.  Any source of texture data accepted by that module is
    accepted here.

    This function could be sped up by allocating a fixed OpenGL texture object.

### measure_refresh_rate(self, average_over_seconds=0.1) | source code
    Measure the refresh rate. Assumes swap buffers synced.

### clear(self) | source code
    Called by Presentation instance. Clear the screen.

### make_current(self) | source code
    Called by Viewport instance. Makes screen active for drawing.

    Can not be implemented until multiple screens are possible.

### set_gamma_ramp(self, *args, **kw) | source code
    Set the gamma_ramp, if supported.

    Call pygame.display.set_gamma_ramp, if available.

    Returns True on success, False otherwise.

### close(self) | source code
    Close the screen.

    You can call this to close the screen.  Not necessary during
    normal operation because it gets automatically deleted.

### create_default() Static Method | source code
    Alternative constructor using configuration variables.

    Most of the time you can create and instance of Screen using
    this method.  If your script needs explicit control of the
    Screen parameters, initialize with the normal constructor.

    Uses VisionEgg.config.VISIONEGG_GUI_INIT to determine how the
    default screen parameters should are determined.  If this
    value is 0, the values from VisionEgg.cfg are used.  If this
    value is 1, a GUI panel is opened and allows manual settings
    of the screen parameters.

Class Variable Details

  ### parameters_and_defaults Value:
      VisionEgg.ParameterDefinition({'bgcolor':((0.5, 0.5, 0.5, 0.0), ve_typ
      es.AnyOf(ve_types.Sequence3(ve_types.Real), ve_types.Sequence4(ve_type
      s.Real)), 'background color',),})

  ### constant_parameters_and_defaults Value:
      VisionEgg.ParameterDefinition({'size':(None, ve_types.Sequence2(ve_typ
      es.Real), 'size (units: pixels) Can be set with VISIONEGG_SCREEN_W and
       VISIONEGG_SCREEN_H'), 'fullscreen':(None, ve_types.Boolean, 'use full
       screen? Can be set with VISIONEGG_FULLSCREEN'), 'double_buffer':(None
      , ve_types.Boolean, 'use double buffering? Can be set with VISIONEGG_D
      OUBLE_BUFFER'), 'preferred_bpp':(None, ve_types.UnsignedInteger, 'pref
      erred bits per pixel (bit depth) Can be set with VISIONEGG_PREFERRED_B
      PP'), 'maxpriority':(None, ve_types.Boolean, 'raise priority? (platfor
      ...