summaryrefslogtreecommitdiff
path: root/Userland/Libraries/LibWeb/WebGL/WebGLRenderingContext.h
diff options
context:
space:
mode:
authorLuke Wilde <lukew@serenityos.org>2022-06-04 04:22:42 +0100
committerLinus Groh <mail@linusgroh.de>2022-06-13 21:45:27 +0100
commit58f882200cfaa6f666876f728e1dd82a2352dfe3 (patch)
treeff8ce2ead18a2e63fe51a971860bb9078ce42016 /Userland/Libraries/LibWeb/WebGL/WebGLRenderingContext.h
parentb0c2aee2e4d7e38913259a2fb6fc024db9a12718 (diff)
downloadserenity-58f882200cfaa6f666876f728e1dd82a2352dfe3.zip
LibWeb: Add the ability to retrieve a WebGL context from getContext
Diffstat (limited to 'Userland/Libraries/LibWeb/WebGL/WebGLRenderingContext.h')
-rw-r--r--Userland/Libraries/LibWeb/WebGL/WebGLRenderingContext.h31
1 files changed, 31 insertions, 0 deletions
diff --git a/Userland/Libraries/LibWeb/WebGL/WebGLRenderingContext.h b/Userland/Libraries/LibWeb/WebGL/WebGLRenderingContext.h
new file mode 100644
index 0000000000..7798009798
--- /dev/null
+++ b/Userland/Libraries/LibWeb/WebGL/WebGLRenderingContext.h
@@ -0,0 +1,31 @@
+/*
+ * Copyright (c) 2022, Luke Wilde <lukew@serenityos.org>
+ *
+ * SPDX-License-Identifier: BSD-2-Clause
+ */
+
+#pragma once
+
+#include <LibWeb/Bindings/Wrappable.h>
+#include <LibWeb/WebGL/WebGLRenderingContextBase.h>
+
+namespace Web::WebGL {
+
+class WebGLRenderingContext
+ : public WebGLRenderingContextBase
+ , public Bindings::Wrappable {
+public:
+ using WrapperType = Bindings::WebGLRenderingContextWrapper;
+
+ static JS::ThrowCompletionOr<RefPtr<WebGLRenderingContext>> create(HTML::HTMLCanvasElement& canvas_element, JS::Value options);
+
+ virtual ~WebGLRenderingContext() override = default;
+
+private:
+ WebGLRenderingContext(HTML::HTMLCanvasElement& canvas_element, NonnullOwnPtr<GL::GLContext> context, WebGLContextAttributes context_creation_parameters, WebGLContextAttributes actual_context_parameters)
+ : WebGLRenderingContextBase(canvas_element, move(context), move(context_creation_parameters), move(actual_context_parameters))
+ {
+ }
+};
+
+}