好的,我之前对此发表过一次,但是我遇到的问题与最初的困境有所不同。 我有一个变量
current_color
从颜色转换的
即:绿色
转换为向量
即:(0,128,0)
so current_color =(0,128,0)(此变量每四分之一秒更改一次)
所以我有一个立方体,我希望它在变量
时改变颜色current_color
更改。
这是我的多维数据集的样子:
def Cube():
glBegin(GL_QUADS)
for surface in surfaces:
x = 0
for vertex in surface:
x += 1
glColor3fv(current_color[x])
glVertex3fv(verticies[vertex])
glEnd()
每当我运行程序时,我都会得到这个:
Process Process-1:
Traceback (most recent call last):
File "C:\Users\Bootyman\AppData\Local\Programs\Python\Python36-32\lib\multiprocessing\process.py", line 258, in _bootstrap
self.run()
File "C:\Users\Bootyman\AppData\Local\Programs\Python\Python36-32\lib\multiprocessing\process.py", line 93, in run
self._target(*self._args, **self._kwargs)
File "C:\Users\Bootyman\PycharmProjects\vvis\seperateenvtest.py", line 94, in vvis_graphics
Cube()
File "C:\Users\Bootyman\PycharmProjects\vvis\seperateenvtest.py", line 66, in Cube
**glColor3fv(current_color[x])
IndexError: string index out of range**
据我所知,glColor3fv用于存储在矢量中的浮点数,您知道我在做什么错吗?