NXC  Version 1.2.1 r5
 All Data Structures Files Functions Variables Groups Pages
glRotateDemo.nxc

This is an example of how to use the glInit, glBox, glSetAngleX, glBeginRender, glCallObject, glObjectAction, and glFinishRender functions.

/*------------------------------------------------------------------------------
; File : glRotateDemo.nbc
; Description : A program demonstrating two 3D boxes with rotate actions...
; Programmed by : Arno van der Vegt, avandervegt@home.nl
;-----------------------------------------------------------------------------*/
int angleX, angleY;
task main()
{
// Initialize the 3D engine...
glInit();
// Create a box, this is the first object which will be object id 0...
glBox(GL_POLYGON, 20, 20, 20);
// Create a box, this is the second object which will be object id 1...
glBox(GL_POLYGON, 40, 40, 40);
angleX = 0;
angleY = 0;
while (true) {
// Setup for rendering...
// Call the object with id 0...
// Call the object with id 1...
// Finish, clear the screen, rotate and render the called objects...
angleX += 3;
angleX %= 360;
angleY += 5;
angleY %= 360;
}
}