diff options
| author | Matthew Kosarek <mattkae@protonmail.com> | 2021-03-27 11:49:56 -0400 |
|---|---|---|
| committer | Matthew Kosarek <mattkae@protonmail.com> | 2021-03-27 11:49:56 -0400 |
| commit | 58488f8eabcc61089e0ae4297f38f10cc28d78c7 (patch) | |
| tree | 81ac504e61c57c7228024ad40710f782a3d8c884 /frontend/shared_cpp/WebglContext.h | |
| parent | 26ea81c5893778a7fa4ecbb2e8f561c9edabd0b3 (diff) | |
Working reusable simulation loop
Diffstat (limited to 'frontend/shared_cpp/WebglContext.h')
| -rw-r--r-- | frontend/shared_cpp/WebglContext.h | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/frontend/shared_cpp/WebglContext.h b/frontend/shared_cpp/WebglContext.h index c8a9480..1ea1c91 100644 --- a/frontend/shared_cpp/WebglContext.h +++ b/frontend/shared_cpp/WebglContext.h @@ -1,10 +1,13 @@ #pragma once +#include "types.h" #include <emscripten.h> #include <emscripten/html5.h> #include <GLES2/gl2.h> #include <EGL/egl.h> struct WebglContext { + EMSCRIPTEN_WEBGL_CONTEXT_HANDLE context; + void init(const char* query, int width = 640, int height = 480) { emscripten_set_canvas_element_size( query, width, height); @@ -17,6 +20,9 @@ struct WebglContext { context = emscripten_webgl_create_context(query, &attrs); makeCurrentContext(); + + glClearColor(0.2f, 0.3f, 0.3f, 1.0f); + glClear(GL_COLOR_BUFFER_BIT); }; void makeCurrentContext() { @@ -26,6 +32,4 @@ struct WebglContext { void destroy() { emscripten_webgl_destroy_context(context); } - - EMSCRIPTEN_WEBGL_CONTEXT_HANDLE context; -}; +};
\ No newline at end of file |
