diff Framework/OpenGL/WebAssemblyOpenGLContext.h @ 616:97926984d5d0

WebAssembly sample using Scene2D
author Sebastien Jodogne <s.jodogne@gmail.com>
date Thu, 02 May 2019 13:27:41 +0200
parents
children 7efa2543699d
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Framework/OpenGL/WebAssemblyOpenGLContext.h	Thu May 02 13:27:41 2019 +0200
@@ -0,0 +1,60 @@
+/**
+ * Stone of Orthanc
+ * Copyright (C) 2012-2016 Sebastien Jodogne, Medical Physics
+ * Department, University Hospital of Liege, Belgium
+ * Copyright (C) 2017-2019 Osimis S.A., Belgium
+ *
+ * This program is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU Affero General Public License
+ * as published by the Free Software Foundation, either version 3 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Affero General Public License for more details.
+ * 
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ **/
+
+
+#pragma once
+
+#if !defined(ORTHANC_ENABLE_WASM)
+#  error Macro ORTHANC_ENABLE_WASM must be defined
+#endif
+
+#if ORTHANC_ENABLE_WASM == 1
+
+#include "IOpenGLContext.h"
+
+#include <boost/shared_ptr.hpp>
+
+namespace OrthancStone
+{
+  namespace OpenGL
+  {
+    class WebAssemblyOpenGLContext : public OpenGL::IOpenGLContext
+    {
+    private:
+      class PImpl;
+      boost::shared_ptr<PImpl>  pimpl_;
+
+    public:
+      WebAssemblyOpenGLContext(const std::string& canvas);
+
+      virtual void MakeCurrent();
+
+      virtual void SwapBuffer();
+
+      virtual unsigned int GetCanvasWidth() const;
+
+      virtual unsigned int GetCanvasHeight() const;
+
+      void UpdateSize();
+    };
+  }
+}
+
+#endif