display() Creates a display with the specified attributes, makes it the selected display, and returns it. For example, the following creates another Visual display window 600 by 200, with 'Graph of position' in the title bar, centered on (5,0,0) and with a background color of cyan filling the window.
select() Makes the specified display the "selected display", so that objects will be drawn into this display by default; e.g. scene.select()
The function display._selected() returns a reference to the display in which objects are currently being created (which will be None if no display has been created yet).
foreground Set color to be used by default in creating new objects such as sphere; default is white. Example: scene.foreground = (1,0,0)
background Set color to be used to fill the display window; default is black.
stereo Stereoscopic option;
scene.stereo = 'redcyan' will generate a
scene for the left eye and a scene for the right eye, to be viewed with
red-cyan glasses, with the red lens over the left eye. (There are also 'redblue'
and 'yellowblue' options; note that objects
that were not originally white may be somewhat dim.)
Setting scene.stereo = 'crosseyed' produces side-by-side images which if small enough can be seen in 3D by crossing your eyes but focusing on the screen (this takes some practice). Setting scene.stereo = 'passive' produces side-by-side images which if small enough can be seen in 3D by looking "wall-eyed", looking into the far distance but focusing on the screen (this too takes some practice).
scene.stereo = 'active' will render alternating left eye/right eye images for viewing through shutter glasses if the graphics system supports quad buffered stereo. If stereo equipment is not available, setting the option has no effect, and scene.stereo will have the value 'nostereo'. You can also use scene.stereo = 'passive' with quad buffered stereo for display using two polarized projectors (for stereo viewing using simple passive polarized glasses). (Quad buffered 'active' stereo is only available on specialised graphics systems that have the necessary hardware and shutter glass connector, such as PCs with nVidia Quadro graphics cards. It generates the illusion of depth by rendering each frame twice from slightly different viewpoints corresponding to the left and right eyes. Special shutter glasses are synchronised with the alternating images so that each eye sees only the matching frame, and your brain does the rest. It's called 'quad buffered' because there is an OpenGL buffer per eye, both double-buffered for smooth updating. 'Passive' stereo requires a video card that can drive two monitors, or two projectors.)
stereodepth By default, the front of the scene is located at the location of the physical screen, which reduces eye strain. Setting scene.stereodepth = 1 moves the center of the scene to the location of the physical screen, with the front half of the scene seeming to stick dramatically out of the screen. scene.stereodepth = 2 moves the scene fully in front of the physical screen, for maximally dramatic stereo effect.
ambient Amount of nondirectional ("ambient") lighting. Default is 0.2. Also see the following lights attribute.
lights List of vectors representing directions from the origin to the lights. The magnitude of the vector is the intensity. For example, scene.lights = [vector(1,0,0)] with scene.ambient = 0 will light the scene from the right side, with no ambient lighting on the left. By default there are two lights in the list: (0.17, 0.35, 0.70), magnitude 0.8, and (-0.26, -0.07, -0.13), magnitude 0.3. The attributes lights and ambient must be used with some care, because if the total lighting intensity exceeds 1 anywhere in the scene the results are unpredictable.
cursor.visible By setting scene.cursor.visible = 0, the mouse cursor becomes invisible. This is often appropriate while dragging an object using the mouse. Restore the cursor with scene.cursor.visible = 1.
objects A list of all the visible objects in the display; invisible objects are not listed. For example, this makes all boxes in the scene red:
for obj in scene2.objects:
if obj.__class__ == box # can say either box or 'box'
obj.color = color.red
To obtain camera position, see Mouse Interactions.
Controlling the window
x, y Position of the window on the screen (pixels from upper left)
width, height Width and height of the display area in pixels: scene.height = 200
title Text in the window's title bar: scene.title = 'Planetary Orbit'
visible Make sure the display is visible; scene2.visible = 1 makes the display named scene2 visible. This is automatically called when new primitives are added to the display, or the mouse is referenced. Setting visible to 0 hides the display.
fullscreen Full screen
option; scene2.fullscreen = 1
makes the display named scene2 take
up the entire screen. In this case there is no close box visible; press
Escape to exit.
There is currently a bug in the fullscreen option for Linux/Unix/Mac OSX. Keyset input is not recognized, including the Escape key. If you use the fullscreen option on these systems, be sure to program a mouse input for quitting the program.
exit If sceneb.exit = 0, the program does not quit when the close box of the sceneb display is clicked. The default is sceneb.exit = 1, in which case clicking the close box does make the program quit.
Controlling the view
center Location at which the camera continually looks, even as the user rotates the position of the camera. If you change center, the camera moves to continue to look in the same "compass" direction toward the new center, unless you also change forward (see next attribute). Default (0,0,0).
autocenter scene.center is continuously updated to be the center of the smallest axis-aligned box containing the scene. This means that if your program moves the entire scene, the center of that scene will continue to be centered in the window.
forward Vector pointing in the same direction as the camera looks (that is, from the current camera location, given by scene.mouse.camera, toward scene.center). The user rotation controls, when active, will change this vector continuously. When forward is changed, the camera position changes to continue looking at center. Default (0,0,-1).
fov Field of view of the camera in radians. This is defined as the maximum of the horizontal and vertical fields of view. You can think of it as the angular size of an object of size range, or as the angular size of the longer axis of the window as seen by the user. Default pi/3.0 radians (60 degrees).
range The extent of the region of interest away from center along each axis. This is always 1.0/scale, so use either range or scale depending on which makes the most sense in your program. Default (10,10,10) or set by autoscale.
scale A scaling factor which scales the region of interest into the sphere with unit radius. This is always 1.0/range, so use either range or scale depending on which makes the most sense in your program. Default (0.1,0.1,0.1) or set by autoscale.
uniform = 0 each axis has different units and scales
autoscale will scale axes independently
the x and y axes will be scaled by the aspect ratio of the window
uniform = 1 each axis has the same scale
autoscale scales axes together
the aspect ratio of the window does not affect scaling
up A vector representing world-space up. This vector will always project to a vertical line on the screen (think of the camera as having a "plumb bob" that keeps the top of the screen oriented toward up). The camera also rotates around this axis when the user rotates "horizontally". By default the y axis is the up vector.
There is an interaction between up and forward, the direction that the camera is pointing. By default, the camera points in the -z direction (0,0,-1). In this case, you can make the x or y axes (or anything between) be the up vector, but you cannot make the z axis be the up vector, because this is the axis about which the camera rotates when you set the up attribute. If you want the z axis to point up, first set forward to something other than the -z axis, for example (1,0,0).
autoscale = 0 no automatic scaling (set range or scale explicitly)
autoscale = 1 automatic scaling (default)
It is often useful to let Visual make an initial display with autoscaling, then turn autoscaling off to prevent further automated changes.
userzoom = 0 user cannot zoom in and out of the scene
userzoom = 1 user can zoom (default)
userspin = 0 user cannot rotate the scene
userspin = 1 user can rotate (default)