diff options
| author | Matthew Kosarek <mattkae@protonmail.com> | 2021-11-14 14:38:06 -0500 |
|---|---|---|
| committer | Matthew Kosarek <mattkae@protonmail.com> | 2021-11-14 14:38:06 -0500 |
| commit | fd3c1e74e7ebe9125b98dba311efcbe73e89859e (patch) | |
| tree | 0adb39252bb0e86a45a456971b5253edd7237014 /shared_cpp/WebglContext.h | |
| parent | 5c613a10364f30bd6add25f7950433f0c482c3ca (diff) | |
(mkosarek) Working on undamped and damped
Diffstat (limited to 'shared_cpp/WebglContext.h')
| -rw-r--r-- | shared_cpp/WebglContext.h | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/shared_cpp/WebglContext.h b/shared_cpp/WebglContext.h index 8064b04..3b6f517 100644 --- a/shared_cpp/WebglContext.h +++ b/shared_cpp/WebglContext.h @@ -6,11 +6,13 @@ #include <EGL/egl.h> struct WebglContext { - EMSCRIPTEN_WEBGL_CONTEXT_HANDLE context; + EMSCRIPTEN_WEBGL_CONTEXT_HANDLE context = 0; int width = 800; int height = 600; void init(const char* query, int inWidth = 800, int inHeight = 600) { + if (context != 0) destroy(); + width = inWidth; height = inHeight; emscripten_set_canvas_element_size( query, width, height); @@ -35,5 +37,6 @@ struct WebglContext { void destroy() { emscripten_webgl_destroy_context(context); + context = 0; } -};
\ No newline at end of file +}; |
