【发布时间】:2017-01-22 21:02:42
【问题描述】:
这是我的源代码https://paste.fedoraproject.org/428184/89404314/
我得到的错误是这样的:
C:\Python27>python.exe wx_gl_vbo_001.py
Traceback (most recent call last):
File "wx_gl_vbo_001.py", line 63, in <module>
MyApp(redirect = False).MainLoop()
File "C:\Python27\lib\site-packages\wx-3.0-msw\wx\_core.py", line 8628, in __init__
self._BootstrapApp()
File "C:\Python27\lib\site-packages\wx-3.0-msw\wx\_core.py", line 8196, in _BootstrapApp
return _core_.PyApp__BootstrapApp(*args, **kwargs)
File "wx_gl_vbo_001.py", line 60, in OnInit
canvas = MyCanvas(frame)
File "wx_gl_vbo_001.py", line 16, in __init__
}""", GL_VERTEX_SHADER)
File "C:\Python27\lib\site-packages\OpenGL\latebind.py", line 44, in __call__
self._finalCall = self.finalise()
File "C:\Python27\lib\site-packages\OpenGL\extensions.py", line 245, in finalise
self.__name__,
OpenGL.error.NullFunctionError: Attempt to call an undefined alternate function (glCompileShader, glCompileShaderARB), check for bool(glCompileShader) before calling
dir(shaders) 自带这个功能:
'compileProgram', 'compileShader', 'found', 'fragment_shader', 'geometry_shader4', 'get_program_binary', 'glAttachShader', 'glBindAttribLocation', 'glCompileShader', 'glCreateProgram', 'glCreateShader',
【问题讨论】:
-
还没有深入查看您的代码,但您似乎调用的是 shaders.CompileShader 而不是 shaders.compileShader。此外,看起来您编写的着色器实际上是 120 版着色器,因此请尝试切换着色器版本。据我所知,像 gl_ModelViewProjectionMatrix 这样的变量在现代版本的 OpenGL 中不再存在!
-
PyPI 和二进制文件出现了一些问题我遇到了另一个错误:尝试调用未定义的函数 glutInit,在调用之前检查 bool(glutInit)
标签: python-2.7 wxpython shader pyopengl