views:

159

answers:

1

I have a native Delphi TFrame that emulates Roy Tanck's Cumulus Tag Cloud viewer, a WordPress Flash plug-in. What that plug-in does is create a 3D sphere of words that spin around on the surface of a "virtual" sphere. You can see it in action here:

http://www.roytanck.com/2008/03/06/wordpress-plugin-wp-cumulus-flash-based-tag-cloud/

In my application structure each word has its own TBitmap and to render the sphere I print all the word's bitmaps to a temporary TBitmap and then BitBlt() that temporary TBitmap on to the Canvas of a visible TPaintBox. The render operation occurs on a TTimer timer event that happens every 50 milliseconds.

However, no matter how hard I try there is a noticeable "jitter" to the movement of the words, especially in comparison to the silky smooth movement of the Flash player. I thought increasing the frame rate might help and I even tried using a Multimedia timer that updated every 10 milliseconds with proper locking and unlocking of all the Canvases due to the multithreaded nature of the MM timer. Still jittery. The only thing I can figure is that the calculations I do result in discrete pixel locations for each word to render at and that causes jitter. In contrast, and this is supposition, perhaps Flash potentially does dithering to facilitate "between pixel" rendering or maybe does anti-aliasing in real-time and that's why it doesn't jitter?

In any case, is it possible to get the silky smooth motion I am looking for using native Delphi code? Or is the only way to do it is to go all the way to something like a Direct3D or OpenGL solution? I don't want to waste time tweaking this thing to death if it's a losing battle. On the other hand, if you have any tips I'd love to hear them. My guess is that if I do have to go the Direct3D/OpenGL route it's a big job and learning curve so if I could find a way to get this done in native Delphi code I'd love that.

FOLLOW-UP EDIT: Would printing to a much larger "virtual" bitmap and then using a resampling method like that given here help to print "down" to the actual visible Canvas?:

http://stackoverflow.com/questions/1976116/scale-an-image-nicely-in-delphi

+1  A: 

IMHO the right way to go is Direct3D (or OpenGL, but given Delphi is Windows only maybe Direct3D is better). It was introduced exactly because the GDI is not good at such tasks. Flash supports both vector and raster graphic, and thereby can handle such kind of applicaitons better than old plain GDI.

ldsandon
Writing an OpenGL Delphi application is very easy, because there is a OpenGL.pas unit. Writing a DirectX Delphi application is not that easy.
Andreas Rejbrand
My experience with Direct3D is that when it works it's great but when you have a problem, especially due to a codec issue somewhere in the filter chain, life can get very painful very quickly. That's why I'm working so hard to avoid it. I haven't tired OpenGL yet and definitely want to.
Robert Oschler
I just meant that being DirectX the native advanced graphic platform of Windows it has better support. MS showed they "don't like" OpenGL that much
ldsandon
@Robert: Direct3D doesn't do filter chains, nor does it have codecs. Don't confuse it with DirectShow, completely different beast alltogether.
Paul-Jan
Good point Paul-Jan. I did mix those two together and they're not the same thing as you pointed out.
Robert Oschler