thinkabit
28th April 2011, 14:12
hi all, sorry, still pretty new to qt ...
can't find any example on how to share the context between two QGLWidgets.
It's mentioned everywhere, that this should be possible, but i can't get it to work.
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
can't find any example on how to share the context between two QGLWidgets.
It's mentioned everywhere, that this should be possible, but i can't get it to work.
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