Must the QGLWidget::makeCurrent () be placed inside of the constructor?
such as:
{
......
makeCurrent();
......
glBegin(GL_LINES);
glVertex3f(+1.0, +1.0, -1.0);
...
}
QGLWidget::QGLWidget(QWidget *parent)
{
......
makeCurrent();
......
glBegin(GL_LINES);
glVertex3f(+1.0, +1.0, -1.0);
...
}
To copy to clipboard, switch view to plain text mode
I tried this:
...
canvas->makeCurrent();
......
glBegin(GL_LINES);
glVertex3f(+1.0, +1.0, -1.0);
...
QGLWidget *canvas;
...
canvas->makeCurrent();
......
glBegin(GL_LINES);
glVertex3f(+1.0, +1.0, -1.0);
...
To copy to clipboard, switch view to plain text mode
However, in this way, it's blank, nothing is shown on the QGLWidget.
Bookmarks