An "HELLO WORLD!" application in XVR

The following code shows a very simple example of an XVR application. It just shows on screen a rotating 3D mesh. Please note that in order to make this program run the first time you must be connected to the Internet, as the mesh “Hello World” is downloaded from the VRMedia website. 

 

//These Includes are always necessary
#include <Script3d.h>
#include <GLConst.h>
#include <Impulse.h>

//Global variables
var M_hello

var O_hello;
 

function OnDownload()
{
    FileDownload("http://www.cs.ucl.ac.uk/staff/F.Tecchia/XVR/helloworld.zip");   
}


functon OnInit()

{

    

           
M_hello = LoadNewMesh(“helloworld.aam”)

           
O_hello = NewObject(M_hello);

           
SetCameraPosition(0,0,10);

           
SetFrameRate(30);

           
SetTimer(10);

}


function OnFrame()
{

        
SceneBegin();

           
            O_hello.Draw();

           
SceneEnd();

}


function OnTimer()
{

           
O_hello.Rotate(0.5,0,1,0);

}

function OnEvent()
{

           
//NOT USED

}


function OnExit()

{

           
//NOT USED

}







© 2004 - 2005 Franco Tecchia