![]() |
VR-Vantage 2.2 API Documentation
|
This example shows how to create an OpenGL application. This particular application shows how to render a simple cube using OpenGL primitive set. The cube is lit by a single OpenGL light.
The VR-Vantage architecture consists of many layers and at its lowest level is OpenGL. Although it is rare that a developer will have to program at this level we provide a few examples anyway.
The example is organized into three main sections. First is a section that defines the shape of the cube and a helper function to draw it. The second section has functions for setting up and rendering the scene. Last is the main function which initializes OpenGL and then runs the main loop.
The geometry is defined by a set of vertices. The side of the cube is of length 3 units.
These vertices only define points in space, they do not define the faces of the geometry. Faces are defined by the order of vertices making up the edges of each face.
Each face is drawn by specifying the type of geometry primitive and the order of the vertices for that primitive.
OpenGL allows us to specify upto 7 different lights. This section enables a single light (GL_LIGHT0) and specifies its properties.
The main function is used to initialize OpenGL and specify which function callbacks to call when rendering before starting the main loop.
VR-Vantage includes pre-built versions of the example application. To build it yourself, follow the instructions at Building VR-Vantage Examples, Applications, and Plug-ins.
This example is an application. You can run it by running ./bin/exampleOpenGLSimple.exe (on Windows) or ./bin/exampleOpenGLSimple (on Linux). For more information about running examples, please see Running Applications and Examples.