[SOLVED] QOpenGLWidget bug?
-
Hello there, I have a strange behaviour in my application when I am trying to switch from default OpenGL core profile to 4.3.
In the main I have:
@int main(int argc, char *argv[])
{
QApplication a(argc, argv);QSurfaceFormat format;
format.setDepthBufferSize(24);
format.setProfile(QSurfaceFormat::CoreProfile);
format.setVersion(4, 3);
QSurfaceFormat::setDefaultFormat(format);Start w;
w.show();
return a.exec();
}@I have a custom widget that I am using in the GUI (3D rendering):
@class MyOpenGL : public QOpenGLWidget
{
public:
MyOpenGL(QWidget* widget);
virtual ~MyOpenGL();protected:
void initializeGL() override;
void paintGL() override;
void resizeGL(int w, int h) override;
};@In the constructor the core profile is 4.3 like expected (via format() property), but in initializeGL(), paintGL() and resizeGL(int w, int h) is always 3.1. I do not have any ideas what is wrong.
I am on Qt 5.4 Windows 8.1 x64 OpenGL version and NVIDIA 550m
Cheers
Paolo -
In the constructor the OpenGL context is not yet created so it will be a bogus value of whatever you set as default. The actual context is available in the initializeGL, paintGL and resizeGL functions.
For some reason the requested version can't be obtained so you get the max possible, but 550M is a 4.4 HW so that shouldn't happen. I assume you have up to date drivers installed?
Is your CPU by any chance an Intel with built-in graphics? Maybe the context is created using the wrong graphics chip? Can you check the output of glGetString(GL_RENDERER) and glGetString(GL_VENDOR) ?
-
Good morning Chris,
'
I assume you have up to date drivers installed?
'
Yes'
Is your CPU by any chance an Intel with built-in graphics? Maybe the context is created using the wrong graphics chip? Can you check the output of glGetString(GL_RENDERER) and glGetString(GL_VENDOR) ?
'
Good point, I have an Intel i7-2670QM with Intel HD 3000 and the outputs are:- Intel(R) HD Graphics 3000;
- Intel.
Thanks a lot for the point :) I forgot that I have in the laptop the old Intel HD 3000 xD
Cheers
Paolo