install python
install pip
$ python setup.py install
install pyOpengl
$ pip install PyOpenGL PyOpenGL_accelerate
install numpy
提供常用的科学计算包含矩阵运算,数组转换与序列化
$ pip install numpy
install PIL
3D常用的图片处理库
$ pip install PIL --allow-external PIL --allow-unverified PIL
简单测试代码
import OpenGL.GL as gl
import OpenGL.GLUT as glut
def display():
glut.glutSwapBuffers()
def reshape(width,height):
gl.glViewport(0, 0, width, height)
def keyboard( key, x, y ):
if key == '\033':
sys.exit( )
glut.glutInit()
glut.glutInitDisplayMode(glut.GLUT_DOUBLE | glut.GLUT_RGBA)
glut.glutCreateWindow('Hello world!')
glut.glutReshapeWindow(512,512)
glut.glutReshapeFunc(reshape)
glut.glutDisplayFunc(display)
glut.glutKeyboardFunc(keyboard)
glut.glutMainLoop()