Point.cs 1009 B

12345678910111213141516171819202122232425262728293031323334
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Drawing;
  4. using System.Linq;
  5. using System.Text;
  6. using System.Threading.Tasks;
  7. using OpenTK.Graphics.OpenGL;
  8. namespace bbiwarg.Graphics
  9. {
  10. class Point : IGraphicElement
  11. {
  12. private Vertex position;
  13. private Color color;
  14. private float size;
  15. public Point(Vertex position, Color color, float size) {
  16. this.position = position;
  17. this.color = color;
  18. this.size = size;
  19. }
  20. public void draw() {
  21. GL.Color4(color);
  22. GL.Begin(BeginMode.Polygon);
  23. GL.Vertex3(position.getX() - size, position.getY() + size, -position.getZ());
  24. GL.Vertex3(position.getX() + size, position.getY() + size, -position.getZ());
  25. GL.Vertex3(position.getX() + size, position.getY() - size, -position.getZ());
  26. GL.Vertex3(position.getX() - size, position.getY() - size, -position.getZ());
  27. GL.End();
  28. }
  29. }
  30. }