[Qt-interest] qglwidget: how to share context
Oliver Hunger
office at thinkabit.net
Thu Apr 28 14:49:30 CEST 2011
hi there, again me, the one with little knowledge of what i'm actually
doing ;-)
i've read a lot about the possibility to share the context of qglwidgets.
i've really searched hard, but couldn't find any example on google. all
i get is that it IS possible, but not HOW ...
can anyone please help?
what i've tried so far:
this gives me an "invalid conversion from 'const QGLContext*' to
'QGLContext*'" in the hw=... line
Widget::Widget(QWidget *parent) : QWidget(parent)
{
glw = new GLWidget(this);
hw = new HiddenWidget(glw->context(), this, glw);
...
}
HiddenWidget::HiddenWidget(QGLContext *contxt, QWidget *parent,
QGLWidget *shared) : QGLWidget(contxt, parent, shared)
{
...
}
GLWidget::GLWidget(QWidget *parent) : QGLWidget(parent)
{
...
}
i've also tried something like
QGLFormat format;
QGLContext *contxt;
contxt=new QGLContext(format);
in the Widget class constructor and pass that to another constructor for
GLWidget and to HiddenWidget, but that didn't work either, and i
wouldn't know where and when to assign the context to whom ...
glw = new GLWidget(contxt, this, NULL);
hw = new HiddenWidget(contxt, this, glw);
GLWidget::GLWidget(QGLContext *contxt, QWidget *parent, QGLWidget
*shared) : QGLWidget(contxt, parent, shared)
{
}
thanks for help,
oliver
More information about the Qt-interest-old
mailing list