Документ взят из кэша поисковой машины. Адрес оригинального документа : http://kodomo.fbb.msu.ru/hg/allpy/diff/e3ba4c63e622/sandbox/gl.py
Дата изменения: Unknown
Дата индексирования: Sun Feb 3 20:17:11 2013
Кодировка:
allpy: sandbox/gl.py diff

allpy

diff sandbox/gl.py @ 13:e3ba4c63e622

In sandbox: Some not-really-working stuff (on topic of text rendering)
author Danya Alexeyevsky <dendik@kodomo.fbb.msu.ru>
date Thu, 10 Jun 2010 20:28:29 +0400
parents
children 61e5d8e146c7
line diff
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/sandbox/gl.py	Thu Jun 10 20:28:29 2010 +0400
     1.3 @@ -0,0 +1,46 @@
     1.4 +#!/usr/bin/python
     1.5 +# http://disruption.ca/gutil/example3/example3a.html
     1.6 +# vim: set noet:
     1.7 +
     1.8 +import gutil
     1.9 +import pygame
    1.10 +from pygame.locals import *
    1.11 +from OpenGL.GL import *
    1.12 +
    1.13 +from Image import Image
    1.14 +
    1.15 +
    1.16 +def main():
    1.17 +	pygame.init()
    1.18 +	gutil.initializeDisplay(800, 600)
    1.19 +
    1.20 +	done = False
    1.21 +
    1.22 +	cow = Image('cow')
    1.23 +	alien = Image('alien')
    1.24 +
    1.25 +	white = (255,255,255,255)
    1.26 +	stringTex, w, h, tw, th = gutil.loadText("Cow!", color=white)
    1.27 +	stringDL = gutil.createTexDL(stringTex, tw, th)
    1.28 +
    1.29 +	while not done:
    1.30 +		glClear(GL_COLOR_BUFFER_BIT)
    1.31 +		glLoadIdentity()
    1.32 +		glColor4f(1.0,1.0,1.0,1.0)
    1.33 +		glTranslatef(100, 400, 0)
    1.34 +		glCallList(stringDL)
    1.35 +
    1.36 +		cow.draw(pos=(100,100),width=128,height=128)
    1.37 +		alien.draw(pos=(400, 400),rotation=-15,color=(.9,.3,.2,1))
    1.38 +
    1.39 +
    1.40 +		pygame.display.flip()
    1.41 +
    1.42 +		eventlist = pygame.event.get()
    1.43 +		for event in eventlist:
    1.44 +			if event.type == QUIT \
    1.45 +			   or event.type == KEYDOWN and event.key == K_ESCAPE:
    1.46 +				done = True
    1.47 +
    1.48 +if __name__ == '__main__':
    1.49 +	main()