[PyQt] QOpenGLWindow (PyQt-5.4)
Trent Huong
aussie.dnb at gmail.com
Fri Jan 9 06:34:34 GMT 2015
Hi,
I am running into some problems trying to use the new QOpenGLWindow in
Qt-5.4. The error is "AttributeError: 'QOpenGLContext' object has no
attribute 'functions'". However, according to the documentation,
QOpenGLContext should have such a function. Are the bindings not up to date
or have I made another mistake? Here is the code:
import os
import sys
from PyQt5.QtGui import (QOpenGLWindow, QSurfaceFormat)
from PyQt5.QtWidgets import (QApplication,)
class MainWindow(QOpenGLWindow):
def resizeGL(self, w, h):
pass
def paintGL(self):
gl = self.context().functions()
gl.glClearColor(1.0, 0.0, 0.0, 1.0)
gl.glClear(gl.GL_COLOR_BUFFER_BIT | gl.GL_DEPTH_BUFFER_BIT)
if __name__ == '__main__':
app = QApplication(sys.argv)
format = QSurfaceFormat()
format.setDepthBufferSize(24);
format.setStencilBufferSize(8);
format.setSamples(4)
window = MainWindow()
window.setTitle("Hello OpenGL")
window.setFormat(format)
window.resize(640, 480)
window.show()
sys.exit(app.exec_())
Thanks!
T.H.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.riverbankcomputing.com/pipermail/pyqt/attachments/20150109/12beff77/attachment.html>
More information about the PyQt
mailing list