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:
Samples run ok, but compile/design does not: recompile the dpk and make sure you do not have multiple version of the files
Samples don't run, compile/design does: make sure an up-to-date bpl is accessible to the exe (like in the Delphi\Bin directory)
Errors with ODE, check the DLL you're using is the good one (just copy it from the Physics directory)
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:
can use freely, in free or commercial software, can redistribute freely the packages (source, exe, bpl etc.)
remains copyrighted software, you must place/leave a notice whenever you use/distribute it, with proper credit/link to author/site
any alterations/modifications to the code must be made public (to owner and users)
additions, libraries or code that just uses GLScene do not fall under MPL, and can be private/commercial
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.
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:
Johan Rabie is maintaining the GLScene Documentation project at http://CapeRaven.co.za, the site also includes tutorials, demos and links sections.
Rene Tschaggelar has written a QuickStart guide here
Charlie Calvert has a "first tutorial" for GLScene in his OpenGL Notes
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.
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.).
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 positionned 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.
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.
There are various 3D resources I found on the web :
FlipCode has a nice series of article introducing 3D math, and other categories that deal with more complex aspects. Quite a complete site.
Wolfram Research stores a fair set of material, but be warned this is mathematical stuff, not code. If it's math related, you'll find it here.
Gamasutra's Features contains a series of articles (with C code most of the time) on various game programming issues, including 3D math. Do not expect primers here though, but rather "advanced" documentation.
GameDev Developer resources similar to Gamasutra, but seems less thorough and definetely less structured. Worth a look.
Delphi 3D, not exactly primers, but Tom Nuydens maintains a collection of articles on 3D rendering techniques that may help you understand how things work.
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.
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:
Please note the capital S for 'Source', files and paths are case sensitive.
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).
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.
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.
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.
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.
The '16' modes use less memory but are of low quality. Texture compression must be supported by hardware. The other common limitations are:
3Dfx Voodoo3 boards are limited to RGB16 and RGBA16 (even if you
require RGB or RGBA)
some ATI drivers limit textures to
RGB16 (you have to uncheck something somewhere in the
display properties, this is a trick to get more FPS commonly found in "branded" systems)
texture resolution is also usually limited by desktop
resolution
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).
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.
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.
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.
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...
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.
Click the OK button. The download will begin and you will get the complete GLScene directory
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..."
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.
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)
Open GLSceneBCB*.bpg project group that are in BCB*
First install GLSceneBCB*.bpl
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 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 ;)
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.
No official one since no one with D2005 has yet voluntereed 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).
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.
(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:
Some Character Studio meshes/skeleton have a particular structure, and may not get exported well
All texture maps must be made available to GLScene, by plaing them in the same folder as the SMD, or by specifying the path in the MaterialLibrary (make sure all images formats can be read by Delphi)
The TActor object is uses for SMDs in GLScene, the reference file must be loaded first:
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.
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.