|
30 | 30 |
|
31 | 31 | using vec2 = glm::vec2; |
32 | 32 |
|
33 | | -constexpr float WIDTH = 800.00f * 1.5f; |
34 | | -constexpr float HEIGHT = 600.00f * 1.5f; |
| 33 | +constexpr float WIDTH = 800.00f * 2.0f; |
| 34 | +constexpr float HEIGHT = WIDTH * 3/4; |
35 | 35 |
|
36 | 36 | float last_x = WIDTH / 2.0f; |
37 | 37 | float last_y = HEIGHT / 2.0f; |
@@ -116,7 +116,7 @@ void main_loop_step(AppContext* ctx) { |
116 | 116 | } |
117 | 117 |
|
118 | 118 | if (ctx->function_state->is_3d) { |
119 | | - glm::mat4 projection = glm::perspective(glm::radians(45.0f), WIDTH / HEIGHT, 0.1f, 100.0f); |
| 119 | + glm::mat4 projection = glm::perspective(glm::radians(45.0f), ctx->view_state->width / ctx->view_state->height, 0.1f, 100.0f); |
120 | 120 | glm::mat4 view = get_view_matrix(camera_state); |
121 | 121 | glm::mat4 model = glm::mat4(1.0f); |
122 | 122 | current_shader->setMat4("projection", projection); |
@@ -273,6 +273,8 @@ int main() { |
273 | 273 |
|
274 | 274 |
|
275 | 275 | #ifdef __EMSCRIPTEN__ |
| 276 | + //glViewport(0, 0, (int)view_state.width, (int)view_state.height); |
| 277 | + emscripten_set_canvas_element_size("#canvas", (int)view_state.width, (int)view_state.height); |
276 | 278 | emscripten_set_resize_callback(EMSCRIPTEN_EVENT_TARGET_WINDOW, window, EM_FALSE, browser_resize_callback); |
277 | 279 | EmscriptenUiEvent fake_event; |
278 | 280 | fake_event.windowInnerWidth = EM_ASM_INT({ return window.innerWidth; }); |
|
0 commit comments