Results 1 to 3 of 3

Thread: Single QGLContext across multiple QGLWidgets

  1. #1
    Join Date
    Jun 2008
    Posts
    3
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11

    Default Single QGLContext across multiple QGLWidgets

    I'm having some serious issues trying to figure out how I successfully share a single QGLContext across multiple QGLWidgets. I want to share resources (display lists, vertex buffer objects, textures, etc) across both to optimize data loading (i.e. only create a single large VBO to draw in multiple gl windows).

    Qt Code:
    1. QGLFormat format;
    2. QGLContext* context = new QGLContext(format);
    3. //GlWorld inherits from QGLWidget...
    4. GlWorld world1(context);
    5. MySprite single_sprite;
    6.  
    7. world1.InstallSprite2D(&single_sprite);
    8. world1.show();
    9. world1.run();
    10.  
    11.  
    12. // Application Crashes at the
    13. // creation of world2... not sure why?
    14. // QGLcontext, QWidget*, QGLWidget*
    15. GlWorld world2(context, NULL, &world1);
    16. world2.InstallSprite2D(&single_sprite);
    17. world2.show();
    18. world2.run();
    19.  
    20. Part of class definition...
    21. GlWorld::GlWorld(QGLContext* context,
    22. QWidget *parent, QGLWidget* shared) : QGLWidget(context, parent, shared)
    23. {
    24. ...
    25. ..
    26. }
    To copy to clipboard, switch view to plain text mode 

    Any help would be great... but a working example would probably be most helpful.
    thanks in advance...

  2. #2
    Join Date
    Jun 2008
    Posts
    3
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11

    Default Re: Single QGLContext across multiple QGLWidgets

    No one have any ideas on this?

  3. #3
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    5,372
    Thanks
    28
    Thanked 976 Times in 912 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Single QGLContext across multiple QGLWidgets

    What does GlWorld::run() do?

Similar Threads

  1. Single slot for multiple list boxes
    By Sheetal in forum Qt Programming
    Replies: 1
    Last Post: 15th April 2008, 06:53
  2. KDE/QWT doubt on debian sarge
    By hildebrand in forum KDE Forum
    Replies: 13
    Last Post: 25th April 2007, 06:13
  3. Problem with multiple QGLWidgets
    By claustre in forum Qt Programming
    Replies: 2
    Last Post: 23rd February 2007, 13:37
  4. QGLContext with multiple graphics cards
    By yuriy in forum Qt Programming
    Replies: 2
    Last Post: 11th September 2006, 15:35
  5. Replies: 11
    Last Post: 7th July 2006, 13:09

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.