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()