[Qt-interest] Initialising OpenGL without GLWidget

Oliver.Knoll at comit.ch Oliver.Knoll at comit.ch
Wed Dec 2 17:52:30 CET 2009


Peter Dove wrote on Wednesday, December 02, 2009 4:12 PM:

> ...
> Does anyone have any standard code for initialising? Can I just use
> Glut? 

I understand you don't want to render anything (if you want to render "offscreen" only, then you would go for http://doc.trolltech.com/4.6/qglpixelbuffer.html which should work without any QGLWidget - or http://doc.trolltech.com/4.6/qglframebufferobject.html, but IIRC I had problems initialising a proper GL context without a QGLWidget. Read the docs about the pros and cons of these approaches).

So if you merely want to use matrix/vector multiplications you should be fine with simply calling the glu(t)- functions.

Note though that somewhere in my mind there rings a bell, saying that from OpenGL 3.0 onwards functions like glMultMatrix(), glTranslate etc. have been deprecated. "Vertex calculation operations" should be done on the CPU (using "real" linear algebra libraries), or using the "vertex shader" language.

I don't know whether using a "vertex shader" without a proper GL context initialisation (e.g. as done by creating a QGLWidget) is possible (in Qt). But while experimenting you could tell us about the new (Qt 4.6) http://doc.trolltech.com/4.6/qglshader.html and/or http://doc.trolltech.com/4.6/qglshaderprogram.html and whether they work without a QGLWidget ;)


A quick google ("glMultMatrix 3.0 deprecated") turned up http://pyopengl.sourceforge.net/documentation/manual-3.0/index.xhtml - not sure whether DEPRECATED refers to the "PyOpenGL" implementation itself, or really the OpenGL 3.0 specs.

Another interesting link probably sheds more "glLight" on this: http://www.opengl.org/discussion_boards/ubbthreads.php?ubb=showflat&Number=260279

All these are deprecated (or already removed in OpenGL 3.1!): 

"Complete list of deprecated functions in this category:
glColorPointer, glEdgeFlagPointer, glFogCoordPointer, glIndexPointer, glNormalPointer, glSecondaryColorPointer, glTexCoordPointer, glVertexPointer, glEnableClientState, glDisableClientState, and glInterleavedArrays, glClientActiveTexture, glFrustum, glLoadIdentity, glLoadMatrix, glLoadTransposeMatrix, glMatrixMode, glMultMatrix, glMultTransposeMatrix, glOrtho*, glPopMatrix, glPushMatrix, glRotate*, glScale*, and glTranslate*, glMaterial*, glLight*, glLightModel*, and glColorMaterial, glShadeModel, and glClipPlane*."

and

"Instead, implement a vertex shader that performs the required vertex processing" 

(aha, just as I guessed above ;)

Just in case you were considering using those functions for speeding up your math library ;)

Cheers, Oliver
-- 
Oliver Knoll
Dipl. Informatik-Ing. ETH
COMIT AG - ++41 79 520 95 22



More information about the Qt-interest-old mailing list