VCL.OpenGL Sample
From RAD Studio XE2 Code Examples
Language:
This sample demonstrates how to handle OpenGL drawing on a TForm.
Contents |
Location
You can find the glskeleton sample project at:
- Start > Programs > Embarcadero RAD Studio > Samples > CPP > VCL > OpenGL
- Subversion Repository for C++: http://radstudiodemos.svn.sourceforge.net/viewvc/radstudiodemos/branches/RadStudio_XE2/CPP/VCL/OpenGL
Description
This application creates a form with three 3D shapes -- a sphere, a cube, and a pyramid -- drawn on the canvas using OpenGL calls. The user can rotate the shapes in all four directions by pressing the arrow keys. The sample exemplifies lighting, texture, and motion for the graphic objects.
How to Use the Sample
- Navigate to Start > Programs > Embarcadero RAD Studio > Samples and open glskeleton.cbproj.
- Press F9 or choose Run > Run.
Files
The project has one source file, glskel, which contains the class for the form enhanced to handle OpenGL drawing.
Classes
TFormMain represents an enhanced form that handles OpenGL drawing and motion.
Implementation
- Texture mapping is handled using a TBitmap.
- The textures are retrieved from image files and loaded into bitmaps with LoadFromFile.
- Refer to the See Also section for more information about the OpenGL methods that are used in this application.