PDA

View Full Version : What versions of OpenGL does Qt support?



abernat
1st September 2009, 18:30
I'm developing with Qt 4.5, and I wanted to use the OpenGL 2.0 spec for development. I'm just trying to get a very basic program running right now. When I try to compile, glCreateShader() isn't declared, telling me that Qt's OpenGL is pre-2.0, yet when I grep the source code, I see references to glCreateShader(). Is there a compiler flag I need to set in order to code against the 2.0 spec? Is there a function I can call to see what version of the spec is being supported? Some insight would be greatly appreciated.

abernat
1st September 2009, 19:02
As a partial answer, I figured out how to use QGLFormat::openGLVersionFlags() to get the versions supported on my system. It shows that I support everything from 1.1 - 3.0 (which is what I expected). But the compiler doesn't recognize functions introduced from 2.0 on, so I could still use some help with specifying what version I want to use. I noticed references to glCreateShader in qglextensions.cpp, but I can't find anything in the documentation about that. Help, please.

wysota
1st September 2009, 19:26
This is strictly related to header files. If there is a particular declaration missing, you can declare it yourself in your header or implementation file, just as any other function. In case of glCreateShader() it is:

GLuint glCreateShader( GLenum shaderType);

There is probably a header file in Qt that already does that. Try grepping the sources if in doubt.

abernat
1st September 2009, 21:33
Thanks for responding wysota. Between the time I posted and saw your reply, deeper digging showed people using GLEW and GLEE to make to take of all the header stuff. I used GLEW, and it worked beautifully.