On 12 September 2011 23:53, Rémy Sanchez <email@example.com>
On top of my screen, there is something quite like a HTML <marquee>, so my
main concern is to get my text translating ultra-smoothly. And as you know,
translation is very difficult to get smooth...
It shouldn't be that difficult really if you only move by a small amount (eg. 1 pixel each frame) at a high enough frame rate, the motion should appear smooth. Though if that doesn't appear to move smoothly, you can try to add a kind of motion blur effect to your text. Instead of using glClear to wipe the screen after each frame, just draw a mostly-transparent quad (I'd try for about an alpha of 0.85 first) over the whole screen. If performance is a problem, then you can just draw it over where the text was on the previous frame. This may seem counter intuitive, but a bit of blur like this can make motion feel a bit smoother.
Now the question is : what is the most performant way to render this text ? I
guess it'll be either a texture, either a polygon, but I'm not quite sure. And
does it make sense to cache anything ? If so, how to do it ?
For performance, if you're trying for a specific environment, the best way is going to be to measure it empirically. Make yourself an FPS counter and test the various methods. If you're not going to transform the text at strange angles, then you have the option of FTBitmapFont and FTPixmapFont, which should in theory be fastest, as they are the simplest methods (and the GMA 900 series has no hardware T&L). I'd try FTTextureFont next, as if you did ever need to rotate the text you have the option to, and you may find it faster or as fast as the Bitmap/Pixmap options anyway, or generally just fast enough. Vector fonts will probably be slower (but still, test them and measure it). http://ftgl.sourceforge.net/docs/html/ftgl-tutorial.html
To do a simple test, all you have to do is replace the creation line with another one.
I'll add that I don't care about anti-aliasing, because the viewer's eye is
far enough not to notice it, and I don't need no rotation nor rescale. Ah, and
I don't know if this is useful to say, but the i945 is stuck with OpenGL 1.4.
If I remember correctly, FTGL doesn't use any particularly new OpenGL features, so even going back to OpenGL 1.1, you'd probably still be fine.
Anyway, you might want to try using processing.org
(or something else equally high level) if it's just a simple text-scrolling application, and only delve deeper from there if the performance is insufficient. Human cycles are more valuable than computer cycles. :)
Hope this helps