Results 1 to 10 of 10

Thread: Bug in QGraphicsPixmapItem with QGLWidget

  1. #1
    Join Date
    Oct 2006
    Posts
    279
    Thanks
    6
    Thanked 40 Times in 39 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default Bug in QGraphicsPixmapItem with QGLWidget

    I've noticed that my application freezes when I add a pixmap larger than 1024x1024 to a QGraphicsView with an opengl viewport.

    Could anyone test the following example(on Windows) and see if they have the same problem:
    Qt Code:
    1. #include <QtGui>
    2. #include <QGLWidget>
    3.  
    4. int main(int argc, char* argv[])
    5. {
    6. QApplication app(argc, argv);
    7. w.setScene(new QGraphicsScene);
    8. w.setViewport(new QGLWidget);
    9. w.scene()->addPixmap(QPixmap(":/trolltech/styles/commonstyle/images/networkdrive-128.png").scaled(1025,1025));
    10. w.show();
    11. return app.exec();
    12. }
    To copy to clipboard, switch view to plain text mode 
    My specs:
    Intel P4
    WindowsXP
    Qt 4.4.3 open source
    ATI Radeon X1650
    Video driver: ati2dvag.dll V. 6.14.0010.6764 (English)

    EDIT:
    Just tried it on an AMD Phenom with a NVIDEO GeForce 8400 and it worked. So I'd be greatful if someone could test it with an ATI card.
    Attached Files Attached Files
    Last edited by spud; 16th February 2009 at 15:26.

  2. #2
    Join Date
    Feb 2009
    Location
    Noida, India
    Posts
    517
    Thanks
    21
    Thanked 66 Times in 62 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Bug in QGraphicsPixmapItem with QGLWidget

    it works fine on my system..i used a 443 * 450 png image..so i guess problem is smwhere else

  3. #3
    Join Date
    Oct 2006
    Posts
    279
    Thanks
    6
    Thanked 40 Times in 39 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: Bug in QGraphicsPixmapItem with QGLWidget

    Thanks for taking the time!
    Just to clarify, you did scale the pixmap to 1025x1025 before adding it to the scene, right?
    Could you please tell me what video card you have, and if it is a ATI Radeon, which driver?

    I am trying to find out with which video cards this bug appears, or if there is just something wrong with my system.

  4. #4
    Join Date
    Feb 2009
    Location
    Noida, India
    Posts
    517
    Thanks
    21
    Thanked 66 Times in 62 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Bug in QGraphicsPixmapItem with QGLWidget

    yes i used ur code as it was..just changed the image..i m also using windows XP and i have an intel Q35

  5. #5
    Join Date
    Oct 2006
    Posts
    279
    Thanks
    6
    Thanked 40 Times in 39 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: Bug in QGraphicsPixmapItem with QGLWidget

    I'd be really grateful i some one would test the code with an ATI card.

  6. #6
    Join Date
    May 2008
    Location
    duesseldorf, germany
    Posts
    8
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Bug in QGraphicsPixmapItem with QGLWidget

    Check the maximum supported texture size of your GFX card / OpenGL Implementation.
    Subclass the QGLWidget and add this code where you have a valid OpenGL context (e.g. inside initializeGL() ):
    Qt Code:
    1. GLuint maxsize;
    2. glGetIntegerv( GL_MAX_TEXTURE_SIZE, &maxsize);
    To copy to clipboard, switch view to plain text mode 
    And check / output the value of maxsize after this

    I'm pretty sure you're hitting a limit of your GL Implementation there, even though I'd expect the new ATI Cards to have a limit of 8192 or more ...

    Also double check your OpenGL (correct dll used ?), or maybe try another driver version - had many problems with corrupted/buggy implementations with ATI, that's one reason why I'm using NVidia...

    hope this helps,
    regards,
    Bjoern

  7. #7
    Join Date
    Aug 2008
    Posts
    60
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: Bug in QGraphicsPixmapItem with QGLWidget

    hi spud,
    i tested code with linux and ati card with 2025x2025 image, it works file.

    i have one question here, if we comment the w.setViewport(new QGLWidget)line; then also this example works fine, so what is the use of QGLWidget here ?

    thank you

  8. #8
    Join Date
    May 2008
    Location
    duesseldorf, germany
    Posts
    8
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Bug in QGraphicsPixmapItem with QGLWidget

    Quote Originally Posted by h123 View Post
    what is the use of QGLWidget here ?
    With an OpenGL based widget you have graphics hardware accelerated rendering, w/o its using a system dependent engine, which lacks performance in some cases.
    In this small example you could end up with anything with no problems at all, I'd bet

    Did you run the example with the
    Qt Code:
    1. w.setViewport(new QGLWidget)
    To copy to clipboard, switch view to plain text mode 
    in place ?
    And please post your driver version and hardware used, as this may help finding a working driver (afaik ATI is using the same codebase on Linux and Windows, as NVidia does)

    run glxinfo and find lines OpenGL version string and OpenGL renderer string for this.

  9. #9
    Join Date
    Oct 2006
    Posts
    279
    Thanks
    6
    Thanked 40 Times in 39 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: Bug in QGraphicsPixmapItem with QGLWidget

    Thanks to both of you!
    I can't check the texture size limit until I get home from work, but I have manipulated 2048x2048 textures on that graphic card in the past. Anyway the QOpenGLPaintEnginge checks for max texture size and scales the pixmap otherwise.
    From qt\src\opengl\qpaintengine_opengl.cpp:
    Qt Code:
    1. glGetIntegerv(GL_MAX_TEXTURE_SIZE, &max_tex_size);
    To copy to clipboard, switch view to plain text mode 
    Qt Code:
    1. const int sz = d->max_texture_size;
    2. if (pm.width() > sz || pm.height() > sz) {
    3. ...
    4. const QPixmap scaled = sub.scaled(sz, sz, Qt::KeepAspectRatio);
    To copy to clipboard, switch view to plain text mode 

    I'm suspecting it is a bug in the ATI driver. I'll see if I get around to debugging it tonight.
    If i remember correctly it was the call to glPopattrib() in
    bool QOpenGLPaintEngine::end()that freezes the application.

  10. #10
    Join Date
    Aug 2008
    Posts
    60
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: Bug in QGraphicsPixmapItem with QGLWidget

    Hi Bjoern,
    i tested code with and without w.setViewport(new QGLWidget), and it worked fine with 2025x2025.

    > run glxinfo and find lines OpenGL version string and OpenGL renderer string for this.
    server glx version string: 1.2
    client glx version string: 1.2
    OpenGL version string: 2.0.5079 WinXP Release
    glu version: 1.3

    cenos and winnt with xming.

    thank you.

Similar Threads

  1. Replies: 1
    Last Post: 21st November 2008, 07:00
  2. QFileDialog QGLWidget crashes
    By SenSej in forum Newbie
    Replies: 1
    Last Post: 17th October 2008, 17:06
  3. Replies: 4
    Last Post: 7th May 2008, 00:01
  4. QGLWidget resize problem.
    By anderl in forum Qt Programming
    Replies: 2
    Last Post: 22nd January 2008, 08:57
  5. QGLWidget on another QGLWiget
    By showhand in forum Qt Programming
    Replies: 1
    Last Post: 23rd October 2006, 09:59

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.