PDA

View Full Version : QT 4.6 and openGL 2+



schr
30th July 2010, 09:46
Hi,
I have no problem getting openGL to work as such, but I cannot use commands such as glGenBuffers (not defined) and it seems to be realted to the openGL version used by QT.
I have tried to probe my context by doing this (after sub classing QWidget):
if(QGLFormat::OpenGL_Version_3_0&&dviewer.context()->format().openGLVersionFlags())
qDebug() << "looks ok..." << dviewer.context()->format().openGLVersionFlags();
That gives
looks ok... 4223

Which makes me think I should be ok with an openGL3 context. (glGenbuffers is version 1.5+).

I am using Fedora 13 and glxinfo says
glxinfo | grep version
server glx version string: 1.4
client glx version string: 1.4
GLX version: 1.4
OpenGL version string: 3.2.0 NVIDIA 195.36.31
OpenGL shading language version string: 1.50 NVIDIA via Cg compiler


For building I use cmake, but I hope that should not make a difference.


What should I be checking - I think the problem is with the headers, but how do I go about directing QT to certain GL headers? I noticed my system gl.h is openGL 1.1 but I am not sure about how I change this and why that is since the driver seems to be running 3.2 (as per glxinfo).

Thanks for any suggestions!

Soren

tbscope
30th July 2010, 13:42
If the flags return 4223, opengl 3 is not supported on your system.

(dviewer.context()->format().openGLVersionFlags() & QGLFormat::OpenGL_Version_3_0) == QGLFormat::OpenGL_Version_3_0
will return false.

schr
30th July 2010, 14:58
Thanks,
Yes I think that expression was a bit biased by my desire to have GL3 there...
I think I got it working with glew now, but still confused as QT 4.6 should support GL 3.0 and I believe my driver support that too.

Soren

schr
1st August 2010, 05:00
Just to follow up in case others are stuck with the same issues. Got it working with the glew library. Included GL/glew.h before QGLWidget.h and then added GLEW to my linker library list. Glew then says I have openGL 3 available so it appears glew is able to provide the right headers.