1
1

vao.d 820 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. // Written in the D programming language.
  2. /**
  3. Copyright: Copyright Felix 'Zoadian' Hufnagel 2014-.
  4. License: $(WEB boost.org/LICENSE_1_0.txt, Boost License 1.0).
  5. Authors: $(WEB zoadian.de, Felix 'Zoadian' Hufnagel)
  6. */
  7. module aurora.gl.vao;
  8. import derelict.opengl3.gl3;
  9. import aurora.gl.util;
  10. //==============================================================================
  11. ///
  12. final class VertexArrayObject {
  13. private:
  14. uint _id;
  15. public:
  16. ///
  17. this() {
  18. check!glGenVertexArrays(1, &this._id);
  19. }
  20. ///
  21. ~this() {
  22. check!glDeleteVertexArrays(1, &this._id);
  23. }
  24. public:
  25. ///
  26. void bind() {
  27. check!glBindVertexArray(this._id);
  28. }
  29. ///
  30. static void unbind() {
  31. check!glBindVertexArray(0);
  32. }
  33. public:
  34. ///
  35. @property bool isValid() const @safe nothrow {
  36. return (this._id > 0);
  37. }
  38. }