Delphi XE2 VCL Styles and 3D

…or when the old/new VCL mule shows it can still kick!

I was asked how hard it would be to do yet-another-Cover Flow-clone with VCL+GLScene, and how that would stand vs using FireMonkey on Windows.

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:

GLFlow – Powered by Delphi XE2 & GLScene

You can get the source and a pre-compiled executable from googlecode for a more interactive experience or a peek at the source code.

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.).

8 thoughts on “Delphi XE2 VCL Styles and 3D

  1. That sounds less like “optimization” and more like “good initial design,” with a bit of “expertese due to amount of time with technology.” Embarcadero may be wise to have Eric spend some time with the FireMonkey source and help them tighten up the design. There may also be some real business reasons for the design as it stands.

  2. The main problem of GLScene on Windows is OpenGL. There are too many video card with buggy OpenGL drivers. Firemonkey use directx and it’s an advantage under Windows. Between performance and reliability, i choose reliability. But, it’s depends on needs.

  3. @Renaud
    Apple’s adoption of Intel hardware probably helped quite a bit in that regard, but the end result is that IME, on Windows business machines, OpenGL is quite trouble-free, and has been for the last 6-7 years (at least if you don’t go for edge features and the latest extensions).
    Intel’s DirectX drivers are quite hit or miss, and Direct2D support is in even worse shape to the point that you can expect Direct2D to be software-only on the vast majority of business machines out there.

  4. Very cool…

    I thought that GlScene was dead project but I was wrong… I did not follow it after all 🙂 I thought I had it in my SVN update script… That fixed now… Have to check out the project soon…

  5. I have tried both (your version and Firemonkey exemple) on a Windows XP machine, 2M RAM, Readon 9600 regular video card. Your version (VCL) is still fast for numerous large 3M images (lets say 100 or so). For the same images the Firemonkey demo is unusable (loading of images is an eternity and scrolling brings the application on a dead end).

Comments are closed.