Results 1 to 2 of 2

Thread: QGraphicsOpacityEffect horrible slow, how to make the same effect faster?

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Dec 2009
    Posts
    6
    Thanks
    1
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default QGraphicsOpacityEffect horrible slow, how to make the same effect faster?

    Hi,

    I use this effect together with QLinearGradient to create a alphaGradient mask, however this is extremely slow even with hardware acceleration turned on. When you search for it http://labs.trolltech.com/blogs/2009...e-an-overview/ it turns out to be a known issue:
    There is also the QGraphicsOpacityEffect which allows you to set a mask widgets and graphics items, but as of today, it is not as fast as we would like it to be.
    and this is roughly how i use it:
    Qt Code:
    1. QLinearGradient alphaGradient(cust->rect().topLeft(), cust->rect().bottomLeft());
    2. alphaGradient.setColorAt(0.12, Qt::transparent);
    3. alphaGradient.setColorAt(0.20, Qt::black);
    4. alphaGradient.setColorAt(0.8, Qt::black);
    5. alphaGradient.setColorAt(0.9, Qt::transparent);
    6.  
    7. QGraphicsOpacityEffect *effect = new QGraphicsOpacityEffect;
    8. effect->setOpacityMask(alphaGradient);
    9. effect->setOpacity(1.0);
    To copy to clipboard, switch view to plain text mode 

    So anyway, is there a way to make this extremely fast (with hardware acceleration turned on)? If so, how?

    All is has to do is set the alpha channel of an widget (QGraphicsWidget in this case)

    The one hardware accelerated way i know but can't do (don't have the knowledge to do it) is by making a shader for it.

    Mark.

  2. #2
    Join Date
    Dec 2009
    Posts
    6
    Thanks
    1
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: QGraphicsOpacityEffect horrible slow, how to make the same effect faster?

    this is gonna be odd.. answering myself :P

    Oke, to speed it up a LOT i found that appending this to the starting command line of the application to be way faster then native X11 : -graphicssystem raster
    On linux by default it uses X11 as the graphicssystem. I also found that (somethimes) setting the OpenGL graphicssystem (-graphicssystem opengl) is sometimes working! In my case it works but doesn't make the effect faster then the raster graphicssystem which makes me think (again) that the QGraphicsOpacityEffect has no (or nearly no) hardware acceleration support.

Similar Threads

  1. FAster approach for Completetion
    By codeman in forum Qt Programming
    Replies: 8
    Last Post: 22nd July 2010, 18:49
  2. How to make the "Reflection" effect by QML?
    By charlse in forum Qt Programming
    Replies: 0
    Last Post: 7th April 2010, 13:04
  3. Faster paintEvent
    By SailinShoes in forum Qt Programming
    Replies: 1
    Last Post: 1st October 2008, 15:25
  4. Faster code possible?
    By ShaChris23 in forum General Programming
    Replies: 1
    Last Post: 28th May 2008, 07:35
  5. faster QScrollView
    By firas in forum Qt Programming
    Replies: 2
    Last Post: 29th April 2006, 18:49

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
  •  
Qt is a trademark of The Qt Company.