[Lazarus] Fast drawing to canvas

Sven Barth pascaldragon at googlemail.com
Fri Feb 10 20:53:09 CET 2012


On 10.02.2012 19:21, Reimar Grabowski wrote:
> On Fri, 10 Feb 2012 17:11:21 +0100 (CET)
> dhkblaszyk at zeelandnet.nl wrote:
>
>> I was talking about glDrawPixels (CPU) and glBindTexture (GPU). The latter
>> being much faster of course.
> glDrawPixels should be avoided as much as possible.

Good to know...

>> I have implemented my own "simple" raw image codec
>> (filecache.pas) that reads pixels from disk. My problems lie with the
>> playback of video. It has proven to be very difficult to playback video
>> (on Mac) with an acceptable speed. Full HD images are played back @ 11fps
>> wich is just too slow.
> The fastest way should be using OpenGL. But not some naive implementation like it seems to be the case with the OpenGL tests performed by followers of this thread.

Well, I admit that I'm not a OpenGL pro. I "just" reused some code which 
was taught us at university and worked "fine" so far for the use case we 
had (render the image of a web camera to a OpenGL context for some 
augmented reality stuff). Also it was yesterday night after 10 o'clock 
when I implemented that, so I didn't bother to read whether there is 
anything faster or whether glDrawPixels is a bad idea <TM>.

> The magic words are PBO and texture streaming. This approach reads the data directly into a buffer on the graphics card which you use as texture to display your images. You can even read the data in an other thread than the OpenGL one. Only the reading of the data is performed on the CPU and the data will go from disk straight to VRAM.

I definitely need to find the time somewhen to learn OpenGL better than 
just simple drawing of polygons (*cough* using glBegin and glEnd *cough*)...

Regards,
Sven




More information about the Lazarus mailing list