glutInitDisplayMode导致分段错误

时间:2011-10-29 11:54:38

标签: segmentation-fault glut pyopengl

我正在尝试执行我的第一个pyopengl程序,但在调用glutInitDisplayMode函数时遇到了一些问题。这是我做的:

blackbear@blackbear-laptop:~/Programmazione/python$ python
Python 2.6.5 (r265:79063, Apr 16 2010, 13:09:56) 
[GCC 4.4.3] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> from OpenGL.GL import *
>>> from OpenGL.GLU import *
>>> from OpenGL.GLUT import *
>>> import sys
>>> def main():
...     glClear(GL_COLOR_BUFFER_BIT)
...     glutWireTeapot(0.5)
...     glFlush()
... 
>>> glutInit(sys.argv)
['']
>>> glutInitDisplayMode(GLUT_SINGLE | GLUT_RGB)
Segmentation fault
blackbear@blackbear-laptop:~/Programmazione/python$ 

应该不会那么困难,但仍然会给我带来麻烦;)

1 个答案:

答案 0 :(得分:1)

实际上解决方案非常简单,在glutCreateWindow解决问题之前调用glutInitDisplayMode