也不会 等他们看看
from OpenGL.GL import*
from OpenGL.GLUT import*
from OpenGL.raw.constants import*
import sys
class OpenGLWinsow:
def __init__(self,width=222,height=444,title='PyOpenGL'):
glutInit(sys.argv)
glutInitDisplayMode(GLUT_RGBA|GLUT_DOUBLE|GLUT_DEPTH)
glutInitWindowSize(width,height)
self.window=glutCreateWindow(title)
glutDisplayFunc(self.Draw)
self.InitGL(width,height)
def Draw(self):
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIRT)
glLoadIdentity()
glutSwapBuffers()
def InitGL(self,width,height):
glClearColor(0.0,0.0,0.0,0.0)
glClearDepth(1.0)
glDepthFunc(GL_LESS)
glEnable(GL_DEPTH_TEST)
glMatrixMode(GL_PROJECTION)
glLoadIdentity()
gluPerspective(45.0,float(width)/float(height),0.1,100.0)
glMatrixMode(GL_MODELVIEW)
def MainLoop(self):
glutMainLoop()
window=OpenGLWindow()
window.MainLoop()