[Lazarus] Fast drawing to canvas

Lukasz Sokol el.es.cr at gmail.com
Mon Feb 13 12:49:10 CET 2012

On 13/02/2012 10:16, Michael Schnell wrote:
> On 02/13/2012 10:13 AM, Lukasz Sokol wrote:
>> Would it not be a Better Idea (IMHO) to have the frame ready in
>> time for display and have the rest of the CPU time available for
>> something else ?
> Yep. Burt you would need to take advantage of the screen refresh
> interrupt to know the time you can start to get the next frame
> ready.
> -Michael

OpenGL provides that, where the appropriate extension is available, and e.g. GLScene can use it.
And as to /when/ to prepare next frame - well as soon as the previous
has displayed (within what handles the vert-refresh interrupt)
So, invoke your rendering engine from there, and tell it that the display step is 1/f, so it
can prepare next frame appropriate to media timing. 

Alternatively you can run a timer every 1/f ms with the screen refresh
procedure (some way of automation to read screen refresh rate from wherever it can be read, 
would come handy) and it will at some point sync with screen refresh but you
won't even know that :)


More information about the Lazarus mailing list