pyopengl 學習日誌(1)--配置環境

install python

python download

install pip

pip download


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

useful links

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章