OpenGL.error.NullFunctionError:尝试调用未定义的函数

2024-06-16 09:39:11 发布

您现在位置:Python中文网/ 问答频道 /正文

我正在用Python 3.6开发一个使用OpenGL的图像可视化GUI。我在Miniconda上安装了OpenGL(3.1.1a1)。我的程序以前已经完成并运行了。几周前我重新安装了miniconda。然而,我今天得到了错误。我不确定错误是否类似于the question。如何修复该错误

谢谢

部分代码和错误:

1 from OpenGL import GL

142 # Set up primary geotiff texture
143 self.gtifTex = GL.glGenTextures(1)
144 GL.glActiveTexture(GL.GL_TEXTURE0)
145 GL.glBindTexture(GL.GL_TEXTURE_2D, self.gtifTex)
146 self.pixStateArr = np.zeros(mapRaster.shape[0:2], dtype=np.uint8)
147 self.gtifW = mapRaster.shape[1]
148 self.gtifH = mapRaster.shape[0]
149 GL.glTexStorage2D(GL.GL_TEXTURE_2D, 2, GL.GL_RGB8UI, self.gtifW, self.gtifH)
150 GL.glTexSubImage2D(GL.GL_TEXTURE_2D, 0, 0, 0, self.gtifW, self.gtifH, GL.GL_BGR_INTEGER, GL.GL_UNSIGNED_BYTE, mapRaster)

------------Error--------------------

Traceback (most recent call last):
  File "geotiffLabelUtil_RS2.py", line 615, in <module>
    wind = MainWindow(data[0], data[1], sys.argv[1], sys.argv[1]+".csv")
  File "geotiffLabelUtil_RS2.py", line 144, in __init__
    GL.glActiveTexture(GL.GL_TEXTURE0)
  File "C:\Users\xxx\Miniconda3\envs\py36\lib\site-packages\OpenGL\platform\baseplatform.py", line 407, in __call__
    self.__name__, self.__name__,
OpenGL.error.NullFunctionError: Attempt to call an undefined function glActiveTexture, check for bool(glActiveTexture) before calling

Tags: inpyself错误linecallfileopengl