a-game

2D platformer written from scratch.
git clone git://git.amin.space/a-game.git
Log | Files | Refs | README | LICENSE

commit 843edf7a9bda9c35713fbaa146fb6fe4cbe0dc7d
parent 91b4d7d4e3b31a461ae6be6caffd76e3dca44aa1
Author: amin <dev@aminmesbah.com>
Date:   Wed, 26 Feb 2020 05:21:01 +0000

Remove glViewport call from platform layer

FossilOrigin-Name: 059109db7ad6e97ffc52d06eb53849413b670b95736c1a1a36f1084330885f5f
Diffstat:
Msrc/game.c | 1+
Msrc/platform_linux.c | 7-------
Msrc/platform_wasm.c | 2--
Msrc/platform_windows.c | 7-------
4 files changed, 1 insertion(+), 16 deletions(-)

diff --git a/src/game.c b/src/game.c @@ -220,6 +220,7 @@ void game_update_and_render(struct GameMemory *game_memory, struct GameInput *ga game_state->renderer.projection = math_projection_ortho(0.0f, framebuffer.width, 0.0f, framebuffer.height, -1.0f, 0.0f); } + glViewport(0, 0, framebuffer.width, framebuffer.height); glEnable(GL_SCISSOR_TEST); glScissor( viewport.min.x, diff --git a/src/platform_linux.c b/src/platform_linux.c @@ -44,7 +44,6 @@ int main(void) return -1; } glfwMakeContextCurrent(window); - glfwSetFramebufferSizeCallback(window, framebuffer_size_callback); glfwSetKeyCallback(window, key_callback); #ifdef USE_TEST_SEED @@ -164,12 +163,6 @@ internal void error_callback(int error, const char *description) fprintf(stderr, "Error: %s\n", description); } -internal void framebuffer_size_callback(GLFWwindow *window, int width, int height) -{ - // TODO: get this out of the platform layer - glViewport(0, 0, width, height); -} - internal void key_callback(GLFWwindow *window, int key, int scancode, int action, int mods) { struct GameInput *game_input = (struct GameInput *)glfwGetWindowUserPointer(window); diff --git a/src/platform_wasm.c b/src/platform_wasm.c @@ -150,8 +150,6 @@ void window_resize(int w, int h) { g_width = w; g_height = h; - // TODO: get this out of the platform layer - glViewport(0, 0, g_width, g_height); } void key_callback(enum WasmKey key, bool key_action_is_pressed) diff --git a/src/platform_windows.c b/src/platform_windows.c @@ -49,7 +49,6 @@ int main(void) return -1; } glfwMakeContextCurrent(window); - glfwSetFramebufferSizeCallback(window, framebuffer_size_callback); glfwSetKeyCallback(window, key_callback); if (!am_gl_init()) @@ -133,12 +132,6 @@ internal void error_callback(int error, const char *description) fprintf(stderr, "Error: %s\n", description); } -internal void framebuffer_size_callback(GLFWwindow *window, int width, int height) -{ - // TODO: get this out of the platform layer - glViewport(0, 0, width, height); -} - internal void key_callback(GLFWwindow *window, int key, int scancode, int action, int mods) { struct GameInput *game_input = (struct GameInput *)glfwGetWindowUserPointer(window);