Results 1 to 16 of 16

Thread: OpenGL with Graphics View?

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,368
    Thanks
    3
    Thanked 5,018 Times in 4,794 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: OpenGL with Graphics View?

    Quote Originally Posted by Dutch112 View Post
    Or would I have to overpaint in a QGLWidget to do this and not use the graphics view framework?
    You can make the QGLWidget a viewport of the graphicsview and then use pure GL calls inside the items' paint() routines to do the painting, that's not a problem. You can even mix GL and QPainter based items if you want. Either way be sure to draw in the right coordinates (remember about the bounding rect and transformations applied to items).
    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.


  2. #2

    Default Re: OpenGL with Graphics View?

    Quote Originally Posted by wysota View Post
    You can make the QGLWidget a viewport of the graphicsview and then use pure GL calls inside the items' paint() routines to do the painting, that's not a problem. You can even mix GL and QPainter based items if you want. Either way be sure to draw in the right coordinates (remember about the bounding rect and transformations applied to items).
    Is this preferable to creating a subclass of QGLWidget and trying to add that widget to the scene?

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

    Default Re: OpenGL with Graphics View?

    Quote Originally Posted by Dutch112 View Post
    Is this preferable to creating a subclass of QGLWidget and trying to add that widget to the scene?
    From what I know this will currently not work.
    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.


  4. #4
    Join Date
    Apr 2009
    Posts
    132
    Thanks
    67
    Thanked 6 Times in 5 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: OpenGL with Graphics View?

    Quote Originally Posted by wysota View Post
    From what I know this will currently not work.
    I'm doing to create my game level editor and everything works fine.


    @Dutch112. How are you going to control your animation time? are you going to use QTimer or just a common loop game?

  5. #5
    Join Date
    Feb 2009
    Posts
    79
    Thanks
    11
    Thanked 5 Times in 5 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: OpenGL with Graphics View?

    Well, that's not so easy.
    First, AFAIK not every system supports these framebuffers. Pls correct me if I'm wrong.

    Secondly, I would have to initialize (initializeGL, resizeGL and paintGL) this new OpenGL object. As I am doing it up to now, all these initialisations are already done for me by the Qt subsystem.
    This means that I would have to ready out the projection and modelview matices everytime and keep a copy of them locally up to date.

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

    Default Re: OpenGL with Graphics View?

    It's either this or grabbing the widget or forgetting about GL... You can't use GL calls on a non-gl context and if you want a canvas that is different than the widget you have to set it up separately.
    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. Graphics View Panning ,zooming
    By linuxdev in forum Qt Programming
    Replies: 3
    Last Post: 29th December 2008, 07:17
  2. Replies: 4
    Last Post: 5th August 2008, 19:55
  3. Graphics View Event Propagation
    By pherthyl in forum Qt Programming
    Replies: 10
    Last Post: 3rd July 2008, 10:39
  4. Graphics view display problem.
    By kiranraj in forum Qt Programming
    Replies: 3
    Last Post: 20th July 2007, 07:08
  5. Adding Rectangular overlay on graphics view
    By forrestfsu in forum Qt Programming
    Replies: 10
    Last Post: 21st November 2006, 19:42

Tags for this Thread

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.