Unsolved QOpenGLWidget 5.5, OpenGL 4.1, MacOS X, Intel HD Graphics 5000 1536 MB
-
Hi,
I figured Game Dev would be the best place to post this request:
Is anyone out there able to use QOpenGLWidget (or QOpenGLWindow for that matter) with OpenGL 4.1 with Qt 5.5? If so, perhaps you are willing to provide an extremely simple example project? A triangle with frag and vertex shaders would be all that I would need.
I have tried so many configurations, profiles, formats, drawing methods, etc. that I am at a complete loss and my code is getting more and more scrambled as I become more frustrated.
Example or not, any tips would be much appreciated.
Thanks!
P.S. I've had no problems with OpenGL 2.0/GLSL 110. I'm primarily seeking the instancing functions introduced in later versions.
-
Hi
I'm working on some OpenGL tutorials, I add one with a triangle with opengl 4.1. Check here , it works for me.
Welcome a board. -
Hi cccl and Johngod,
First of all thanks Johngod for your great tutorial!
Then, regarding to cccl issue, it would be grateful if you could update the main files in your tutorial by setting the context default format in order to compile shaders 4+, below how should the main file looks:#include "mainwindow.h" #include <QApplication> #include<QSurfaceFormat> int main(int argc, char *argv[]) { QApplication a(argc, argv); QSurfaceFormat format; format.setDepthBufferSize(24); //if you need it format.setStencilBufferSize(8); //if you need it format.setVersion(4, 1); // OpenGL version format.setProfile(QSurfaceFormat::CoreProfile); QSurfaceFormat::setDefaultFormat(format); MainWindow w; w.show(); return a.exec(); }
Cheers, Nai
-
@Alharbi
Thanks for your comments. Perhaps you miss it but I have that code in the MainWindow ctor. However your sugestion makes sense, since according the docs, "it is simpler and more robust to set the requested format globally so that it applies to all windows and contexts during the lifetime of the application". So I have updated it to main.cpp.
Some notes, could not make the core profile work in linux not sure why, and in windows both profiles seem buggy. I found some reported opengl bugs on bugtracker that could be the reason,or maybe it's just something that I'm overlooking in my code.