<div dir="ltr"><div><div><div><div>Firstly, I have had trouble with OpenGL_accelerate 
from time to time - I would try uninstalling OpenGL_accelerate while 
keeping plain pyopengl to see if that helps anything.<br><br></div>
I think QOpenGLFunctions in PyQt is incomplete simply because there are a
 heck of a lot of OpenGL functions and many of them want void* blobs 
that would take significant wrapping and infrastructure to present in a 
sensible way, which PyOpenGL already does tolerably.<br>
<br></div>That said, it is possible to use the new Qt5 QWindow and 
QOpenGLContext stuff together with PyOpenGL in Python on an OpenGL 2.0 
context.  Here's a little example I threw together doing that:<br><br><span style="font-family:courier new,monospace">#!/usr/bin/env python3<br>
<br>from OpenGL import GL<br>from PyQt5 import Qt<br><br>class GlQWindow(Qt.QWindow):<br>    def __init__(self):<br>        super().__init__()<br>        format = Qt.QSurfaceFormat()<br>        format.setVersion(2, 0)<br>

        format.setProfile(Qt.QSurfaceFormat.CompatibilityProfile)<br>        format.setStereo(False)<br>        format.setSwapBehavior(Qt.QSurfaceFormat.DoubleBuffer)<br>        self.setSurfaceType(Qt.QWindow.OpenGLSurface)<br>

        self.context = Qt.QOpenGLContext()<br>        self.context.setFormat(format)<br>        if not self.context.create():<br>            raise Exception('self.context.create() failed')<br>        self.create()<br>

<br>    def exposeEvent(self, ev):<br>        ev.accept()<br>        if self.isExposed() and self.isVisible():<br>            self.update()<br><br>    def makeCurrent(self):<br>        self.context.makeCurrent(self)<br><br>

    def swapBuffers(self):<br>        self.context.swapBuffers(self)<br><br>    def update(self):<br>        self.makeCurrent()<br>        GL.glClearColor(0,0,0,0)<br>        GL.glClearDepth(1)<br>        GL.glClear(GL.GL_COLOR_BUFFER_BIT | GL.GL_DEPTH_BUFFER_BIT)<br>

        GL.glBegin(GL.GL_TRIANGLES)<br>        GL.glVertex2f(0.5, 1)<br>        GL.glVertex2f(1, 0)<br>        GL.glVertex2f(0, 0)<br>        GL.glEnd()<br>        GL.glFlush()<br>        self.swapBuffers()<br><br><br>app = Qt.QApplication([])<br>

glQWindow = GlQWindow()<br>glQWindowWidget = Qt.QWidget.createWindowContainer(glQWindow, None, Qt.Qt.Widget)<br>glQWindowWidget.show()<br>app.exec_()</span><br><br></div>This
 wasn't exactly the easiest to figure out, but it works quite well, and 
it can be extended to support drawing on the OpenGL context from a 
different thread by doing glQWindow.context.moveToThread(a_qthread_instance).  QOpenGLContext.swapBuffers(..) is thread safe, FYI, or is at least safe to call from the thread owning the context.<br>
<br></div>Incidentally, if your Qt binaries were compiled with OpenGL ES
 support only, you're going to want to rebuild them with *desktop* 
OpenGL support enabled.  I mention this only because I went through a 
period of total confusion as a result of having ES only binaries.  The 
official binaries from <a href="http://qt-project.org" target="_blank">qt-project.org</a> are all built with desktop OpenGL support, except for Android and iOS, of course.<div class="gmail_extra"><br></div><div class="gmail_extra">
-Erik<br></div><div class="gmail_extra"><br><div class="gmail_quote">On Wed, Jul 23, 2014 at 12:15 PM, Alan Ezust <span dir="ltr"><<a href="mailto:alan.ezust@gmail.com" target="_blank">alan.ezust@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>I am trying to do openGL on a virtual machine, which only supports OpenGL 2.1<br>I've checked that my directX version is 11<br>
<br>Most of of the PyQt examples don’t work because (I think) our openGL is only 2.1 on the virtual machines. <br>
However, openGLWindow.py works fine, and spits out no errors.<br><br>The other examples run but spits out lots of errors, and I can’t see anything in the windows. <br></div>Here is the output of grabber.py:<br><div><br>C:\Python33\python.exe C:/Python33/Lib/site-packages/PyQt5/examples/opengl/grabber.py<br>

