Results 1 to 7 of 7

Thread: QGLWidget is not visible on linux and Mac OS X

  1. #1
    Join Date
    Jul 2007
    Posts
    90
    Thanks
    2
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default QGLWidget is not visible on linux and Mac OS X

    hi,
    i have created 3D pyramid by using QGLWidget and handled paintEvent() instead of paintGL() as i am adding the QGLWidget to QGraphicsScene.This code is working fine on Windows but same is not working on Linux(Fedora core 6) and Mac OS X(10.4.7 Tiger) platforms.

    In paintEvent i am doing grabFrameBuffer and drawing the image by using Qpainter.

    regards,
    ~sanjay

  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: QGLWidget is not visible on linux and Mac OS X

    Reimplement paintGL then instead of paintEvent. By the way, I would call adding a GL widget to graphics scene risky.

  3. #3
    Join Date
    Jul 2007
    Posts
    90
    Thanks
    2
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: QGLWidget is not visible on linux and Mac OS X

    many thanks,

    Basically i am using graphicsview framework which contains n no. of graphics item.This 3D pyramid is also one of the item and so i need to add it to the QgraphicsScene.This forces me to implement paintEvent().Because if i reimpleent paintGL() it is not called at all.

    And the thing is that code is working on windows.

    regards,
    ~sanjay

  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: QGLWidget is not visible on linux and Mac OS X

    Quote Originally Posted by sanjayshelke View Post
    This forces me to implement paintEvent().Because if i reimpleent paintGL() it is not called at all.
    The thing is paintGL() is called from the paintEvent after the context has been set up correctly. You must have done something wrong. Check if it works when the widget is outside QGraphicsScene.

    And the thing is that code is working on windows.
    Windows has a different architecture than other platforms.

    I still suggest you implement the pyramid without QGLWidget. It should be possible using just the pixel buffer (or something else, I'm not a GL expert).

  5. #5
    Join Date
    Jul 2007
    Posts
    90
    Thanks
    2
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: QGLWidget is not visible on linux and Mac OS X

    true sir,
    If i take QGLWidget outside the QGraphicsScene it will call paintGL().

    I need to create 3D pyramid with features such as rotate, fill faces of pyramid.
    For all that i have used openGL.I never gone through pixelbuffer before but i will go through it now, though i m not sure whethter i can create true 3D pyramid.

    Meanwhile ijust want to know is there any solution for mentioned problem of QGLWidget not visible.

    regards,
    ~sanjay

  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: QGLWidget is not visible on linux and Mac OS X

    Quote Originally Posted by sanjayshelke View Post
    I need to create 3D pyramid with features such as rotate, fill faces of pyramid.
    For all that i have used openGL.I never gone through pixelbuffer before but i will go through it now, though i m not sure whethter i can create true 3D pyramid.
    A pixel buffer is an OpenGL feature where you can create a scene without actually displaying it in a window. Thus I'm not telling you not to use OpenGL but to avoid inserting a QGLWidget into the scene. Render your scene to a pixmap and use a regular/animated pixmap item in the scene.

  7. The following user says thank you to wysota for this useful post:

    sanjayshelke (4th March 2008)

  8. #7
    Join Date
    Jul 2007
    Posts
    90
    Thanks
    2
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: QGLWidget is not visible on linux and Mac OS X

    thanks,
    it seems to be perfect for me ti implement Pyramid.

    One more question. My system does not support pixelbuffer.What should i do for that.

    regards,
    ~sanjay

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.