Results 1 to 2 of 2

Thread: OpenGL functions in QGraphicsItem::paint

  1. #1
    Join Date
    May 2009
    Posts
    16
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default OpenGL functions in QGraphicsItem::paint

    Greets!

    I read recently that it's possible to use OpenGL functions inside a QGraphicsItem's paint function, provided that you're working with an opengl surface. Is this something that's actually supported and will continue to work?

  2. #2
    Join Date
    Feb 2007
    Location
    Karlsruhe, Germany
    Posts
    469
    Thanks
    17
    Thanked 90 Times in 88 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: OpenGL functions in QGraphicsItem::paint

    Hi!

    Qt Code:
    1. void CGL3dProjectedItem::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget)
    2. {
    3. painter->beginNativePainting();
    4. ... do your native gl... stuff
    5.  
    6. painter->endNativePainting();
    7. }
    To copy to clipboard, switch view to plain text mode 

    These two functions begin/endNativePainting() were introduced recently in 4.6 just for the purpose of making intermixing safer.



    http://labs.trolltech.com/blogs/2010...rmance-opengl/ see section mixing..

    The QtOpenGL bindings are just a convenience-wrapper. For more advanced stuff it is expected to use opengl directly.

    Joh

Similar Threads

  1. aux functions not working on opengl
    By john_god in forum Qt Programming
    Replies: 7
    Last Post: 11th April 2009, 12:23
  2. Paint with OpenGL
    By kernel_panic in forum Qt Programming
    Replies: 5
    Last Post: 7th April 2009, 08:54
  3. Cylinder draw using QT opengl functions
    By YuriyRusinov in forum Qt Programming
    Replies: 1
    Last Post: 25th June 2008, 23:58
  4. Paint QGraphicsItem problem
    By dreamer in forum Qt Programming
    Replies: 3
    Last Post: 23rd June 2008, 18:18
  5. 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

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.