PageRenderTime 7ms CodeModel.GetById 2ms app.highlight 1ms RepoModel.GetById 1ms app.codeStats 1ms

/tutorial/vision/opengl/NeHe/lesson04/square.e

http://github.com/tybor/Liberty
Specman e | 43 lines | 35 code | 7 blank | 1 comment | 0 complexity | 0579fbde2dd806d0899ca5da5b499587 MD5 | raw file
 1class SQUARE
 2
 3inherit
 4	GL_OBJECT
 5		redefine draw
 6		end
 7
 8creation
 9	make_with_position
10
11feature{ANY}
12	build is
13		do
14		end
15
16	draw is
17		local
18			color: GL_COLOR
19		do
20			gl.disable(gl.const_cull_face)
21			create color.set_color(0.5, 0.5, 1, 1)
22			smart_gl.rotate(angle, 1, 0, 0)
23			smart_gl.begin_quads
24			color.render
25			smart_gl.vertex(-1, 1, 0)
26			smart_gl.vertex(-1, -1, 0)
27			smart_gl.vertex(1, -1, 0)
28			smart_gl.vertex(1, 1, 0)
29			smart_gl.end_primitive
30		end
31		
32	anim (widget: GL_WIDGET): BOOLEAN is
33		do
34			angle := angle - 1.5
35			widget.display_gl
36			--post_redisplay
37			Result := True
38		end
39
40feature{}
41	angle: REAL
42
43end