<div dir="ltr"><div>Just a quick follow up, I've tried playing around with it some more. For example, I've requested a specific OpenGL version and used "versionFunctions" to get access to the OpenGL functions. However, this gives new errors, this time:<br><br>"ImportError: No module named 'PyQt5._QOpenGLFunctions_4_2_Core'"<br><br></div>Is this just a case of user error or is the support for the new OpenGL features still incomplete?<br><div><div><br>import os<br>import sys<br><br>from PyQt5.QtGui import (QOpenGLContext, QOpenGLWindow, QSurfaceFormat)<br>from PyQt5.QtWidgets import (QApplication,)<br><br>class MainWindow(QOpenGLWindow):<br> def initializeGL(self):<br> <a href="http://self.gl">self.gl</a> = self.context().versionFunctions() #QOpenGLContext.currentContext().versionFunctions()<br> self.gl.initializeOpenGLFunctions()<br> <br> self.gl.glClearColor(1.0, 0.0, 0.0, 1.0)<br> <br> def resizeGL(self, w, h):<br> pass<br> <br> def paintGL(self):<br> self.gl.glClear(gl.GL_COLOR_BUFFER_BIT | gl.GL_DEPTH_BUFFER_BIT)<br> <br>if __name__ == '__main__':<br> app = QApplication(sys.argv)<br> <br> format = QSurfaceFormat()<br> <br> format.setVersion(4, 2)<br> format.setProfile(QSurfaceFormat.CoreProfile)<br><br> format.setDepthBufferSize(24);<br> format.setStencilBufferSize(8);<br> format.setSamples(4)<br> <br> window = MainWindow()<br> window.setTitle("Hello OpenGL")<br> window.setFormat(format)<br> window.resize(640, 480)<br> window.show()<br> <br> sys.exit(app.exec_())<br><br></div><div>Cheers,<br></div><div>T.H.<br></div><div><br></div></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Fri, Jan 9, 2015 at 4:34 PM, Trent Huong <span dir="ltr"><<a href="mailto:aussie.dnb@gmail.com" target="_blank">aussie.dnb@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div>Hi,<br><br></div>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:<br><div><br>import os<br>import sys<br><br>from PyQt5.QtGui import (QOpenGLWindow, QSurfaceFormat)<br>from PyQt5.QtWidgets import (QApplication,)<br><br>class MainWindow(QOpenGLWindow):<br> def resizeGL(self, w, h):<br> pass<br> def paintGL(self):<br> gl = self.context().functions()<br> <br> gl.glClearColor(1.0, 0.0, 0.0, 1.0)<br> gl.glClear(gl.GL_COLOR_BUFFER_BIT | gl.GL_DEPTH_BUFFER_BIT)<br> <br>if __name__ == '__main__':<br> app = QApplication(sys.argv)<br> <br> format = QSurfaceFormat()<br> format.setDepthBufferSize(24);<br> format.setStencilBufferSize(8);<br> format.setSamples(4)<br> <br> window = MainWindow()<br> window.setTitle("Hello OpenGL")<br> window.setFormat(format)<br> window.resize(640, 480)<br> window.show()<br> <br> sys.exit(app.exec_())<br><br></div><div>Thanks!<span class="HOEnZb"><font color="#888888"><br></font></span></div><span class="HOEnZb"><font color="#888888"><div>T.H.<br></div><div><br></div></font></span></div>
</blockquote></div><br></div>