transparent-cube

Minimal cross-platform native/wasm graphics example.
git clone git://git.amin.space/transparent-cube.git
Log | Files | Refs | README | LICENSE

commit 6c2ae4e6d06972fe5d1855e92116ccc09d1caae4
parent 09f7cdd7434f94d62d635c9d386d1ad2e4510ee7
Author: amin <dev@aminmesbah.com>
Date:   Fri, 21 Jun 2019 01:31:12 +0000

Persist game state across render calls

(facepalm)

FossilOrigin-Name: 84ce0083060d437fd8ae472a51bcae737a11acf263227f8446eaf7baede6c32e
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)