/tutorial/vision/opengl/NeHe/lesson05/pyramid.e

http://github.com/tybor/Liberty · Specman e · 60 lines · 50 code · 10 blank · 0 comment · 0 complexity · 253f09c8316527794e0048d13c8c9301 MD5 · raw file

  1. class PYRAMID
  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. do
  14. smart_gl.rotate(angle, 0, 1, 0)
  15. smart_gl.begin_triangles
  16. full_red.render
  17. smart_gl.vertex(0, 1, 0)
  18. full_green.render
  19. smart_gl.vertex(-1, -1, 1)
  20. full_blue.render
  21. smart_gl.vertex(1, -1, 1)
  22. full_red.render
  23. smart_gl.vertex(0, 1, 0)
  24. full_blue.render
  25. smart_gl.vertex(1, -1, 1)
  26. full_green.render
  27. smart_gl.vertex(1, -1, -1)
  28. full_red.render
  29. smart_gl.vertex(0, 1, 0)
  30. full_green.render
  31. smart_gl.vertex(1, -1, -1)
  32. full_blue.render
  33. smart_gl.vertex(-1, -1, -1)
  34. full_red.render
  35. smart_gl.vertex(0, 1, 0)
  36. full_blue.render
  37. smart_gl.vertex(-1, -1, -1)
  38. full_green.render
  39. smart_gl.vertex(-1, -1, 1)
  40. smart_gl.end_primitive
  41. end
  42. anim (widget: GL_WIDGET): BOOLEAN is
  43. do
  44. angle := angle + 2
  45. widget.display_gl
  46. Result := True
  47. end
  48. feature{}
  49. angle: REAL
  50. end