PDA

View Full Version : OpenGL and Qt Question



ToddAtWSU
21st September 2007, 20:23
I have a project in which I am using Qt and OpenGL (with QGLWidgets). I thought I had OpenGL installed on machine, but now I am doubting myself. I was trying to use the OpenGL function glWindowPos* which is only available in OpenGL 1.4 and higher (they are currently at 2.0 or 2.1). My compiler/linker (VS 2003) complained about not understanding this function call. I decided to use the glGetString( GL_VERSION ) call to see what version on OpenGL I have, but the string that results from this call returns "(null)".

This result is leading me to believe I do not have OpenGL installed on my machine, but leaves me confused how all my OpenGL code compiles and displays. Does Qt come with a majority of the OpenGL calls embedded into the QGLWidget class or how is my code working. I did a search on my machine for gl.h and the only one I got was qgl.h. If this is the only OpenGL code I have, does anybody know what version of OpenGL the QGLWidgets have implemented? Thanks!

momesana
22nd September 2007, 01:06
I don't know much about opengl but this function may help you:
OpenGLVersionFlags QGLFormat::openGLVersionFlags ()
It returns the OpenGlVersionFlags struct that tells you the details about what version of opengl is supported on your system.
http://doc.trolltech.com/4.3/qglformat.html#openGLVersionFlags

kornerr
18th April 2009, 19:04
You have to run QGLWidget::makeCurrent() before using any OpenGL function, as I see it now. The exception goes to QGLWidget::initializeGL(), QGLWidget::resizeGL(), QGLWidget::paintGL(), where QGLWidget::makeCurrent() is implicitly called for you.