Delphi

OpenGL

Projects

gltemplate

This is the template is use for Delphi OpenGL applications.
There is no support for Kylix yet.
The template is based on the template from http://www.sulaco.co.za/.

Put glwin.pas and glwinvar.pas in a library folder. Do not edit these files.
Put glapp.pas and OpenGLApp.dpr in your project. Use the files to make your openg application.

In glapp.pas there are the following procedures:
procedure gldraw; //draw the scene
procedure glinit; //init the scene
procedure glexit; //exit the scene
procedure glanim; //set advance animations
procedure ProcessKeys; //process keyboard
procedure ProcessMouseClick; //process mouse clicks
procedure ProcessMouseMove; //process mouse moves
Fill these with your own rendering animations etc program lines.

In glwinvar there are the following vars you can use:
WND_TITLE: pchar = ’OpenGL 1.5 Template Example by Noeska’;
WND_XSIZE: integer = 800;
WND_YSIZE: integer = 600;
WND_FULLSCREEN: boolean = FALSE;
WND_BPP: integer = 32;
WND_SHOWCURSOR: boolean = FALSE;
FPS_TIMER: integer = 1;                     // Timer to calculate FrameRate
FPS_ANIM_TIMER: integer = 2;                // Timer for animation
FPS_INTERVAL: integer = 1000;               // Calculate FPS every 1000 ms
h_Wnd  : HWND;                     // Global window handle
h_DC   : HDC;                      // Global device context
h_RC   : HGLRC;                    // OpenGL rendering context
FPSCount : Integer = 0;            // Counter for FPS
ElapsedTime : Longword;             // Elapsed time between frames
finished : Boolean;                //exit application if true
cursoron: boolean= true;
// Mouse Variables
MouseMove : boolean = false;        // Is the mouse moving?
MoveXcoord, MoveYcoord : Integer;   // Current X and Y position of the cursor
MouseButton : Integer = -1;         // mouse button down
Xcoord, Ycoord : Integer;           // Current X and Y position where the mouse was clicked
// Keyboard Variables
keys : Array[0..255] of Boolean;   // Holds keystrokes
currentkey: integer;               // Holds last keystroke

More documentation and cleaner sourcecode will follow...