Advertisement
RockField64

DrawingASquare

Oct 18th, 2022
1,074
1
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.83 KB | Source Code | 1 0
  1. import pygame
  2. from pygame.locals import *
  3. from OpenGL.GL import *
  4. from OpenGL.GLU import *
  5.  
  6.  
  7. pygame.init()
  8. display = (800, 600)
  9. pygame.display.set_mode(display, DOUBLEBUF|OPENGL)
  10.  
  11. pygame.display.set_caption("03 Lab 1 Wrichmond Well A. Chua")
  12. gluPerspective(45, (display[0]/display[1]), 1, 10)
  13. glTranslatef(0, 0, -5)
  14.  
  15. while True:
  16.     for event in pygame.event.get():
  17.         if event.type==pygame.QUIT:
  18.             pygame.quit()
  19.             quit()
  20.         glClear(GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT)
  21.         glBegin(GL_LINES)
  22.         glVertex3f(-0.5, 0.5, 0.5)
  23.         glVertex3f(-0.5, -0.5, 0.5)
  24.         glVertex3f(0.5, -0.5, 0.5)
  25.         glVertex3f(0.5, 0.5, 0.5)
  26.         glVertex3f(0.5,0.5,0.5)
  27.         glVertex3f(-0.5, 0.5, 0.5)
  28.  
  29.         glEnd()
  30.  
  31.         pygame.display.flip()
  32.         pygame.time.wait(15)
  33.  
  34.  
  35.  
  36.  
  37.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement