Results 1 to 4 of 4

Thread: How to share texture object with mutil qglwidget

  1. #1
    Join Date
    Apr 2015
    Posts
    7
    Thanked 1 Time in 1 Post
    Qt products
    Qt5
    Platforms
    Windows

    Default How to share texture object with mutil qglwidget

    Hello,
    I am developing a application,i need some qglwidgets share a volume 3d texture.I know
    Qt Code:
    1. QGLWidget::QGLWidget(QWidget * parent = 0, const QGLWidget * shareWidget = 0, Qt::WindowFlags f = 0)
    To copy to clipboard, switch view to plain text mode 
    can share texture between two qglwidget(Qglwidget share with shareWidget).Is
    tere a way to share texture with multi qglwidget?

    Thanks,

  2. #2
    Join Date
    Nov 2014
    Posts
    29
    Thanks
    2
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: How to share texture object with mutil qglwidget

    Yes, in OpenGL you can share textures between displays that have the same context.

    So, you can create a new gl context, and then create your two widgets with that context:

    QGLContext(const QGLFormat & format);
    QGLWidget(QGLContext * context, QWidget * parent = 0, const QGLWidget * shareWidget = 0, Qt::WindowFlags f = 0)

    https://www.opengl.org/discussion_bo...hare-a-texture
    pixaeiro
    http://www.pixaflux.com
    Non-destructive Image Editor

  3. #3
    Join Date
    Apr 2015
    Posts
    7
    Thanked 1 Time in 1 Post
    Qt products
    Qt5
    Platforms
    Windows

    Default Re: How to share texture object with mutil qglwidget

    yes,I know use QGLContext maybe solve my problem.But I don't understand QGlContext.Is there a example to use QGLContext ?Thanks

  4. #4
    Join Date
    Apr 2015
    Posts
    7
    Thanked 1 Time in 1 Post
    Qt products
    Qt5
    Platforms
    Windows

    Default Re: How to share texture object with mutil qglwidget

    Quote Originally Posted by pixaeiro View Post
    Yes, in OpenGL you can share textures between displays that have the same context.

    So, you can create a new gl context, and then create your two widgets with that context:

    QGLContext(const QGLFormat & format);
    QGLWidget(QGLContext * context, QWidget * parent = 0, const QGLWidget * shareWidget = 0, Qt::WindowFlags f = 0)

    https://www.opengl.org/discussion_bo...hare-a-texture
    I have a try like this
    Qt Code:
    1. cx_ = new QGLContext(QGLFormat::defaultFormat());
    2. cx_->create();
    3.  
    4. slicerX_ = new slicerCanvas(cx_,this);
    5.  
    6. cx_ = slicerX_->context();
    7.  
    8. secWid_ = new secCan(cx_,this,slicerX_);
    9.  
    10. thrWid_ = new triCan(cx_,this,slicerX_);
    To copy to clipboard, switch view to plain text mode 
    but it don't render correct.I saw a question in
    http://stackoverflow.com/questions/2...t-or-data?rq=1 ,
    any one can give me some advice? thanks
    ,

Similar Threads

  1. how to share a 3d texture with 4 QGLWidgets?
    By jamesyao in forum Qt Programming
    Replies: 0
    Last Post: 6th November 2013, 13:02
  2. QGLWidget background texture
    By hubipet in forum Qt Programming
    Replies: 0
    Last Post: 3rd September 2012, 10:11
  3. [QGLWidget] Cannot bind texture
    By Macok in forum Qt Programming
    Replies: 1
    Last Post: 5th April 2009, 19:53
  4. Share a 3D texture in four QGLWidgets
    By jp-deivis in forum Qt Programming
    Replies: 6
    Last Post: 21st October 2007, 19:44
  5. Texture in QGLWidget
    By showhand in forum Qt Programming
    Replies: 5
    Last Post: 28th October 2006, 08:47

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
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.