NameError: 全局名称 'glGenVertexArrays' 未定义
我正在使用OpenGL 3.0版本,当我尝试以下代码:
vao = glGenVertexArrays(1)
我得到了这个错误:
NameError: global name 'glGenVertexArrays' is not defined
有人知道这是为什么吗?
这是我导入的内容:
import OpenGL
from OpenGL.GLU import *
from OpenGL.GL import *
from OpenGL.arrays import vbo
from OpenGLContext.arrays import *
self.vao = glGenVertexArrays(1)
另外,当我运行以下代码:
dir(OpenGL.GL)
在输出中我找不到这个函数:glGenVertexArrays
1 个回答
1
假设你做了这个:
import pyopengl
那么你可能想要做一些类似这样的事情
vao = pyopengl.glGenVertexArrays(1)
来真正使用这个函数。
不过,我觉得 glGenVertexArrays
需要 2 个参数,所以你可能还需要解决这个问题……