1 from OpenGL.GL import *
2 from cube_object import load_texture, use_texture
3
4 -class Text_Image(object):
5 - def __init__(self, filename, x=0.,y=0., height=1.,width=1.):
6 texid = load_texture(filename)
7 hh=height/2.
8 hw=width/2.
9 list_id=glGenLists(1)
10 glNewList(list_id, GL_COMPILE)
11 use_texture(texid)
12 glBegin(GL_QUADS)
13 glTexCoord2f(0.0, 0.0); glVertex3f(x-hw, y-hh, 0)
14 glTexCoord2f(1.0, 0.0); glVertex3f(x+hw, y-hh, 0)
15 glTexCoord2f(1.0, 1.0); glVertex3f(x+hw, y+hh, 0)
16 glTexCoord2f(0.0, 1.0); glVertex3f(x-hw, y+hh, 0)
17 glEnd()
18 glEndList()
19 self.list_id = list_id
20
21
22 - def draw(self,x_angle,y_angle,view_distance):
23
24 glLoadIdentity()
25 glTranslatef(0.0, 0.0, -view_distance/2.)
26
27 glScalef(5.0,3.0,5.0)
28 glCallList(self.list_id)
29