Results 1 to 3 of 3

Thread: Redrawing QGLWidget with 3D+2D graphics

  1. #1
    Join Date
    Jul 2010
    Posts
    7
    Thanks
    2
    Qt products
    Qt4 Qt/Embedded
    Platforms
    MacOS X Windows Symbian S60

    Default Redrawing QGLWidget with 3D+2D graphics

    Hi,

    I have a QGLWidget which draws both 3D and 2D graphics (just like in Qt's example 'overpainting').
    The thing is after I started drawing 2D graphics (moved code from paintGL() to paintEvent(), etc.), the widget stopped redrawing most of the times. It didn't redraw after resiging, after loading, and so on. I put repaint() calls, it helps in some cases, but doesn't help in e.g. resizing.
    So which function should I use to refresh the widget? update() or updateGL() or repaint()? Or maybe there is a way to set some mode to enable automatic redrawing after resizing/load/...?

    Thanks.

  2. #2
    Join Date
    Oct 2012
    Posts
    1
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Redrawing QGLWidget with 3D+2D graphics

    Hello, i'm facing the same problem and i have tried to fix it for several hours. Were you able to fix it?
    Thanks

  3. #3
    Join Date
    Jan 2008
    Location
    Alameda, CA, USA
    Posts
    5,230
    Thanks
    302
    Thanked 864 Times in 851 Posts
    Qt products
    Qt5
    Platforms
    Windows

    Default Re: Redrawing QGLWidget with 3D+2D graphics

    Did you read the documentation for QGLWidget::paintEvent()? Did you look at the Overpainting example? Are you calling QGLWidget:aintGL() first from within your own code, and then issuing your QPainter calls? Or if your OpenGL calls are in the paintEvent itself, are you calling the OpenGL methods first before doing the overpainting? Do you call makeCurrent()? initializeGL()?

Similar Threads

  1. Error while redrawing using QPainter Class
    By sosanjay in forum Qt Programming
    Replies: 5
    Last Post: 28th December 2009, 12:48
  2. Replies: 9
    Last Post: 3rd December 2009, 19:19
  3. QGLWidget window redrawing contents when losing focus
    By Barry79 in forum Qt Programming
    Replies: 1
    Last Post: 3rd April 2009, 14:37
  4. Optimizing redrawing in the scene
    By maverick_pol in forum Qt Programming
    Replies: 4
    Last Post: 28th November 2007, 18:00
  5. subclassing or redrawing a lineEdit
    By jayw710 in forum Qt Programming
    Replies: 2
    Last Post: 7th February 2006, 19:26

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.