UNITS
CLASSES, INTERFACES, OBJECTS
TYPES
VARIABLES
CONSTANTS
FUNCTIONS, PROCEDURES
IDENTIFIERS

Class TOpenGL

Unit

OpenGL_Base

Declaration

type TOpenGL = class(TObject)

Description

This class provides the basic functionality for a small OpenGL based renderer, like setting up the rendering context, loading textures and providing a DeltaTime based rendering call.

Fields

NameDescription
ColorBits Desired colour depth. Copied from Rendering_Info.
FrameCount Count of all frames rendered since init. Used to calculatea frame-rate later.
fWidth Width & height of window/control which is rendered to. (GlFloat)
h_DC The appropiate device context.
h_RC OpenGL rendering context.
h_WND Handle of window/control which will be rendered into. Copied from Rendering_Info.
LastTickCount tick-count of last rendered frame
Rendering_Info Storage for TOpenGL_Info record, which is passed with the create procedure.
TexSize Specifies the maximum allowed size for the textures. Copied from Rendering_Info.
TextureIndex Contains the references to all textures used by the renderer. References are generated in one of the three CreateTexturesFrom* procedures.
Width Width & height of window/control which is rendered to. (Integer)

Methods

Overview

constructor Create( const OGL_Info : TOpenGL_Info );
destructor Destroy; override;
procedure CreateRenderingContext;
procedure CreateTextureFrom256Bitmap( Bitmap : TBitmap; RGBAQuads : array of TRGBAQuad; Index : Gluint );
procedure CreateTextureFromFile( Filename : string; Index : GLuint );
procedure CreateTextureFromTBitmap( Bitmap : TBitmap; Index : GLuint );
procedure Free;
procedure InitGL;
procedure KillGL;
procedure Render( DeltaTime : longint ); virtual; abstract;
procedure RePaint;
procedure ResizeGL( NWidth, NHeight : integer );

Description

constructor Create( const OGL_Info : TOpenGL_Info );

Constructor

destructor Destroy; override;

Destructor

procedure CreateRenderingContext;

Initialise the OpenGL rendering context.

procedure CreateTextureFrom256Bitmap( Bitmap : TBitmap; RGBAQuads : array of TRGBAQuad; Index : Gluint );

Create a texture from a 256 color, palettized TBitmap. Palette must be passed as an array of TRGBAQuad

procedure CreateTextureFromFile( Filename : string; Index : GLuint );

Create a texture from a bitmap file. Bitmap is loaded and passed to CreateTextureFromTBitmap as a parameter.

procedure CreateTextureFromTBitmap( Bitmap : TBitmap; Index : GLuint );

Create a texture from a TBitmap (any color depth). Procedure is currently very slow due to the use of TCanvas.Pixels.

procedure Free;

Standard .Free procedure.

procedure InitGL;

Set up a few parameters for OpenGL, including viewport frustrum and dimensions.

procedure KillGL;

Destroy and free rendering context.

procedure Render( DeltaTime : longint ); virtual; abstract;

Abstract procedure to render the scene data. Must be overwritten by every decendant of TOpenGL.

procedure RePaint;

RePaint is called to update DeltaTime (in ms) and calls Render to render the scene.

procedure ResizeGL( NWidth, NHeight : integer );

Handles resizing of viewport.

Properties

None.


Generated by pasdoc 0.6.20 on Wed 20 Mar 2002 20:59:34