<<<<<<<<<<<<<<<<<

Gl(gl) LYMB Gl(gl)

NAME

gl - an interface to the Silicon Graphics GL rendering library

DESCRIPTION

The gl class renders an image defined with LYMB objects (camera, lights, actors and modellers) using Silicon Graphics' GL rendering library.

SUPERCLASS

renderer

INSTANCE VARIABLES

pref_size The desired width and height of the graphics window in pixels. The default value of (-1,-1) allows the user to set the size interactively.

pref_position The desired location of the graphics window in screen coordinates. The default value of (-1,-1) allows the user to place the window. This only has an effect if pref_size has also been set. If both pref_size and pref_position are set, then the window will appear on the screen without the user intervening.

borders A flag to control whether borders will be placed on the graphics window. A non-zero value produces borders. This must be set prior to the first render! message.

MESSAGES

stereo_interlaced_NTSC! Set the window to display left/right eye views in NTSC even/odd fields. This format is used by the 3DTV stereo glasses and can be recorded on standard video tape.

stereo_red_blue! Set the window to display left/right eye views in red & blue. This format is used by the cardboard red/blue glasses.

stereo_crystal_eyes! Set the window to display left/right eye views on a 120Hz stereo ready monitor. This format is used by the SGI with the StereoGraphics CrystalEyes glasses.

stereo_left_eye! Set the window to display the left eye view of the stereo image. This format can be used if two

separate video sources are required, for example, polarized light projectors.

stereo_right_eye! Set the window to display the right eye view of the stereo image.

pref_size[=?] Set/get the window's width and height in pixels.

pref_position[=?] Set/get the screen coordinates of the upper-left corner of the window.

borders[=?] Set/get the value of the borders flag.

borders_on! Turn borders on.

borders_off! Turn borders off.

initialize! Opens gl via winopen(), places the process in the foreground, sets the aspect and window size and position (according to pref_size and pref_position), sets double buffering, turns on z- buffering, and turns on an ambient light source.

start! Performs tasks needed before each frame is rendered. If this is the first time that a gl object has received a render!, then the system is first initialized. Then the background color is set and the frame buffer and z-buffer are initialized.

frame! Updates the display by swapping the frame buffers.

update_actor: The specified actor is drawn on the display using gl geometric primitive calls.

update_camera: The view described by the specified camera is defined in gl calls.

update_light: The specified lights are defined using gl calls.

render_all! Renders all instances of gl deferring a buffer update (via frame!) until the last instance is rendered.

update_render_time! Overrides the inherited method to update the last time an image was rendered. This method always sets render_time to 0, forcing the start! message to initiate each frame of animation.

EXAMPLES

The following LYMB script demonstrates how an image is defined in LYMB. A camera is created which describes the view. A light is created which provides illumination. A geometric object is defined using a modeller and an actor. Finally, a renderer is created and informed about the elements (camera, light, actor) that comprise the image. The image is drawn by sending a render! to the rendering instance.

camera new: acamera position=(8,8,8) focal_point=(0.0,0.0,0.0) view_angle=30 on! ;

light new: alight position=(10,5,8) on! ;

cylinder_modeller new: cylinder_model;

actor new: cylinder color=(1,0,0) modeller=cylinder_model ;

gl new: arenderer actors=cylinder cameras=acamera lights=alight ;

arenderer render!;

SEE ALSO

actor, camera, light, renderer, model, vogle, starbase, phigs, gl_modeller

NOTES AND BUGS

Surface Properties Like Stellar PHIGS, GL uses an alpha-buffer transparency method which is dependent on the order primitives are rendered in. The effect only looks right when transparent objects are rendered last.

When primitives are colored as a whole (without vertex colors), transparency works as expected. When vertex colors are being used, transparency becomes a modeller-level property and the modeller must be modified to see the effect on the screen. See Other Notes below.

Representations Representation changes are only noted on the next open! from the modeller to the rendering primitive, thus, you must send the modeller a modified! to see the effect. See Other Notes below.

Shading Models GL does not support Phong shading.

Window Informaion GL does not currently support X Windows to any degree. Instead, the native 4Sight windowing system allows X applications to run under it. Thus, the user interface can still run side-by-side with the graphics.

Other Notes In GL transparency is an optional part of an objects color. Colors can be specified as RGB triplets or as an RGBA four-tuple. When one color is set for an entire primitive, this works fine and transparency is just like another material property. When a primitive is using vertex colors, though, the transparency of the primitive must be set along with each vertex color. Now the transparency has become part of the geometry. Thus, when changing the transparency of a primitive that is being colored with vertex values, the effect will not be noticed until the modeller next sends its geometry down to the rendering primitive so it can be rebuilt.

GL also treats representation as part of the geometry instead of a property. Actually, GL has no notion of "representation", thus the effect is achieved by rebuilding the object's geometry using a different display primitive. Like transparency with vertex colors, the effect will not be noticed until the primitive is rebuilt.


Please send comments and suggestions to
consult@rpi.edu