diff options
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 |