OpenGL Library for Delphi,
maintained by Eric Grange,
based on Mike Lischke's GLScene.

 

FAQ


This page groups the most frequently asked questions and their answers. A few things before you ask in the newsgroup:



Getting Started


Misc Issues


Platform Specific


Extra resources, modelers and editors


Getting Started


How do I install GLScene?
GLScene should be installed like a Delphi package, by opening the relevant ".dpk" file (GLScene5.dpk for Delphi5, GLScene6.dpk for Delphi6, etc.) and then clicking "Install" (check your Delphi manual for more details).

The sound-support and other optional packages install in a similar fashion, but make sure the underlying sound API/DLLs have been properly installed before attempting to install a package.

Typical problems:


Can I use GLScene in my *whatever* product ?
GLScene is currently distributed under Mozilla Public License, see http://www.mozilla.org/ for details. In short, this means it is not public domain and the agreement consists in what is stated in the MPL, that is:


Where is the Help ? Where is the tutorial ?

The help is in the "Help" subdirectory, in HTMLHelp format (check the "download" section if you are using Win95 and need HTMLHelp support). It is regularly updated, but GLScene is currently growing faster than the help file.

A beginner tutorial is included in the GLScene\help folder. alternatively you can check out the on-line tutorials
The only 'core' tutorials available are the samples/demos. Check them from first to last, read the comments in the header of their "unit1.pas", play with them, and you should get a fair understanding of GLScene.

Other sources:


Where are the components ? Some are in missing from the palette...

All 3D objects, from sphere to camera to light are edited from the TGLScene editor, double-click on a TGLScene component and a hierarchical scene editor will popup, allowing to compose most of your scenes at design-time.


Can't compile, Delphi cannot find *somefile*

Make sure you added all the GLScene source paths to your Delphi library paths (Tools / Environment Options / Library). All the source paths must be added (Source, Base, FileFormats, etc.).


I can't get started, how do I use GLScene ?

First, install the package, new components will be added to your palette.
Drop a TSceneViewer and a TGLScene on your form, then double-click the TGLScene or use the context menu (right mouse button), this will bring up the scene editor.

The very first objects you will probably want to add are a Camera, a Light and an object (f.i. a sphere).
You now have to pick the camera in the sceneviewer's Camera property, the viewer will no render from the camera point of view.
All new objects are positioned at coordinates (0, 0, 0) by default, so you need to arrange them if you want to see something, f.i. move the light by setting its position to (10, 10, 10) and the camera at (5, 0, 0) away by giving.
The camera will most likely not be pointing at the object, so either orient it with its "direction" property, or just pick your object in the camera's TargetObject.


Does GLScene support hardware acceleration ?

GLScene uses OpenGL for rendering, if you have an hardware-accelerated graphics card that supports OpenGL, hardware acceleration will be automatically used.
However, some 3D cards do not accelerate all resolution/pixel depth, and if acceleration is unavailable, OpenGL will fallback to software rendering, you may query the "Acceleration" property of a Viewer's Buffer to check if this viewer is hardware accelerated or not.

Check the "Info" form to know at design-time which OpenGL driver is used: just double-click on a TGLSceneViewer.


I need a primer/documentation on 3D math...

There are various 3D resources I found on the web :
If none of these suits you, check the sites in the "Links" section, they maintain their own list of interesting links and you may well find the hidden gem here.


CVS : Setting up access?

(adapted from a post by Robert Hayes)
Here's a quick run-down if anybody wants to use it (and they're not behind a firewall):

First go here: http://glscene.cvs.sourceforge.net/glscene/

This is the new directory structure for GLScene... broken down by Delphi version. When you download code, it will be from one of these directories (f.i. Delphi5 and Source).
I tried WinCVS but had more success with TortoiseCVS: http://www.tortoisecvs.org/

