我刚刚安装了PyOpenGL并继续练习this tutorial。它从这个创建窗口的简单代码开始:
from OpenGL.GL import *
from OpenGL.GLUT import *
from OpenGL.GLU import *
window = 0 # glut window number
width, height = 500, 400 # window size
def draw(): # ondraw is called all the time
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT) # clear the screen
glLoadIdentity() # reset position
# ToDo draw rectangle
glutSwapBuffers() # important for double buffering
# initialization
glutInit() # initialize glut
glutInitDisplayMode(GLUT_RGBA | GLUT_DOUBLE | GLUT_ALPHA | GLUT_DEPTH)
glutInitWindowSize(width, height) # set window size
glutInitWindowPosition(0, 0) # set window position
window = glutCreateWindow("noobtuts.com") # create window with title
glutDisplayFunc(draw) # set draw function callback
glutIdleFunc(draw) # draw all the time
glutMainLoop()
但是当我尝试运行它时,我得到了这组错误:
An error ocurred while starting the kernel
libGL error: unable to load driver: nouveau_dri.so
libGL error: driver pointer missing
libGL error: failed to load driver: nouveau
libGL error: unable to load driver: swrast_dri.so
libGL error: failed to load driver: swrast
X Error of failed request: GLXBadContext
Major opcode of failed request: 155 (GLX)
Minor opcode of failed request: 6 (X_GLXIsDirect)
Serial number of failed request: 43
Current serial number in output stream: 42
X Error of failed request: BadValue (integer parameter out of range for operation)
Major opcode of failed request: 155 (GLX)
Minor opcode of failed request: 24 (X_GLXCreateNewContext)
Value in failed request: 0x0
Serial number of failed request: 42
Current serial number in output stream: 43
有人可以指导我们的意思或如何解决这些问题吗?
互联网上有一些关于这个问题的讨论,但我还没有找到一个有强大解决方案的讨论。我顺便使用Ubuntu 16。感谢
答案 0 :(得分:0)
看来你已经安装了一些专有驱动程序,然后事情就破了。您应该卸载新安装的NVDIA驱动程序并重新安装。然后在主窗口上转到搜索应用程序并在该窗口中键入其他驱动程序选择您安装的驱动程序。
如果这没有帮助,而您没有安装任何其他驱动程序,请在终端上输入以下命令,看看您是否有此文件
“”找到nouveau_dri.so
如果找不到安装它,那就应该修复错误。