Пустой белый экран PygamePython

Программы на Python
Anonymous
Пустой белый экран Pygame

Сообщение Anonymous »

Я пытаюсь смоделировать стол для настольного тенниса. Когда я запускаю код, PyCharm показывает только белый экран в окне Pygame, а Python не выдает никаких ошибок. Что я сделал не так?
import pygame
from pygame.locals import *
from OpenGL.GL import *
from OpenGL.GLU import *

verts = (
(-1,-1,-1),
(-1,-1,1),
(-1,1,-1),
(-1,1,1),
(1,-1,-1),
(1,-1,1),
(1,1,-1),
(1,1,1)
)
edges = (
(0,1),
(0,2),
(0,3),
(0,4),
(2,1),
(2,3),
(2,7),
(6,3),
(6,4),
(6,7),
(5,1),
(5,4),
(5,7)
)
areas = (
(0,1,2,3),
(3,2,7,6),
(4,5,1,0),
(1,5,7,2),
(4,0,3,6)
)

def table():
glBegin(GL_QUADS)

for surf in areas:
glColor3fv((0,0,255))
for vert in surf:
glVertex3fv(verts[vert])
glEnd()

def main():
pygame.init()
display = (1000,800)
screen = pygame.display.set_mode(display,DOUBLEBUF|OPENGL)
gluPerspective(45,(display[0]/display[1]), 0.1,50.0)
glTranslatef(-20,-10,-50)
while True:
for event in pygame.event.get():
if event.type == pygame.QUIT:
pygame.quit()
quit()
glRotatef(0,0,0,0)
glClear(GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT)
table()
pygame.display.flip()
pygame.time.wait(60)
red = [255,0,0]
screen.fill(red)
display.fill[red]

main()

Вернуться в «Python»