[vtkusers] Re: glDrawPixels is really slow on windows...

Clinton Stimpson clinton at elemtech.com
Mon Jun 4 12:12:13 EDT 2007


Hi Steve,

I don't see a response from Anja yet, so I'll respond since I  
provided the Qt/VTK image combining code you're asking about.

This approach was doing the Qt drawing offscreen, then taking that  
image and giving it to VTK just before the swap buffers.  It avoids  
flickering, and is similar in concept to your second approach.

Qt allows implementing different painting engines to draw to  
different types of targets.  The targets could be normal windows,  
OpenGL drawables, offscreen image, PDF file, etc...

To solve the slowness problem with combining images, I gave him a  
rudimentary implementation of a Qt paint engine which renders  
directly into the VTK window after the scene is drawn, but before the  
buffers are swapped.  So this reduces or eliminates the need to do  
image composition.

Clint


>
>> I moved my application from Linux to windows. It uses VTK and the Qt
>> libraries. I had a base VTK window and was using Qt drawing  
>> routines to draw
>> things on top of the VTK window.
>>
>> I was using the vtkRenderWindow SetRGBACharPixelData method to  
>> blend the QT
>> and vtk image data and than display it on the screen. This worked  
>> great
>> under Linux.
>
> I'd like to understand what you did, because I did some experimenting
> a year ago with combining VTK rendering with Java/Swing-based drawing
> and the results were not great.
>
> My first approach was to use VTK to draw an image in the window, and
> then use Swing to write text (e.g. patient demographics) overtop.  The
> trouble is that VTK/OpenGL renders the image to the window, then
> triggers a Swing "repaint", which will put the text over the window
> contents.  There's a brief instant between the VTK render and the
> Swing render where there is an image without text, so you see a very
> pronounced flicker.
>
> My second approach -- which works fine -- is to have VTK render into
> an offscreen buffer that is passed along to Swing for painting on the
> screen.  In this case Swing takes the image, puts text overtop and
> paints onto the screen in one go so there is no flicker.
>
> Are you doing something like the first case or the second?  If the
> first case, how do you manage to avoid a flicker?




More information about the vtkusers mailing list