/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

  1. class SQUARE
  2. inherit
  3. GL_OBJECT
  4. redefine draw
  5. end
  6. creation
  7. make_with_position
  8. feature{ANY}
  9. build is
  10. do
  11. end
  12. draw is
  13. local
  14. color: GL_COLOR
  15. do
  16. gl.disable(gl.const_cull_face)
  17. create color.set_color(0.5, 0.5, 1, 1)
  18. smart_gl.rotate(angle, 1, 0, 0)
  19. smart_gl.begin_quads
  20. color.render
  21. smart_gl.vertex(-1, 1, 0)
  22. smart_gl.vertex(-1, -1, 0)
  23. smart_gl.vertex(1, -1, 0)
  24. smart_gl.vertex(1, 1, 0)
  25. smart_gl.end_primitive
  26. end
  27. anim (widget: GL_WIDGET): BOOLEAN is
  28. do
  29. angle := angle - 1.5
  30. widget.display_gl
  31. --post_redisplay
  32. Result := True
  33. end
  34. feature{}
  35. angle: REAL
  36. end