GLScene quickstart guide

It is assumed that you did run the demos. As it is a big package, which requires some digging into, one can become lost quite quick. The purpose of this page summarizes a few points of GLScene. It is designed to enable you do the first steps with out going into the source.

preparations

GLScene is installed and available as components.
Version 073 of GLScene has a little bug that surfaces when installing the FMOD. The build options of GLScene and FMod were different. The solution is : at installation of the FMod, change the build options of both packages to never rebuild. This will be changed in the next version.
FMod is installed and available as components.

First steps

A textured cube, the camera can be zoomed in interactively. Compile,execute - > the texture image zooms until it disappears

next steps

rotate a cube interactively
to the form : Compile,execute - > rotation along the local axis

note

Though Eric didn't test this feature, it certainly is worth a note :
Cube1.TransformationMode:=tmParentNoPos makes the rotations relative to the fixed coordinate system.
Please report, if you find a bug

Results

with some tries

More

animating the objects


adding sound

from the sound demo : the sphere moves, the sound plays. There is more to this, we'll cover it later.

selecting objects

according to the pick demo :
here the emission color was used to highlite the selected object.
It may make sense to store the old emission.color
  oldcolor:THomogeneousFltVector;

where THomogeneousFltVector is defined in Geometry

Materials

A GLMaterialLibrary can hold some materials, textures. Their application is straightforward.
Somehow, containing a few textures, even if they are not used, the compile time of the project increases significantly. The are part of the DFM file and compiled as such. Replace BMP with JPG.

Textures

According to OpenGL, textures have to be 2^N in size. Square or not square, Eg Just any combination of the 2^N numbers. The GLSceneEditor has an Info button, that shows the maximumvalues of the texture size. Textures bigger than the screen may not work on standard graphic cards.
GLScene allows texture maps of odd dimensions, it resizes them internally and clamps them to the limit that the OpenGL driver allows. the size of the texture has no influence on the texture coordinates, the texture is seen as 1.0 x 1.0 square in OpenGL.

jpeg textures have to be 'activated' :
USES ......,JPEG; // include the jpeg library

procedure tform1.Formcreate(sender:tobject);
var jpg:TJPEGImage;
begin
 jpg:=TJPEGImage(cube1.material.texture.image); // for a texture designtime assigned to cube1
 jpg.assign(cube1.material.texture.image);
 ..
end;