Printable Version

The SLIDE and Tcl/Tk Relationship

The SLIDE language uses Tcl as its scripting language. The SLIDE renderer, slide, is actually a Tcl wish program which has been augmented with real time 3D rendering capabilities using OpenGL. This relationship has many benefits.

Tcl Dynamics

There are four different ways to incorporate Tcl calls into a SLIDE scene description.





Dynamic Expressions

Embedded TCL

Any floating point value or flag in a SLIDE file can be replaced by a TCL expression that is enclosed in curly braces {}. The value of the expression will be computed once before each rendering of the world.

Dynamic Control Statements

tclinit tcl_code
tclupdate tcl_code

These top level statements allow you to specify arbitrary TCL code that will be run at a particular point in the rendering program. As with other TCL statements, the tcl_code blocks should be enclosed in curly braces {}; the braces will be stripped off before the code is sent to the TCL interpreter.

The tclinit statement adds a block of TCL code to be run when the SLIDE file is first read in. All of the tclinit blocks will be run in the order in which they were encountered in the file. They will be run exactly once. This is a good place to define procedures and create widgets.

The tclupdate statement adds a block of TCL code to be run at the beginning of each update to the scene graph just before rendering. All of the tclupdate blocks will be run in the order in which they were encountered in the file. They will be run once per update. This is a good place to assign values to global variables that will be used by many elements in your SLIDE scene.

SLIDE API

The SLIDE API allows the user to dynamically interact with SLIDE through TCL commands.
The API allows SLIDE objects to be created and deleted as follows:

    slide  create  type   id   [parameters]

    slide  delete  type  id
    For specific parameter syntax see the SLIDE Specification page.


Example:
    tclinit {
      slide create sphere Ball -radius 3
      slide create point p1 { 0 2 1 }

      slide delete sphere Ball
      slide delete point p1

      slide create sphere Ball -radius 6
      slide create point p1 { 1 0 0 }
    }


[an error occurred while processing this directive]