Once Tortoise is installed, pick the *highest* level directory where you want all your GLScene subfolders to go (for me for example it's Delphi/Lib), and right-click on it. Then choose the CVS checkout option. A "checkout" is when you first download all the folders and files from a directory off the server onto your local machine. Tortoise will ask you for some info and the answers are:
Protocol: Internet (Unix pserver)
Server: glscene.cvs.sourceforge.net
Repository directory: /cvsroot/glscene
User name: anonymous
Module: .

you can also simply copy this string into the CVSROOT string whose value is:

CVSROOT=:pserver:anonymous@glscene.cvs.sourceforge.net:/cvsroot/glscene

Note: When you use TortoiseCVS on GLScene for the first time it will enter the module name "GLScene" at the Module field. Replace this name with a dot "." otherwise the CVS checkout will fail because CVS can not find the GLScene module because there is no module named like that. The module name "." checks out everything in the GLScene repository including the advanced demos. If you only want to update the source you can enter "Source" as a module name and note the capital "S"

When you hit OK it will pull all the files and subfolders in the Source "module" on the server to a new folder called Source on your computer. Then you can do the same thing for any other folders you want (Delphi5, demos etc.), or use '.' to check out everything (be aware this will also include AdvDemos, which can be heavy to download).

Once you've checked out everything you want, you'll notice these folders have a green highlight to them. If you right click them again, you can now update them whenever you want. The only think left to do is change your Delphi environment options to point to the new directories :)


What can I do with a TGLDummyCube?

The DummyCube is a (usually) non-visible objects that exists in the scene hierarchy.
GLScene objects can be arranged as sub-objects of other GLScene objects and can be set to have relative position to their parent. If the parent moves, all children are moved along, this works with all GLScene objects.
A dummy cube can be used when you have no "physical" parent for objects that must be moved together, it can also come in handy when you have complex sorting or rendering needs (depth-sorting for transparency, mirrors, etc.). It can also be used to decompose rotations axis by axis (and allow "reversable" relative rotations f.i.), several of the "movements" demo use DummyCubes to that purpose.
Finally the DummyCube is also commonly used as Camera Target (with the Camera a child of its target dummy cube or vice-versa).


Incompatibility with JVCL/JvMM

The VfW.pas unit is used/referred by both GLScene and the JvMM package, to resolve the incompatibility, either add the GLScene package to the requires of JvMM, or add JvMM to the requires of GLScene. Rebuild the packages.





Misc Issues


Graphics are corrupted, crash or just won't run...
Make sure OpenGL is properly installed and that you have the latest drivers, which can typically be found at your hardware manufacturers website. The drivers auto-installed by WinXP/2k/2k3 don't support hardware acceleration by default, make sure you always update them after installing or reinstalling the OS. You can also use MESA for Software OpenGL support.


I'm getting floating point exceptions with *somefunc* ?

