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

http://github.com/tybor/Liberty · Specman e · 31 lines · 25 code · 5 blank · 1 comment · 0 complexity · 43df687619ce3f79f3764dae2446b77e 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. -- In SMART_GL, all colors are given with 4 values (including alpha value)
  17. create color.set_color(0.5, 0.5, 1, 1)
  18. smart_gl.begin_quads
  19. color.render
  20. smart_gl.vertex(-1, 1, 0)
  21. smart_gl.vertex(-1, -1, 0)
  22. smart_gl.vertex(1, -1, 0)
  23. smart_gl.vertex(1, 1, 0)
  24. smart_gl.end_primitive
  25. end
  26. end