1

I've just installed OpenGL to use with Python 3.7 and PyQt5, installation was without any errors. When I try to run the example codes given with PyQt5 for OpenGL, only 1 example code runs, all other gave error. Following are the error associated with each file:

openglwindow.py

self.m_gl.initializeOpenGLFunctions()

AttributeError: 'NoneType' object has no attribute 'initializeOpenGLFunctions'

grabber.py

File "src/errorchecker.pyx", line 53, in OpenGL_accelerate.errorchecker._ErrorChecker.glCheckError

OpenGL.error.GLError: GLError(

err = 1282,

description = b'invalid operation',

baseOperation = glLightfv,

...

hellogl.py

File "src/errorchecker.pyx", line 53, in OpenGL_accelerate.errorchecker._ErrorChecker.glCheckError

OpenGL.error.GLError: GLError(

err = 1282,

description = b'invalid operation',

baseOperation = glGetString,

cArguments = (GL_VENDOR,)

)

overpainting.py

File "src/errorchecker.pyx", line 53, in OpenGL_accelerate.errorchecker._ErrorChecker.glCheckError

OpenGL.error.GLError: GLError(

err = 1282,

description = b'invalid operation',

baseOperation = glGenLists,

cArguments = (1,),

result = 0

)

samplebuffers.py

File "src/errorchecker.pyx", line 53, in OpenGL_accelerate.errorchecker._ErrorChecker.glCheckError

OpenGL.error.GLError: GLError(

err = 1282,

description = b'invalid operation',

baseOperation = glMatrixMode,

cArguments = (GL_PROJECTION,)

)

I am using windows 10 and OpenGL version is 3.1. How can I fix this issue?

Community
  • 1
  • 1
MAY
  • 667
  • 1
  • 6
  • 21

1 Answers1

1

After lot of searching I found that by default Windows uses ANGLE, a library that implements OpenGL ES on top of Direct 3D.

So to force application to use OpenGL instead of ANGLE, I added

QCoreApplication.setAttribute(Qt.AA_UseDesktopOpenGL)

Also, I used Unofficial Windows PyOpenGL Binaries.

I got the solution from following 2 sources:

Source 1 - RiverBank Computing

Source 2 - StackOverflow

MAY
  • 667
  • 1
  • 6
  • 21