[Qt-interest] QGLWidget
Fabien Brachere
fabien at brachere.net
Wed May 27 08:01:37 CEST 2009
Le mardi 26 mai 2009 à 16:46 -0400, Nathan Carter a écrit :
> I have an application I've written and am compiling in Qt 4.5. It
> uses a QGLWidget subclass I've written. I create one instance of the
> subclass and keep it offscreen, so that when previews of things need
> to be generated, that object can be configured/populated with the
> stuff to render, and then I call QGLWidget::renderPixmap() on it,
> returning a pixmap.
>
> The problem is that on Mac and Windows this works great, but on Linux
> the pixmaps returned are full of garbage data. This is not a memory
> issue (i.e., accessing freed memory) as far as I know, because my code
> looks like this:
>
> // quickviewer is the instance
> quickviewer->resize( w, h ); // desired width and height
> QPixmap p = quickviewer->renderPixmap();
> p.save( "test.png", "PNG" );
> // inspect that file and it contains garbage;
> // use p in the application and it shows up as garbage
>
> You see, no moment when any deallocation occurs, as far as I can
> tell. And yet, when I say "garbage" I mean streaks of random colors
> and little bits of other images in memory, indicating I'm accessing
> memory I shouldn't be accessing. Thus, my confusion.
>
> Anyone else run across this same Linux-specific problem? Did I do
> something wrong?
>
I had the same problem with my Linux box and not Windows. It was a
problem with the graphic's card driver (proprietary ATI driver). I
updated my distribution to Mandriva 2009.1 and it was solved.
I noticed that the problem doesn't occur with Qt 4.4.
Fabien
More information about the Qt-interest-old
mailing list