Introduction to the Universe class

Universe construction and destruction

void WTuniverse_new(DISPLAY_CONFIG, WINDOW_CONFIG)

Creates a new empty universe container

Parameters:

DISPLAY_CONFIG -- Can be one of the following listed predefined types:

Parameter Meaning
WTDISPLAY_DEFAULT Creates a single window
WTDISPLAY_NOWINDOW No window will be created.  sometimes useful when creating a GUI using Motif, MFC, or WTK UI functions
WTDISPLAY_CRYSTALEYES For CrystalEyes glasses.  Creates a single full screen stereo window which has no border.
WTDISPLAY_STEREO Creates 2 windows.  Should only be used by legacy code.
WTDISPLAY_NEEDSTENCIL Can be combined with WTDISPLAY_DEFAULT or WTDISPLAY_NOWINDOW by using the OR operator (|), to request the use of the stencil buffer.

WINDOW_CONFIG -- predefined type the specifies host specific window parameters. Provides the characteristics for the window the WTK will render to.

Parameter Meaning
WTWINDOW_DEFUALT No special attributes window has a border
WTWINDOW_STEREO Creates a stereo window on systems that have hardware support for stereo.   On systems without hardware stereo support, this option will create 2 images in the window (one on top with the left eye view, the other on the bottom with the right eye view).  On Windows platforms, if this option is selected and the WTDISPLAY_NEEDSTENCIL option is selected in the display_param parameter, the behavior you will obtain is that of WTWINDOW_STEREOVSPLIT.
WTWINDOW_STEREOVSPLIT This option can be combined wiht the WTWINDOW_STEREO option by using the OR operator (|), to create 2 images in the window (one on top wiht the left eye view and one on bottom with the right eye view), even if you system has hardware stereo support.   In essence, the option will cause WTK to disable you system's stereo hardware and to create a "vertically split" stereo window instead.
WTWINDOW_RBSTEREO Red/Blue stereo display
WTWINDOW_INTERLACEEVENODD Creates an interlaced stereo window whose even numbered scan lines correspond to the left eye view and whose odd numbered scanlines correspond to the right eye view.  This option requires that the WTDISPLAY_NEEDSTENCIL option be selected for the display_config parameter.
WTWINDOW_INTERLACEODDEVEN Opposite of WTWINDOW_INTERLACEEVEODD.
WTWINDOW_NOBORDER Window without a border
WTWINDOW_SCREENn n is a number from 0 - 8. This constant is used in the multi-pipe/multi-processor version of WTK and indicates the screen number upon which the window will be created.

 

void WTuniverse_delete(void);

Understanding the Simulation Manager

Readying the loop -- Before calling WTuniverse_go you must call WTuniverse_ready

Launching the loop -- go VS go1 -- WTuniverse_go put the loop into an endless cycle (infinite loop) go1 runs the simulation loop once.

Function description:

void WTuniverse_go(void);

Function Description:

void WTuniverse_go1(void);

Setting and Getting the Simulation Loop Event Order

Function description

FLAG WTuniverse_seteventorder(short nevents, short *events);

Parameters

short nevents -- always four is only provided for future compatibility
short *events
-- a pointer to an array of four shorts containing the following values:

Parameter Meaning
WTEVENT_ACTIONS User defined action function
WTEVENT_OBJECTSENSOR Graphical objects and viewpoints are updated with sensor input
WTEVENT_TASKS Object task functions
WTEVENT_PATHS Paths in record or playback mode are stepped.

Example of usage:

short eventorder[4];
FLAG success;
eventorder[0] = WTEVENT_OBJECTSENSOR;
eventorder[1] = WTEVENT_TASKS;
eventorder[2] = WTEVENT_ACTIONS;
eventorder[3] = WTEVENT_PATHS;
success = WTuniverse_seteventorder(4, eventorder);

 

Function Description

short *WTuniverse_geteventorder(void);

Example of usage:

short eventorder[4];
eventorder = WTuniverse_geteventorder();

Important Notes:

DO NOT modify the returned array or the results are undefined since it is a pointer to the event order array!!!!!

 

Understanding the User Defined Action Function

Function Description

void WTuniverse_setactions(void (*actionfn)(void));

Parameters:

void (* actionfn)(void) -- a pointer to the function defined by the user

Note

The action function can have no parameters

Example of Usage:

#include "wt.h"
void actionfn(void);
void main(void)
{

WTuniverse_new(WTDISPLAY_DEFAULT, WTWINDOW_DEFAULT);
….
….
WTuniverse_setactions(actionfn);
….
WTuniverse_ready();
WTuniverse_go();
WTunvierse_delete();

}

void actionfn(void)
{

/* functionality included here */

}

 

Introduction to platform compatibility

Lab 1 -- Your first WTK application -- HELLO WORLD

 

 

Universe Objects

 

Introduction to Global Rendering Parameters

Style Meaning
WTRENDER_GOUROUD Enable gouraud shading
WTRENDER_TEXTURED Enable texturing
WTRENDER_PERSPECTIVE Enable texture perspective corrections
WTRENDER_ANTIALIAS Enable anti-aliasing
WTRENDER_WIREFRAME Enable wireframe rendering
WTRENDER_BEST Enables all of the above.