Advertisement
thenewboston

[source code] Pygame (Python Game Development) Tutorial 94

Nov 15th, 2014
162
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.73 KB | None | 0 0
  1. import pygame
  2. from pygame.locals import *
  3.  
  4. from OpenGL.GL import *
  5. from OpenGL.GLU import *
  6.  
  7. verticies = (
  8.     (1, -1, -1),
  9.     (1, 1, -1),
  10.     (-1, 1, -1),
  11.     (-1, -1, -1),
  12.     (1, -1, 1),
  13.     (1, 1, 1),
  14.     (-1, -1, 1),
  15.     (-1, 1, 1),
  16.     )
  17.  
  18. edge = (
  19.     (0,1),
  20.     (0,3),
  21.     (0,4),
  22.     (2,1),
  23.     (2,3),
  24.     (2,7),
  25.     (6,3),
  26.     (6,4),
  27.     (6,7),
  28.     (5,1),
  29.     (5,4),
  30.     (5,7),
  31.     )
  32.  
  33.  
  34.  
  35. def Draw_Cube():
  36.     glBegin(GL_LINES)
  37.     for edge in edges:
  38.         for vertex in edge:
  39.             glVertex3fv(verticies[vert])
  40.     glEnd()
  41.  
  42.  
  43. def main():
  44.     pygame.init()
  45.     display = (800,600)
  46.  
  47.     pygame.display.set_mode(display, DOUBLEBUF|OPENGL)
  48.  
  49.     gluPerspective(45.0, (display[0]/display[1]), 1, 50.0)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement