I've subclassed QGLWidget to make my own OpenGL rendering context. I've been having wierd issues when testing the .exe on other computers, though, so I've tried to explicitly set the OpenGL version to 3.1 in the constructor:
glWidget
::glWidget(QWidget *parent
) :{
newFormat.setVersion(3,1);
glWidget::context()->setFormat(newFormat); //error here
glWidget::setMouseTracking(true);
}
glWidget::glWidget(QWidget *parent) :
QGLWidget(parent)
{
QGLFormat newFormat;
newFormat.setVersion(3,1);
glWidget::context()->setFormat(newFormat); //error here
glWidget::setMouseTracking(true);
}
To copy to clipboard, switch view to plain text mode
On the line that says "error here", I'm getting the following:
C:\Qt\qtcreator-2.5.2\project\1KEdit\glwidget.cpp:15: error: C2662: 'QGLContext::setFormat' : cannot convert 'this' pointer from 'const QGLContext' to 'QGLContext &'
C:\Qt\qtcreator-2.5.2\project\1KEdit\glwidget.cpp:15: error: C2662: 'QGLContext::setFormat' : cannot convert 'this' pointer from 'const QGLContext' to 'QGLContext &'
To copy to clipboard, switch view to plain text mode
I've tried rearranging it inside the constructor, but I'm always getting one error or another. I took the answer to this question as an example: http://stackoverflow.com/questions/5...get-at-runtime
How do I properly use setFormat?
Bookmarks