superwave
27th June 2011, 15:59
Must the QGLWidget::makeCurrent () be placed inside of the constructor?
such as:
QGLWidget::QGLWidget(QWidget *parent)
{
......
makeCurrent();
......
glBegin(GL_LINES);
glVertex3f(+1.0, +1.0, -1.0);
...
}
I tried this:
QGLWidget *canvas;
...
canvas->makeCurrent();
......
glBegin(GL_LINES);
glVertex3f(+1.0, +1.0, -1.0);
...
However, in this way, it's blank, nothing is shown on the QGLWidget.
such as:
QGLWidget::QGLWidget(QWidget *parent)
{
......
makeCurrent();
......
glBegin(GL_LINES);
glVertex3f(+1.0, +1.0, -1.0);
...
}
I tried this:
QGLWidget *canvas;
...
canvas->makeCurrent();
......
glBegin(GL_LINES);
glVertex3f(+1.0, +1.0, -1.0);
...
However, in this way, it's blank, nothing is shown on the QGLWidget.