From 62866d33ae8bc3730674cd3f43e1b286d99eba07 Mon Sep 17 00:00:00 2001 From: veclavtalica Date: Sat, 22 Feb 2025 16:19:22 +0300 Subject: [PATCH] add notes explaining emscripten considerations --- src/rendering/twn_draw_c.h | 2 ++ src/rendering/twn_gl_15_rendering.c | 4 ++++ 2 files changed, 6 insertions(+) diff --git a/src/rendering/twn_draw_c.h b/src/rendering/twn_draw_c.h index 26264f9..9029341 100644 --- a/src/rendering/twn_draw_c.h +++ b/src/rendering/twn_draw_c.h @@ -37,6 +37,8 @@ enum { TWN_UNSIGNED_BYTE, }; +/* note: they're separate as on some targets they are not interchangeable like in opengl */ +/* emscripten legacy gl emulation, for example, assumes first bind to be decisive in its future usage */ typedef uint32_t VertexBuffer; typedef uint32_t IndexBuffer; diff --git a/src/rendering/twn_gl_15_rendering.c b/src/rendering/twn_gl_15_rendering.c index 79a70f4..ea80333 100644 --- a/src/rendering/twn_gl_15_rendering.c +++ b/src/rendering/twn_gl_15_rendering.c @@ -14,6 +14,10 @@ #endif #include +/* note: care must be taken to always have interleaved VBOs with all data, */ +/* as it is optimized in emscripten legacy gl emulation. */ +/* constant color isn't supported there, so care must be given to provide alternative path with VBO as well. */ + static TextureMode texture_mode_last_used = TEXTURE_MODE_UNKNOWN; static Pipeline pipeline_last_used = PIPELINE_NO;