From 58488f8eabcc61089e0ae4297f38f10cc28d78c7 Mon Sep 17 00:00:00 2001 From: Matthew Kosarek Date: Sat, 27 Mar 2021 11:49:56 -0400 Subject: Working reusable simulation loop --- frontend/shared_cpp/WebglContext.h | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'frontend/shared_cpp/WebglContext.h') 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 #include #include #include 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 -- cgit v1.2.1