4. Other general information

#
4. Other general information

# 4.1 Double buffering

The Vision Egg operates in double buffered mode. This means that the contents of the ``front'' framebuffer are read by the video card to produce the on-screen display. Meanwhile, clearing and drawing operations always occur on the back framebuffer, which becomes the front buffer on a buffer swap (also called flip). This way, an incomplete frame is never drawn to the screen. However, if the buffers are swapped while the display is only part-way through the front buffer, the top and bottom parts of the display will contain frames drawn at different times and thus lead to a tearing artifact. For this reason the default behavior of the Vision Egg is to synchronize buffer swapping with the vertical blanking period, ensuring that tearing does not happen. (Synchronizing buffer swapping is not available for some video drivers on the linux platform, and may frequently be overriden in the Displays control panel in Windows.)

# 4.2 File layout

Several directories are created in a Vision Egg installation. The files used when a Python script imports any Vision Egg module are in the standard Python ``site-packages'' directory. Next, the Vision Egg system directory contains data files such as sample images used by the demo scripts and a site-wide configuration file. A user-specific configuration file is looked for is the VisionEgg home directory. On your system, you can determine the exact location of these directories by running the ``check-config.py'' script, which is distributed with the Vision Egg. If you have installed the Vision Egg from source, you will also have the source directory.

# 4.3 Priority control

The Vision Egg can take advantage of operating system dependent methods of setting the priority of an application. The performance and features vary from platform to platform. The options available from OS specific system calls are available in the Vision Egg. Before trying something new, do not attempt to increase your script's priority, because this may result in locking up the computer.

# 4.4 The log file: Warnings and errors

The Vision Egg uses the standard Python logging package to log information including warnings and errors to two locations by default: the standard error stream (as standard for Python scripts) and to a file called ``VisionEgg.log'' in the current directory. The standard error stream is typically printed on the console, which may only be visible when running your script from the command line. If your script (or modules it imports) raise a `SyntaxError`, the Vision Egg will be unable to start and therefore unable to copy the exception traceback to the log file, and viewing the standard error is the only way to see what went wrong. Therefore, if your log file does not display an error but your script is not executing, run it from the command line. Also, on Mac OS X, the standard error output is only visible through the Console.app available in ``/Applications/Utilities''.

You can increase the verbosity of the output by doing something like ``VisionEgg.logger.setLevel( VisionEgg.logging.DEBUG )'' in your script.

# 4.5 Configuration options

A number of options that control behavior of the Vision Egg are available. These options are first determined when the `VisionEgg.Configuration` module is loaded (by the base module `VisionEgg`, for example). This module first loads variables from the ``VisionEgg.cfg'' file and then checks for environment variables that override these values.

The values set by `VisionEgg.Configuration` may be overriden at any time by re-assigning the appropriate variable. For example:

    import VisionEgg

    # Turn off GUI window when calling create_default_screen()
    VisionEgg.config.VISIONEGG_GUI_INIT = 0

# 4.6 For more information

A significant amount of documentation is contained within the source code as ''docstrings'' -- special comments within the code. These docstrings are often the best source of information for a particular class or function. In particular, the fundamentally important classes in the `VisionEgg.Core` module are well documented. You can either browse the source code itself, look at the library reference compiled from the source, or use a utility such as PyDoc to compile your own reference from the source.

The Vision Egg mailing list is another source of valuble information. Sign up and browse the archives through the Vision Egg website.

For installation instructions, the Vision Egg website provides the most up-to-date, platform-specific information.

To create your own stimuli you need to know OpenGL. To learn more about OpenGL, you may want to begin with ``The Red Book'' (The OpenGL Programming Guide, The Official Guide to Learning). The OpenGL specification is also useful (available online).