Delphi built-in math functions (like Trunc() or Frac) are not all compatible with a non-standard 8087 Control Word (See Set8087CW in Delphi's help - Nota: Delphi 6/7 do not have this issue, but the implementation is significantly slower).
Replacement functions are provided in the VectoryGeometry.pas unit, these functions are also faster than their VCL equivalents, so make sure you are NOT using "math", but "geometry" instead.


I can't get texture mapping to work

Texture mapping requires 2 things to work:
Texture coordinates are provided for all standard GLScene objects, but for TGLMesh, TGLFreeForm and TGLActor, they must be either provided in the 3D file or given by the programmer during the mesh compositing phase.

If the texture map is not loaded or enabled, the color of the object will not change at all. If the coordinates are not right, but the texture is loaded, the object will most likely be given a uniform color.


Textures look washed away, lost colors...

Here is a quick reminder, if not compressed:
RGB, RGBA -> 16 millions colors RGB16 -> 65536 colors RGBA16 -> 4096 colors The '16' modes use less memory but are of low quality. Texture compression must be supported by hardware. The other common limitations are:
So switch your desktop to highest color setting, and stick to RGB & RGBA if you want high-quality, to save memory, try texture compression or the 16bits mode (texture compression is almost always preferable if available).


Texturing works at design time, not at run-time

Make sure the image management class are included in the compiled executable. For instance, this will happen if you use Jpeg textures, and did not add "Jpeg" to any of your uses clause : TJpegImage is not compiled in the compiled exe.
To solve this, add "Jpeg" or any relevant unit to one of your uses clause.


My transparent *whatever* isn't always/completely transparent

Transparency requires depth-sorting (back to front) for the objects to be rendered correctly when ZBuffering is active. This can be automatically handled by GLScene to some extent with the ObjectSorting property.
See the materials/transparency for explanation and illustration.


Printing a rendered scene / bitmap

You can print a scene by rendering first to bitmap with the TGLSceneViewer.RenderToBitmap method (and specify printer dpi resolution), then draw the bitmap on the printer Canvas.
Make sure you defined the bitmap's size as well as pixel depth (f.i with "PixelFormat:=pf24Bit") before invoking RenderToBitmap, if not, drawing on the printer Canvas will fail.
See the rendering/tobitmap demo of GLScene.


How can I have a cube with N different textures ?

Several options, from fastest to simplest:


How can I have more than 8 lights ?

You can't, this is a common hardware limitation, and anyway, having more than 3-4 lights is not recommended performance-wise. Common alternatives are:


Demo GLScene\Demos\scripting\scriptbasics\ does not work correctly

You need the CVS version of DWSII for this demo to work. See section "CVS : Setting up access" in this FAQ for a quick guide on how to use CVS. To access DWS's CVS just use CVSROOT=:pserver:anonymous@dws.cvs.sourceforge.net:/cvsroot/dws


At design time I get 'has no parent window' or 'Object expected on line1' error when I select or open GLSCene Editor

This may occur on some systems when you have copied a glscene control like the TGLSceneViewer into the clipboard. To get rid of this error all you need to do is to copy a piece of code into your clipboard to make the error go away


Platform Specific


CPP Builder : how to install on BCB5 and BCB6

Following instructions assume that you have TortoiseCVS (version is 1.8.*)
1 - Create a directory named GLScene
2 - Go in this directory
3 - Right click on it, and do CVS Checkout...
4 - You must have in the windows that appear:

CVSROOT=:pserver:anonymous@glscene.cvs.sourceforge.net:/cvsroot/glscene
Module=.

5 - Click the OK button. The download will begin and you will get the complete GLScene directory
6 - Until now, you are (implicitly) on the Main (HEAD) branch. You can verify this point with a right click on any file and in the sub-menu of CVS, select "Revision Graph..."
7 - Now, we must take the GLScene_BCB6 branch. To do that, Right clich on the "Source" directory and in the sub-menu of CVS, select "Update Special...".
On the windows that appear, check "Get tag/branch/revision" and select on the list GLScene_BCB6. If this branch is not present click on the button "Update list...". Don't change the other default params. Then click OK.
8 - Repeat this operation for the directories "Demos" and "AdvDemos"
That's it. Your version of GLScene are now compatible with Delphi/BCB/Kylix Now, you can install GLScene (be sure that you have eradicate all older files)
1. Open GLSceneBCB*.bpg project group that are in BCB*
2. First install GLSceneBCB*.bpl
3. Install the others you need
If you need some *.lib, you can found them on the Library directory of BCBDemos.
For cgShader, you can find dll at :
If you need to re-create lib file, use the instruction "implib.exe *.lib *.dll", where implib.exe are in the bin directory of your BCB. Be careful that you have no different version of *.dll in your PATH constant


Kylix : will GLScene be compatible with Kylix ?

Kylix compatibility is under way, not all of GLScene's features will be available in Kylix, but one step at a time, GLScene is being "abstracted" to allow cross-platform support without messing with ifdefs everywhere - I hate ifdefs ;)


Win2K : DLL initialization Error

Upgrade your display drivers. This has been reported to solve the problem with at least nVidia GeForce MX2 chipset, Win2K itself is not the problem.
Be aware that some vendors have a tendency to lag in driver compatibility, and downloading directly from the hardware manufacturer of the chipset is often preferable.


Delphi 4 : can't compile the demos

Make sure you properly installed and compiled GLScene.
If the error shouts about a missing GLScene5 or VCL50 package, go to project/options/packages, and uncheck "use runtime packages" or translate to Delphi4 (by using GLScene5 and VCL40).
Be aware that GLScene's main development now occurs on Delphi5 and Delphi6, Delphi4 compatibility and testing comes only through user reports...


Delphi 4 : crash under Windows NT

There is a known problem with GLScene under Delphi 4 and Windows NT, DirectX exceptions get triggered from somewhere within Delphi 4 (DirectX is NOT used in GLScene), while the compiled applications work fine under NT.
There is no known solution nor service pack that seems to solve this issue. Help and suggestions welcome.


Delphi 6/7 : is there a version for Delphi 6/7?

Yes, development currently occurs on Delphi 6/7, so CVS versions are Delphi 6/7 compatible.


Delphi 8 : is there a version for Delphi 8?

No, and no support of Delphi 8 for Dot Net is planned.


Delphi 2005 : is there a version for Delphi 2005?

No official one since no one with D2005 has yet volunteered to support it. Early reports indicate that getting GLScene to work in D2005 is straightforward, but there may be design-time stability issues (how much comes from the D2005 IDE itself is still unclear).


Delphi 2006 : is there a version for Delphi 2006?

No official one since no one with D2006 has yet voluntereed to support it. Early reports indicate that getting GLScene to work in D2006 is straightforward, but there may be design-time stability issues (how much comes from the D2006 IDE itself is still unclear). More stable than Delphi 2005




Extra resources, modelers and editors:


Where do I get some free/shareware model/levelediting programs?

The following software may or may not suit your need or your style, but they should get you started:


Any GLScene based level/mesh editors?

Severale projects are more or less under way:
If you are interested in these, the simplest way is to get in touch with the authors directly or via the newsgroups.


Which 3D Mesh formats are supported?

The following formats are currently supported:
And Partial support is available for:


Where can I find bitmap fonts?

Daniel Guldkrans maintains a huge bitmap fonts archive, almost ready-to use in GLScene:

http://www.algonet.se/~guld1/freefont.htm The TGLWindowsBitmapFont component can generate a bitmap font automatically from any of the registered windows (TrueType) fonts.


3DS : Automatically loading textures

A TFreeForm or TActor can automatically setup the materials and load the textures from a 3DS files. You must first add a material library component (which will store the materials, once the 3DS is loaded), then link the FreeForm to this material library and set UseMeshMaterials to True.
After doing this, when loading the 3DS mesh, the importer will add new materials to the material library (using the names defined in the 3DS file), which you can later alter if you so wish.

Be aware that the image formats must be supported, for instance if your textures are JPeg files, you must add 'JPeg' to your uses.


3DS : From 3DSMax & Character Studio to GLScene

(by Renaud Ghia, adapted from french version)
This entry explains how to use 3DSMax/Character Studio models into GLScene (with skeletal animation).

As GLScene supports the SMD format (Half-Life), you only need to export your scene and characters from 3DSMax to SMD via the Valve plugin, which can be found at the following urls:

Once downloaded and unzipped, copy the files to the "plugins" directory of 3DSMAX.
An HalfLife character is made of multiple files, the first, or "reference", stores the description, geometry and skeleton of a character, while the others are used for animations of this character
After creating and animating your character in 3DSMax and the Character Studio plugin/expansion, go to FILE->EXPORT, select the "smd" format and check "reference" for the first export.
Repeat the procedure and check "skeletal animation" for each of the animations of your character (if you change your character, you'll have to export everything again, if you only change an animation, you may just re-export that single animation).
That's all, you've now exported your 3DSMax characters to SMD.

Notes and comments:

The TActor object is uses for SMDs in GLScene, the reference file must be loaded first:
TActor.LoadFromFile("Reference.smd");
TActor.AddFromFile("Anim1.smd");
TActor.AddFromFile("Anim2.smd); ...

Also suggested by Thomas Mager is the "modeling" document part of the HalfLife SDK, available here, which introduces modeling actors in SMD format and many related dos/donts.


3DS : Incomplete objects, wrong/lost alignments

The 3DS importer currently does not properly support clones and duplicates defined in 3DSMax or previous versions. "Pivot" points are reportedly not taken into account either.
Since I don't own 3DSMax, any contribution on this subject from someone with good knowledge of 3DSMax & Delphi would be welcome.
Valid XHTML 1.0 Transitional :: Valid CSS :: Powered by Wikka Wakka Wiki 1.1.6.2
Page was generated in 0.2501 seconds