I'm having difficulty creating an OpenGL context newer than 2.1 (Mac OS 10.9.1, Qt 4.8.5, PySide 1.2.1). Minimal example code is given below; it produces a 2.1 context rather than 3.2 or higher.
The code is based on this tutorial; the tutorial's sample C++ code also fails when run on my machine.
This issue might be related to this bug: QGLFormat.openGLVersionFlags()
returns 0x7f
(indicating compatability up to OpenGL 2.1 but no later).
Is there something that I'm missing, or is it hopeless until that bug is fixed?
from PySide import QtGui, QtOpenGL
from OpenGL.GL import *
class Canvas(QtOpenGL.QGLWidget):
def __init__(self, parent=None):
format = QtOpenGL.QGLFormat()
format.setVersion(3, 2)
format.setProfile(QtOpenGL.QGLFormat.CoreProfile)
super(Canvas, self).__init__(format, parent)
def initializeGL(self): print glGetString(GL_VERSION)
def paintGL(self): pass
if __name__ == '__main__':
app = QtGui.QApplication("test")
canvas = Canvas()
canvas.show()
app.exec_()