/tutorial/vision/opengl/example2.e
Specman e | 59 lines | 45 code | 14 blank | 0 comment | 0 complexity | d7ee79726a4bd2b46e1da7f81ee6f5c3 MD5 | raw file
1class EXAMPLE2 2 3inherit 4 GRAPHIC 5 6creation 7 make 8 9feature{ANY} 10 11 world : WORLD 12 pyramid : PYRAMID 13 14 world2 : WORLD 15 cube : CUBE 16 17 rot : REAL 18 19 make is 20 local 21 win: TOPLEVEL_WINDOW 22 exit : BUTTON 23 do 24 create win.default_create 25 win.set_title("GL Test") 26 win.set_background_color(white_color) 27 win.map 28 29 create world.make(win) 30 create pyramid.make_with_position(0, 0, -6) 31 world.add_opaque_object(pyramid) 32 33 create world2.make(win) 34 create cube.make_with_position(0, 0, -6) 35 world2.add_opaque_object(cube) 36 37 create exit.with_label(win, U"Click: Exit | Move: Turn") 38 exit.when_pointer_move(agent turn) 39 exit.when_left_clicked(agent finish_program) 40 41 win.when_close_requested(agent finish_program) 42 43 vision.start 44 end 45 46 turn is 47 do 48 rot := rot + 2 49 pyramid.turn(rot, -3*rot) 50 world.display_gl 51 cube.turn(-2*rot, rot) 52 world2.display_gl 53 end 54 55 finish_program is 56 do 57 vision.loop_stack.break 58 end 59end