Results 1 to 6 of 6

Thread: Paint with OpenGL

  1. #1
    Join Date
    Jan 2007
    Posts
    177
    Thanks
    8
    Thanked 10 Times in 9 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Paint with OpenGL

    Hello!
    Im doing some wasting paintings in my app so the computer and the app are getting very slow with the standard Qt PaintEngine. Now I wanted to know from you geeks, if and how its possible to use OpenGL instead of Qt Engine.
    I know, its possible with QGraphicsView. I know, sth like that will come with Qt 4.5. But i cant wait for the release.
    So can OpenGL be attached to a normal QWidget? Have i to use QGLWidget or is it only possible if i redirect all drawings to a QGraphicsView?
    Cheers!

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: Paint with OpenGL

    You can use QGraphicsProxyWidget with graphics view, but the first question you should ask yourself is "why is my application so slow?". A widget composed from other widgets shouldn't be slow. And a custom widget can probably be implemented using QGLWidget.

  3. #3
    Join Date
    Jan 2007
    Posts
    177
    Thanks
    8
    Thanked 10 Times in 9 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Paint with OpenGL

    The application IS slow because i paint more than 1000 objects...
    For the Pimp My Widget Contest im writing an effects library. These effects can be attached to all kind of widgets. For some effects i cut the widgets into particles. The particles can reach a huge amount which rendering isnt realisable with the Qt paint engine.
    Here a pic of the effects i yet have. with big particle size. which doenst really look pretty.

  4. #4
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: Paint with OpenGL

    I wouldn't expect miracles then. What you can do is to set the DontShowOnScreen attribute on all widgets and call QWidget::render() on them to render them to an OpenGL buffer which you can then modify as you want and/or show on a QGLWidget. The downside is that you'll have to forward all the events to appropriate widgets.

  5. #5
    Join Date
    Jun 2008
    Posts
    14
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Paint with OpenGL

    I need to do a similar thing ..
    but I dont find this attribute.,, DontShowOnScreen..in Qt documentation..

  6. #6
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: Paint with OpenGL

    Because it's not documented.
    Qt Code:
    1. WA_DontShowOnScreen = 103
    To copy to clipboard, switch view to plain text mode 
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


Similar Threads

  1. OpenGL and Qt Question
    By ToddAtWSU in forum Qt Programming
    Replies: 2
    Last Post: 18th April 2009, 18:04
  2. QT + OpenGL + Thread => aaaahhhhh !
    By anthibug in forum Qt Programming
    Replies: 7
    Last Post: 26th July 2008, 13:36
  3. how to paint 3d graphic(like pie without OPenGL module)
    By catherine_98 in forum Qt Programming
    Replies: 1
    Last Post: 28th June 2007, 19:42
  4. Qtopia Core & OpenGL ES?
    By zelko in forum Qt for Embedded and Mobile
    Replies: 0
    Last Post: 28th May 2007, 07:21
  5. Using QGLWidget paint engine to draw regular widgtes?
    By high_flyer in forum Qt Programming
    Replies: 11
    Last Post: 9th October 2006, 12:06

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.