renderbuffer.d 861 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. // Written in the D programming language.
  2. /**
  3. Copyright: Copyright Felix 'Zoadian' Hufnagel 2014-.
  4. License: $(WEB http://www.gnu.org/licenses/lgpl.html, LGPLv3).
  5. Authors: $(WEB zoadian.de, Felix 'Zoadian' Hufnagel)
  6. */
  7. module three.gl.renderbuffer;
  8. import derelict.opengl3.gl3;
  9. import three.gl.util;
  10. //==============================================================================
  11. ///
  12. final class Renderbuffer {
  13. private:
  14. GLuint _id;
  15. public:
  16. ///
  17. this() {
  18. check!glGenRenderbuffers(1, &this._id);
  19. }
  20. ///
  21. ~this() {
  22. check!glDeleteRenderbuffers(1, &this._id);
  23. }
  24. public:
  25. ///
  26. void bind() {
  27. check!glBindRenderbuffer(GL_RENDERBUFFER, this._id);
  28. }
  29. ///
  30. static void unbind(){
  31. check!glBindRenderbuffer(GL_RENDERBUFFER, 0);
  32. }
  33. public:
  34. ///
  35. @property bool isValid() const @safe nothrow {
  36. return (this._id > 0);
  37. }
  38. }