我正在处理的代码(Python + PyOpenGL)运行时没有问题:
但是当我尝试在集成GPU上运行代码时它会返回错误:
OpenGL版本不同......任何人都可以知道具体是什么导致错误并且可以(以及如何)修复它?
错误:
File "C:\...\visualization_engine_V6.py", line 120, in initializeGL
self.geometry()
File "C:\...\visualization_engine_V6.py", line 167, in geometry
glEnable(GL_VERTEX_ARRAY)
File "errorchecker.pyx", line 50, in OpenGL_accelerate.errorchecker._ErrorChecker.glCheckError (src\errorchecker.c:854)
OpenGL.error.GLError: GLError(
err = 1280,
description = 'invalid enumerant',
baseOperation = glEnable,
cArguments = (GL_VERTEX_ARRAY,)
)
Traceback (most recent call last):
File "C:\...\visualization_engine_V6.py", line 156, in paintGL
glBindBuffer(GL_ARRAY_BUFFER, self.vbo_id)
AttributeError: 'OpenGLWidget' object has no attribute 'vbo_id'
代码:
glEnableClientState(GL_VERTEX_ARRAY)
glEnable(GL_VERTEX_ARRAY)
# generate a new VBO and get the associated vbo_id
_id = 1
self.vbo_id = glGenBuffers (_id)
# bind VBO in order to use
glBindBuffer(GL_ARRAY_BUFFER, self.vbo_id)
# upload data to VBO
vertices = model_loader.Model_loader(filename = "udarni_vzvod.stl").vertices
self.N_vertices = len(vertices)
# data size in bytes
self.dataSize = arrays.ArrayDatatype.arrayByteCount(vertices)
glBufferData(GL_ARRAY_BUFFER, self.dataSize, vertices, GL_STATIC_DRAW)
glBindBuffer(GL_ARRAY_BUFFER, self.vbo_id)
glDisableClientState(GL_VERTEX_ARRAY)
答案 0 :(得分:1)
glEnable(GL_VERTEX_ARRAY)
GL_INVALID_ENUM
这会回答你的问题吗?