Traceback (most recent call last):<br>  File "C:/Python33/Lib/site-packages/PyQt5/examples/opengl/grabber.py", line 114, in initializeGL<br>    glLightfv(GL_LIGHT0, GL_POSITION, lightPos)<br>  File "latebind.pyx", line 32, in OpenGL_accelerate.latebind.LateBind.__call__ (c:\Users\mcfletch\OpenGL-dev\OpenGL-ctypes\OpenGL_accelerate\src\latebind.c:989)<br>

  File "wrapper.pyx", line 318, in OpenGL_accelerate.wrapper.Wrapper.__call__ (c:\Users\mcfletch\OpenGL-dev\OpenGL-ctypes\OpenGL_accelerate\src\wrapper.c:6561)<br>  File "wrapper.pyx", line 311, in OpenGL_accelerate.wrapper.Wrapper.__call__ (c:\Users\mcfletch\OpenGL-dev\OpenGL-ctypes\OpenGL_accelerate\src\wrapper.c:6439)<br>

  File "C:\Python33\lib\site-packages\OpenGL\platform\baseplatform.py", line 402, in __call__<br>    return self( *args, **named )<br>  File "errorchecker.pyx", line 53, in OpenGL_accelerate.errorchecker._ErrorChecker.glCheckError (c:\Users\mcfletch\OpenGL-dev\OpenGL-ctypes\OpenGL_accelerate\src\errorchecker.c:1218)<br>

OpenGL.error.GLError: GLError(<br>    err = 1282,<br>    description = b'invalid operation',<br>    baseOperation = glLightfv,<br>    pyArgs = (<br>        GL_LIGHT0,<br>        GL_POSITION,<br>        <OpenGL.raw.GL._types.c_float_Array_4 object at 0x03227800>,<br>

    ),<br>    cArgs = (<br>        GL_LIGHT0,<br>        GL_POSITION,<br>        <OpenGL.raw.GL._types.c_float_Array_4 object at 0x03227800>,<br>    ),<br>    cArguments = (<br>        GL_LIGHT0,<br>        GL_POSITION,<br>

        <OpenGL.raw.GL._types.c_float_Array_4 object at 0x03227800>,<br>    )<br>)<br><br>2dpainting.py, helloGL.py and overpainting.py do the same thing as grabber.py<br><br>The main difference with openGLWindow compared to the other examples is that it uses Qt’s initializeOpenGLFunctions() to get access to openGL API of the correct version. This seems to be safer across multiple platforms than using OpenGL Apis directly, as the other examples do.<br>

<br>       if needsInitialize:<br>            self.m_gl = self.m_context.versionFunctions()<br>            self.m_gl.initializeOpenGLFunctions()<br><br></div><div>Do the other examples even check to see what version of openGL is running? <br>

</div><div><br>Is there any reason why QOpenGLFunctions is not available from PyQt? <br><br><br></div></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Sun, Mar 2, 2014 at 4:41 AM, Matthew Ngaha <span dir="ltr"><<a href="mailto:chigga101@gmail.com" target="_blank">chigga101@gmail.com</a>></span> wrote:<br>

<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hey David. I've updated and re-updated the drivers to no avail. But<br>
what really puzzles me is my card is Intel (R) HD graphics. My mum's<br>
PC uses an earlier version of the same driver and Qt5 programs run<br>
fine. But mine a more recent version doesn't work. I now realise it's<br>
not a Qt problem, maybe I can contact Intel's support desk.<br>
<br>
Thanks for heloing.<br>
<div><div>_______________________________________________<br>
PyQt mailing list    <a href="mailto:PyQt@riverbankcomputing.com" target="_blank">PyQt@riverbankcomputing.com</a><br>
<a href="http://www.riverbankcomputing.com/mailman/listinfo/pyqt" target="_blank">http://www.riverbankcomputing.com/mailman/listinfo/pyqt</a><br>
</div></div></blockquote></div><br></div>
<br>_______________________________________________<br>
PyQt mailing list    <a href="mailto:PyQt@riverbankcomputing.com">PyQt@riverbankcomputing.com</a><br>
<a href="http://www.riverbankcomputing.com/mailman/listinfo/pyqt" target="_blank">http://www.riverbankcomputing.com/mailman/listinfo/pyqt</a><br></blockquote></div><br></div></div>