Delphi XE2 VCL Styles and 3D
…or when the old/new VCL mule shows it can still kick!
GLFlow : VCL + OpenGL
The new Delphi XE2 Styles allow to get a nice looking UI, allowing to mix 3D graphics more smoothly without grayish controls getting in the way:
Note that in the video below, image load times have not been edited away: it’s actually near instantaneous (unsurprisingly so, the FireFlow sample pics are small ones)
The pictures above are those from FireMonkey’s “FireFlow”‘ sample, which you’ll already have if you have Delphi XE2 and have updated your samples directory.
You can select any folder with JPG pictures (and compare vs FireFlow), for instance on pictures from a digital camera (like these).
Now for some highlights:
- High frame-rate
- even if you shake the slider or click on pictures to the far right/left
- no need for a gaming 3D card, even Netbook GPUs are enough
- Fast loading of images in a background thread
- almost instantaneous for the FireFlow samples
- you can still interact while the loading takes place
- works around the old TJPEGImage locking bug (QC43018, QC55871…)
- Can handle large JPEG images
- takes advantage of built-in TJPEGImage facilities for quicker loading & downsizing.
- Can animate with dozens of pictures without slowdown
- benefits from built-in frustum culling (doesn’t draw what isn’t visible)
- No pixel shimmering thanks to anisotropic filtering
- GPU-accelerated mipmap generation
The amount of code used in GLFlow is actually lower than in the FireFlow sample, despite the extra features. Beyond the loading phase, everything is handled by the GPU, and this performs well even on low-end integrated 3D chipsets (gaming hardware not required, even mere Atom Netbooks can handle it just fine). FireFlow on the other hand seems to require a fast GPU and a fast CPU (it can maximizes one core when animating, maybe an issue in the animation classes?).
Interestingly enough, apart from VCL styles, there is nothing truly “new”: it could have been done almost the same back in Y2K with GLScene and Delphi 5 (if less pretty).
For the cross-platform fans, compiling it for the Mac (with LCL instead of VCL) is left as an exercise
I’ve placed the source on google code, as CoverFlow is well, trendy and pretty, and can come in handy. There are also quite a few low-hanging improvements I may improve upon later on (having multiple background loaders, further texture optimizations, cross-platform through LCL, adding text below the pics, etc.).