运行python OpenGL演示时GLX请求失败

时间:2018-01-07 09:00:34

标签: python opengl

我正在测试一个python OpenGL demo

import pg

class Window(pg.Window):
    def setup(self):
        self.wasd = pg.WASD(self)
        self.wasd.look_at((0, 0, 2), (0, 0, 0))
        self.program = pg.DirectionalLightProgram()
        self.context = pg.Context(self.program)
        sphere = pg.Sphere(3, 0.5, (0, 0, 0))
        self.context.position = pg.VertexBuffer(sphere.positions)
        self.context.normal = pg.VertexBuffer(sphere.normals)
    def update(self, t, dt):
        matrix = self.wasd.get_matrix()
        matrix = matrix.perspective(65, self.aspect, 0.1, 100)
        self.context.matrix = matrix
        self.context.camera_position = self.wasd.position
    def draw(self):
        self.clear()
        self.context.draw(pg.GL_TRIANGLES)

if __name__ == "__main__":
    pg.run(Window)

它因错误而崩溃:

 X Error of failed request:  BadRequest (invalid request code or no such operation)
  Major opcode of failed request:  155 (GLX)
  Minor opcode of failed request:  168 ()
  Serial number of failed request:  114
  Current serial number in output stream:  114

我的glxgears工作正常,glxinfo显示

name of display: :0
display: :0  screen: 0
direct rendering: No (If you want to find out why, try setting LIBGL_DEBUG=verbose)
server glx vendor string: SGI
server glx version string: 1.4
...

我已设置export LIBGL_DEBUG=verbose,但仍会显示相同的结果。我不知道直接渲染是否设置为“否”会导致错误发生。任何人都可以提示吗?

0 个答案:

没有答案