1、下载glut64.dll,放在C:/windows/System32目录下
2、pip install pyopengl
3、如果可以成功运行以下程序,标志着PyOpenGL环境正确搭建
from OpenGL.GLUTimport *
from OpenGL.GLimport *
from OpenGL.GLUimport *
def drawFunc():
glClear(GL_COLOR_BUFFER_BIT)
# glRotatef(1, 0, 1, 0)
glutWireTeapot(0.5)
glFlush()
glutInit(sys.argv)
glutInitDisplayMode(GLUT_SINGLE | GLUT_RGB)
glutInitWindowSize(250, 250)
glutInitWindowPosition(100, 100)
glutCreateWindow(b"My Second OGL Program")
glutDisplayFunc(drawFunc)
glutMainLoop()
网友评论