Examples for DIVE 3.3x

The simple examples below are meant to help an application programmer create simple Dive applications using the Dive file format interface , the Dive/Tcl interface, the DIVE Client Interface (DCI) and the Dive functional interface.

To make it easier, we have chosen one application, namely a clock showing the time of day and incrementing its hands every second, minute and hour. This simple example has been implemented using the different techniques. For more elaborate examples the Dive3 reference manual should be consulted.

Examples:

* Passive data file defining the graphics of the clock objects using the DIVE file format: clock.vr.

* Passive data file defining the graphics of the clock objects using the VRML file format: clock.wrl

* The clock application implemented as a C program using the Dive functional interface: clock.c. Using this approach, the application runs as a separate process that monitors and modifies objects in a DIVE world.

Advantages
A general approach with access to all DIVE functionalities.
Disadvantages
The Dive libraries must be linked.
The application must run as a separate process that controls the behaviour of the passive clock object.

* The clock application implemented with object-based behaviour using the Dive/Tcl interface: tcl_clock.vr. Using this approach the behaviour of the application is defined declaratively in the object itself by Dive/Tcl commands.

Advantages
The behaviour is contained within the object and is therefore autonomous and independent of any process.
Disadvantages
Tcl interpreted code is slow.
The Dive/Tcl interface only gives a subset of the functionality in DIVE.

Implementing the clock application in Dive/Tcl can be made in severals ways, among which:

* The clock application implemented using the Dive/Dci interface: dci_clock.tcl. In this approach an external application or environment can load Dive/Tcl commands into a DIVE peer through a socket interface, as the standard DIVE shell application, divesh.c.

Advantages
The application can be programmed in an external environment without linking the Dive libraries.
Disadvantages
The limitations and speed of the Dive/Tcl interface.

Emmanuel Frécon / emmanuel@sics.se