transparent-cube

Minimal cross-platform native/wasm graphics example.
Log | Files | Refs | README | LICENSE

commit 624ab5e4bb3a8bed7fee46939568820e595e9e8f
parent 312c3c5e7535658e2de0ecf1620e0404204444e0
Author: Amin Mesbah <dev@aminmesbah.com>
Date:   Thu, 20 Jun 2019 18:29:57 -0700

Persist game state across render calls

(facepalm)

Diffstat:
Msrc/platform_wasm.c | 1-
Msrc/webgl.h | 5+++--
2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/src/platform_wasm.c b/src/platform_wasm.c @@ -15,7 +15,6 @@ i32 g_mem_buffer_i = 0; export bool init(void) { - struct GameState g_game_state = {0}; g_game_state.platform.platform_read_entire_file = &wasm_read_entire_file; g_game_state.platform.platform_print = &wasm_print; g_game_state.platform.platform_memory_free = &wasm_memory_free; diff --git a/src/webgl.h b/src/webgl.h @@ -131,7 +131,8 @@ inline void glCompileShader(GLuint shader) inline GLuint glCreateProgram(void) { - return webglCreateProgram(); + i32 program_id = webglCreateProgram(); + return (GLuint)program_id; } inline GLuint glCreateShader(GLenum type) @@ -255,7 +256,7 @@ inline void glUniform3f(GLint location, GLfloat v0, GLfloat v1, GLfloat v2) inline void glUniformMatrix4fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value) { - webglUniformMatrix4fv(WEBGL_CAST_I32(location), WEBGL_CAST_I32(value)); + webglUniformMatrix4fv(WEBGL_CAST_I32(location), value); } inline void glUseProgram(GLuint program)