Table
of Contents
#include "GWin3D.h"
// this function draws one frame.
it is called 20 times per second
void __fastcall UpdateFrameFunction( gwWindow
*Win)
{
// create a 3D object from a
VRML model file
// (since this is static, its
created only the first time this function is called)
static gwSprite
MySprite("MyVrmlFile");
// rotate the object
MySprite.ModifyRotation
(10,17,23);
// draw the object
in the window
MySprite.Draw(Win);
}
void main(void)
{
// initialize the GWin3D library
gwInitLib();
// create a 3D window and
specify the frame-drawing
function
gwWindow
MyWindow(NULL,UpdateFrameFunction,GW_BLOCK);
}
// This is at the top of the gwWindow
's PeriodicFunction:
gwTimer
Elapsed;
// main body of the PeriodicFunction is here
...
...
Universe.Draw(Win);
// This code is at the bottom of the
PeriodicFunction:
// Adjust the period to be a little more than how
long it took this
// function to execute (this assumes Win->MaxElapsedTimeMs
// is very large so that highest LODs
are always used):
Win->RealTimeTask->Period
= Elapsed.Get()/800;
| Level of detail (where 0=highest) | Maximum number of polygons | Actual number of polygons (example) | |
| 0 | 2097152* | 340 | |
| 1 | 524288* | 340 | |
| 2 | 131072* | 340 | |
| 3 | 32768* | 340 | |
| 4 | 8192* | 340 | |
| 5 | 2048 | 340 | |
| 6 | 512 | 340 | |
| 7 | 128 | 340 | |
| 8 | 32 | 40 | |
| 9 | 8 | 8 | |
| 10 | 2 | 0 | |
| (11 and beyond) | 0 | 0 |