|
|
1. Site news03 mar 2001:
- Changed the lights in GoldenGlobe. And I tripled poly count! (that means the
quality is better, too)
06 feb 2001:
- I was playing with my old Terrain
program and I had this ideea: what gives if I heightmap a sphere? Here it is: Planets.
04 jan 2001:
- Bug fixes in GoldenGlobe: Z fighting occured on the globe on some cards. And
now you can switch to fullscreen and back.
03 jan 2001:
- Happy New Year, everybody! I have
a new Delphi demo for you.. Check this out! GoldenGlobe
22 dec 2000:
-New demo with free source: GL Rain
03 nov 2000:
-New program with sources: ReVersus , a Reversi (Othello) game.
15 aug 2000:
-New program with Delphi source: Wave Sim.
24 may 2000:
-Now you can click&drag to
rotate the scene in the Solar example.
01 apr 2000:
The first version of
this site is (almost) finished. Not really much stuff for now, but hopefully there will be
more in the future... All I need is time to finish some more of my projects.
All the programs on this site are written using Borland Delphi, that means object
Pascal. For the C++ programmers there are lots of OpenGL sites, for Delphi fans
OpenGL resources are scarce. For those who might say that C++ code is faster, hmm, it may
be true, but this site proves that 3D programming in Delphi is possible! :-)
2. Utilities
Here are
some things that will make your task easier:
- The OpenGL.pas unit
Of course you can use the Gl.pas and Glu.pas units that come with Delphi,
but there's better: Mike Lischke (check
his web site) wrote an extended translation of the OpenGL header files (version 1.2.2,
january 2001) for Delphi. This unit contains lots of improvements, bugfixes and support
for extensions and some very useful support routines for rendering context initialization.
Check the sample code for use.
Download the OpenGL.pas unit here.
- The OpenGL 1.2.1 manual
Full specification, (c) 1992-1998 Silicon Graphics, Inc.
1.4
Mb Adobe PDF format. (if it doesn't work and you're using
DownloadAccelerator, try Regular Download)
3. Terrain
rendering
This is a project I started some time ago,
when I have found a terrain program written in C by Nicholas Anderson (visit his site). I
translated his random fractal terrain & map generation routine into Pascal, and
started writing my own landscape rendering program in Delphi. The interesting thing about
it is the way it blends the different land textures, using 'alpha maps'.

In the left image I highlighted in red the quads
between two different land textures, quads that are textured using alpha maps (like the
one on the right) to create a new texture. When the program starts, the heightfield data
is analysed and all these small 'transition' textures are created and stored. Observe that
only the central part of a transition texture is used - that is to avoid the edge of the
texture to become visible because of the bilinear filtering.
The heightfields used are generated with the
excellent 'Wilbur'
editor written by J.R. Slayton, or real scanned DEMs available on the Web edited with the
same program, or generated with Nicholas
Anderson's built-in random fractal terrain generation algorithm.
Here are some screen captures. Click on images for a larger view.

|

|
66 fps on my TNT2 &
Celeron 464 MHz |
A volcano (Wilbur edited) |

|

|
A Wilbur generated ridged
multifractal |
The real Colorado Canyon! |
The heightfields used are 256x256 matrices of small integers (-32758..32767), yet
the heights should be scaled between -100..100 or so. (Could have used shortints).
Here is the procedure to create a terrain with Wilbur:
1. Create a new terrain, 256x256.
2. Then go to Surface -> Calculate height field, play with the
parameters until you like what you see;
3. Edit the terrain with Wilbur's tools to create interesting shapes; Don't forget
to press 'Relight'.
4. Go to Surface -> Point process -> Scale, Scale type= To range, and scale
your terrain to Highest=80 and Lowest=-30 or according to your terrain. Note that 0 is the
sea level.
5. File -> Save as.., save as 'Lon/Lat text mesh', Output bounds - set to pixel,
an 0 (zero) decimal places.
6. Start 'Terrain_Del' and press F4, and load the previously saved .txt height
data. You can save the terrain as binary by pressing F2.
This program is not optimized
for speed. Yet the 65 frames per second on my TNT2 & Celeron 464 is not bad.
This program ocassionally crashes on Intel i740 cards with 'Division by zero'.
Don't know why. On ATI rage PRO's it's slow and the fog doesn't work. Doesn't work
right on S3 Savage.
Please tell me if it works on other cards.
Download
the executable and a few maps here.
The Delphi source code is here.
4. Sample Code
- ReVersus

|
OpenGL used for 2D rendering.. No need for
DirectDraw to do it :) |
The classic Reversi (or Othello) game with a new face... Or how to use a
3D graphics API in a 2D game.
Version 1.0 , nov. 3, 2000, freeware with Delphi source.
Features:
- Dynamic lightmaps & reflections
- Emboss Bump Mapped game board
- Animations
- Fully resizable window
- Nice textures :)
The Othello AI original written by Roman Podobedov (romka@ut.ee) in C, Delphi translation by me.
The 2D textured font code & bitmap thanks to Jeff Molofee aka NeHe.
Download the game and the source code.
(~380 Kb)
- GL Rain
This demo simulates rain drops on a water surface.
Note that only texture coordinates are perturbed, not the vertices. (so, this is a 2D demo
:)
Uses ARB_multitexture to display the background texture.
Controls:
- SPACE stops/starts the rain, click mouse for extra drops.
Download the executable and the source. (256 Kb zip)
- GoldenGlobe

|
Try it with the shadow & the gloss map turned off
to see the difference! |
Gloss Mapping is an improved
Environment Mapping technique which adds realism to reflective objects by introducing
varying levels of reflectivity on the object. The alpha channel of the base texture
contains a gloss map which attenuates the environment map in the object's local texture
coordinate space.
The shadow technique I use gives a very realistic effect, but works only with spheres.
Requires a Riva TNT, ATI 128 class or better OpenGL card. (supporting spherical
mapping)
Controls:
- S turns on/off the shadows
- R turns on/off the gloss mapping
- ENTER toggles rotations
- SPACE toggles fullscreen mode
- ESC to quit
Download the executable and the source. (339 Kb zip)
- Planets

|
An Alien planet :) |
This program simulates a planet landscape using a variable-radius sphere generated from
a parametric equation, the radius is modified using a heightmap loaded from a grayscale
bitmap. Of course, you can try it with your own bitmaps. Just make sure the heightmaps are
8-bit grayscale bitmaps. A tip: use 'Wilbur' to create heightmaps & textures (see the
Terrain prog on this page). Warning: keep them heightmaps quite small (128x64 is fine),
unless you have a really fast card... :)
The program uses (compiled) vertex arrays and draws only the hemisphere facing the
viewer (in a desperate try to speed things up).
Controls:
- Left Mouse or Space: change camera position (cool 'landing' effect)
- Right Mouse or Enter: change planet (there are 3 of them, two 'alien' and our beloved
Earth)
- C: toggle use of Compiled Vertex Arrays
- R: toggle rotation
- F: toggle fullscreen
Download the
executable and the source (415 Kb zip)
|