Документ взят из кэша поисковой машины. Адрес оригинального документа : http://kodomo.fbb.msu.ru/hg/allpy/annotate/50633fcbbdc4/sandbox/gl.py
Дата изменения: Unknown
Дата индексирования: Sun Mar 2 07:36:30 2014
Кодировка:
allpy: sandbox/gl.py annotate

allpy

annotate sandbox/gl.py @ 192:50633fcbbdc4

Removed old implementation of geometrical_core. The proper place for obsolete implementations is either in history in the repository, or in separate branches, not in subdirectories within the current branch in the repository.
author Daniil Alexeyevsky <me.dendik@gmail.com>
date Thu, 18 Nov 2010 21:42:16 +0300
parents
children 61e5d8e146c7
rev   line source
dendik@13 1 #!/usr/bin/python
dendik@13 2 # http://disruption.ca/gutil/example3/example3a.html
dendik@13 3 # vim: set noet:
dendik@13 4
dendik@13 5 import gutil
dendik@13 6 import pygame
dendik@13 7 from pygame.locals import *
dendik@13 8 from OpenGL.GL import *
dendik@13 9
dendik@13 10 from Image import Image
dendik@13 11
dendik@13 12
dendik@13 13 def main():
dendik@13 14 pygame.init()
dendik@13 15 gutil.initializeDisplay(800, 600)
dendik@13 16
dendik@13 17 done = False
dendik@13 18
dendik@13 19 cow = Image('cow')
dendik@13 20 alien = Image('alien')
dendik@13 21
dendik@13 22 white = (255,255,255,255)
dendik@13 23 stringTex, w, h, tw, th = gutil.loadText("Cow!", color=white)
dendik@13 24 stringDL = gutil.createTexDL(stringTex, tw, th)
dendik@13 25
dendik@13 26 while not done:
dendik@13 27 glClear(GL_COLOR_BUFFER_BIT)
dendik@13 28 glLoadIdentity()
dendik@13 29 glColor4f(1.0,1.0,1.0,1.0)
dendik@13 30 glTranslatef(100, 400, 0)
dendik@13 31 glCallList(stringDL)
dendik@13 32
dendik@13 33 cow.draw(pos=(100,100),width=128,height=128)
dendik@13 34 alien.draw(pos=(400, 400),rotation=-15,color=(.9,.3,.2,1))
dendik@13 35
dendik@13 36
dendik@13 37 pygame.display.flip()
dendik@13 38
dendik@13 39 eventlist = pygame.event.get()
dendik@13 40 for event in eventlist:
dendik@13 41 if event.type == QUIT \
dendik@13 42 or event.type == KEYDOWN and event.key == K_ESCAPE:
dendik@13 43 done = True
dendik@13 44
dendik@13 45 if __name__ == '__main__':
dendik@13 46 main()