feat(window): can specify opengl version from args
Clang Build CI / run-no-video (push) Failing after 48s
Clang Lint CI / lint-no-video (push) Failing after 48s
Clang Build CI / run-video (push) Failing after 50s
Clang Build CI / build-release (push) Failing after 1m12s
Clang Lint CI / lint-video (push) Failing after 51s

This commit is contained in:
2026-08-27 16:29:06 +02:00
parent 73dd4b75d3
commit 1c44239a8d
7 changed files with 60 additions and 19 deletions
+9 -7
View File
@@ -5,8 +5,6 @@
#include "types.h"
#include "constants.h"
#include "window.h"
static void init_glfw(void (*error_callback)(int, const char *),
@@ -69,7 +67,9 @@ static GLFWmonitor *get_monitor(unsigned char monitor_index) {
}
static GLFWwindow *
create_window(GLFWmonitor *monitor, const char *title, Window *shared_context,
create_window(GLFWmonitor *monitor, const char *title,
const unsigned int opengl_major, const unsigned int opengl_minor,
Window *shared_context,
void (*key_callback)(Window *, int, int, int, int)) {
GLFWwindow *window;
@@ -82,8 +82,8 @@ create_window(GLFWmonitor *monitor, const char *title, Window *shared_context,
glfwWindowHint(GLFW_FOCUS_ON_SHOW, GLFW_FALSE);
// Context related hints
glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 4);
glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 6);
glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, opengl_major);
glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, opengl_minor);
#ifdef GL_DEBUG
glfwWindowHint(GLFW_OPENGL_DEBUG_CONTEXT, GLFW_TRUE);
#endif
@@ -122,14 +122,16 @@ void window_terminate() {
}
Window *window_init(const char *title, unsigned char monitor_index,
bool windowed, Window *shared_context,
bool windowed, const unsigned int opengl_major,
const unsigned int opengl_minor, Window *shared_context,
void (*key_callback)(Window *, int, int, int, int)) {
GLFWwindow *window;
GLFWmonitor *monitor;
monitor = windowed ? NULL : get_monitor(monitor_index);
window = create_window(monitor, title, shared_context, key_callback);
window = create_window(monitor, title, opengl_major, opengl_minor,
shared_context, key_callback);
use_window(window);