summaryrefslogtreecommitdiff
path: root/themes/Renderer2d.cpp
diff options
context:
space:
mode:
authormattkae <mattkae@protonmail.com>2022-05-01 21:55:18 -0400
committermattkae <mattkae@protonmail.com>2022-05-01 21:55:18 -0400
commit1c051dffdb27ff6ebaa96802b021e99e49afb861 (patch)
tree915dca8be4507da86c1f19726560a88b568ab280 /themes/Renderer2d.cpp
parent40a924db3664318615a9a3f11ee25c206cb77fe1 (diff)
Fixed resize issue
Diffstat (limited to 'themes/Renderer2d.cpp')
-rw-r--r--themes/Renderer2d.cpp16
1 files changed, 2 insertions, 14 deletions
diff --git a/themes/Renderer2d.cpp b/themes/Renderer2d.cpp
index 0d4eca2..dacebe3 100644
--- a/themes/Renderer2d.cpp
+++ b/themes/Renderer2d.cpp
@@ -25,18 +25,6 @@ const char* renderer2dFragmentShader =
" gl_FragColor = VertexColor; \n"
"}";
-EM_BOOL onScreenSizeChanged(int eventType, const EmscriptenUiEvent *uiEvent, void *userData) {
- Renderer2d* renderer = (Renderer2d*)userData;
-
- EMSCRIPTEN_RESULT result = emscripten_set_canvas_element_size( renderer->context->query, uiEvent->documentBodyClientWidth, uiEvent->documentBodyClientHeight);
- if (result != EMSCRIPTEN_RESULT_SUCCESS) {
- printf("Failed to resize element at query: %s\n", renderer->context->query);
- }
- renderer->projection = Mat4x4().getOrthographicMatrix(0, renderer->context->width, 0, renderer->context->height);
-
- return true;
-}
-
void Renderer2d::load(WebglContext* inContext) {
context = inContext;
printf("Compiling Renderer2d shader...\n");
@@ -51,11 +39,11 @@ void Renderer2d::load(WebglContext* inContext) {
projection = Mat4x4().getOrthographicMatrix(0, context->width, 0, context->height);
printf("Renderer2d shader compiled.\n");
-
- emscripten_set_resize_callback(EMSCRIPTEN_EVENT_TARGET_WINDOW, this, false, onScreenSizeChanged);
}
void Renderer2d::render() {
+ projection = Mat4x4().getOrthographicMatrix(0, context->width, 0, context->height);
+
glEnable(GL_DEPTH_TEST);
glDepthFunc(GL_LEQUAL);
glDepthMask(GL_TRUE);