WebGLObject.h 935 B

12345678910111213141516171819202122232425262728293031323334353637383940
  1. /*
  2. * Copyright (c) 2024, Jelle Raaijmakers <jelle@ladybird.org>
  3. * Copyright (c) 2024, Aliaksandr Kalenik <kalenik.aliaksandr@gmail.com>
  4. * Copyright (c) 2024, Luke Wilde <luke@ladybird.org>
  5. *
  6. * SPDX-License-Identifier: BSD-2-Clause
  7. */
  8. #pragma once
  9. #include <LibWeb/Bindings/PlatformObject.h>
  10. #include <LibWeb/WebGL/Types.h>
  11. namespace Web::WebGL {
  12. class WebGLObject : public Bindings::PlatformObject {
  13. WEB_PLATFORM_OBJECT(WebGLObject, Bindings::PlatformObject);
  14. public:
  15. virtual ~WebGLObject();
  16. String label() const { return m_label; }
  17. void set_label(String const& label) { m_label = label; }
  18. GLuint handle() const { return m_handle; }
  19. protected:
  20. explicit WebGLObject(JS::Realm&, GLuint handle);
  21. virtual void initialize(JS::Realm&) override;
  22. bool invalidated() const { return m_invalidated; }
  23. private:
  24. bool m_invalidated { false };
  25. String m_label;
  26. GLuint m_handle { 0 };
  27. };
  28. }