Problems with running the OpenGL Core Profile tutorial
-
I downloaded the source code for the tutorial "How to use OpenGL Core Profile with Qt" found "here":http://qt-project.org/wiki/How_to_use_OpenGL_Core_Profile_with_Qt and built it without a problem using QtCreator 2.4.1 / Qt 4.8.0 on Linux. However, When I run it as-is I simply get a blank window. as seen "here.":http://i.imgur.com/Rp5Rr.png By changing the call to GlFormat::setVersion() from setVersion( 3, 3 ) to 3, 1 or lower, the problem "disappears.":http://i.imgur.com/NwFjY.png
My driver seems to support OpenGL 3.3; glxinfo gives me:
OpenGL version string: 3.3.0 NVIDIA 295.33
OpenGL shading language version string: 3.30 NVIDIA via Cg compilerAny idea what is causing this/how to fix it? Do I simply need to restrict myself to using OpenGL <= 3.1? I have no need for the Core Profile, however the problem persists even when the same code is used with the compatibility profile. I will be starting an OpenGL project soon and would like to get this resolved.
Does anyone else have the same issue with the code provided in that tutorial?
-
I'm going to bump this because my post originally had a typo in the link to the tutorial.
Can anyone please at least try to reproduce this problem and tell me whether or not it's an issue on my end?
-
Bumping this because I have the exact same issue and no idea how to fix it. I have a similar driver:
OpenGL version string: 4.2.0 NVIDIA 295.53
OpenGL shading language version string: 4.20 NVIDIA via Cg compilerI'm surprised no one else has run into this.
-
The tutorial says: "<...> it is required to bind a VAO before setting up the attributes. This behavior is part of the OpenGL 3.3 core profile."
Add this in initializeGL before m_shader.setAttributeBuffer:
@uint vao;
typedef void (APIENTRY _glGenVertexArrays) (GLsizei, GLuint);
typedef void (APIENTRY *_glBindVertexArray) (GLuint);_glGenVertexArrays glGenVertexArrays;
_glBindVertexArray glBindVertexArray;glGenVertexArrays = (_glGenVertexArrays) QGLWidget::context()->getProcAddress("glGenVertexArrays");
glBindVertexArray = (_glBindVertexArray) QGLWidget::context()->getProcAddress("glBindVertexArray");glGenVertexArrays(1, &vao);
glBindVertexArray(vao);@