View Code
1 import pygame$
2 from OpenGL.GL import *$
3 $
4 def initGL():$
5 glClearColor(0.0, 0.0, 0.0, 0.0)$
6 $
7 def resizeGL((w, h)):$
8 glViewport(0, 0, w, h)$
9 $
10 def paintGL():$
11 glClear(GL_COLOR_BUFFER_BIT)$
12 glBegin(GL_TRIANGLES)$
13 # vertices here$
14 $
15 pygame.init()$
16 pygame.display.set_mode((640,480), pygame.OPENGL)$
17 initGL()$
18 resizeGL((640,480))$
19 paintGL()$