summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/core/src/loop.c15
-rw-r--r--src/rendering/src/rendering.c3
-rw-r--r--src/rendering/src/window.c8
3 files changed, 10 insertions, 16 deletions
diff --git a/src/core/src/loop.c b/src/core/src/loop.c
index 07ce707..1c1ec52 100644
--- a/src/core/src/loop.c
+++ b/src/core/src/loop.c
@@ -127,21 +127,6 @@ Platform* engine_init(const char* windowtitle, i32 windowWidth, i32 windowHeight
init_render_opengl(w);
- //// Generate 1 buffer, put the resulting identifier in vertexbuffer
- //gl->GenBuffers(1, &(testobject->vbo));
- //// The following commands will talk about our 'vertexbuffer' buffer
- //gl->BindBuffer(GL_ARRAY_BUFFER, testobject->vbo);
- //// Give our vertices to OpenGL.
- //gl->BufferData(GL_ARRAY_BUFFER, sizeof(bufdata), bufdata, GL_STATIC_DRAW);
-
- //// Same for the color buffer
- //gl->GenBuffers(1, &(testobject->col));
- //gl->BindBuffer(GL_ARRAY_BUFFER, testobject->col);
- //gl->BufferData(GL_ARRAY_BUFFER, sizeof(g_color_buffer_data), g_color_buffer_data, GL_STATIC_DRAW);
-
- //testobject->shaderprogram = LoadShaders(gl, "shader.vertexshader", "shader.fragmentshader");
- //INFO("Shaderprogram %d", testobject->shaderprogram);
-
//{ /* Resource loading */
// /* Count resources */
diff --git a/src/rendering/src/rendering.c b/src/rendering/src/rendering.c
index 09af019..81a9e11 100644
--- a/src/rendering/src/rendering.c
+++ b/src/rendering/src/rendering.c
@@ -355,7 +355,8 @@ void r_set_camera(Camera* c) {
void engine_window_resize_pointers(i32* w, i32* h) {
//GLOBAL_PLATFORM->window->game_w = w;
- //GLOBAL_PLATFORM->window->game_h = h;
+ GLOBAL_PLATFORM->window->windowsize[0] = *w;
+ GLOBAL_PLATFORM->window->windowsize[1] = *h;
}
void engine_window_resize_pointers_reset(void) {
diff --git a/src/rendering/src/window.c b/src/rendering/src/window.c
index e3b5524..d1fdbc7 100644
--- a/src/rendering/src/window.c
+++ b/src/rendering/src/window.c
@@ -33,9 +33,16 @@ void glfw_err_callback(int code, const char* description) {
exit(EXIT_FAILURE);
}
+void window_resize_callback(GLFWwindow* window, int width, int height) {
+ const GladGLContext* gl = GLOBAL_PLATFORM->window->context;
+ glfwSwapBuffers(window);
+ gl->Finish();
+}
+
void window_size_callback(GLFWwindow* window, int width, int height) {
const GladGLContext* gl = GLOBAL_PLATFORM->window->context;
Camera* c = GLOBAL_PLATFORM->cam;
+ glfwGetWindowSize(window, &width, &height);
gl->Viewport(0,0, width, height);
GLOBAL_PLATFORM->window->windowsize[0] = width;
GLOBAL_PLATFORM->window->windowsize[1] = height;
@@ -134,6 +141,7 @@ Window* init_window_glfw(
// Setup callbacks
glfwSetFramebufferSizeCallback(window, window_size_callback);
+ glfwSetWindowSizeCallback(window, window_resize_callback);
glfwSetKeyCallback(window, (GLFWkeyfun)key_callback);
// Create the window datastructure