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

http://github.com/tybor/Liberty · Specman e · 41 lines · 33 code · 7 blank · 1 comment · 0 complexity · a77f3912fd0b5c4433f5e8706c9040a0 MD5 · raw file

  1. class TRIANGLE
  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. gl.disable(gl.const_cull_face)
  15. smart_gl.rotate(angle, 0, 1, 0)
  16. smart_gl.begin_triangles
  17. full_red.render
  18. smart_gl.vertex(0, 1, 0)
  19. full_green.render
  20. smart_gl.vertex(-1, -1, 0)
  21. full_blue.render
  22. smart_gl.vertex(1, -1, 0)
  23. smart_gl.end_primitive
  24. end
  25. anim (widget: GL_WIDGET): BOOLEAN is
  26. do
  27. angle := angle + 2
  28. widget.display_gl
  29. --post_redisplay
  30. Result := True
  31. end
  32. feature{}
  33. angle: REAL
  34. end