PyOpenGL的安装
pip install PyOpenGL PyOpenGL_accelerate
出现问题
可是下载的是32位版本的而且PyOpenGL_accelerate会安装失败。解决
在https://www.lfd.uci.edu/~gohlke/pythonlibs/#pyopengl中下载opengl对应python版本。
PyOpenGL的第一个例子
from OpenGL.GL import *
from OpenGL.GLU import *
from OpenGL.GLUT import *
def drawFunc():
glClear(GL_COLOR_BUFFER_BIT)
# glRotatef(1, 0, 1, 0)
glutWireTeapot(0.5)
glFlush()
glutInit()
glutInitDisplayMode(GLUT_SINGLE | GLUT_RGBA)
glutInitWindowSize(400, 400)
glutCreateWindow(b"First")
glutDisplayFunc(drawFunc)
# glutIdleFunc(drawFunc)
glutMainLoop()