From 8b09290c816a981662646d585061d6f2cd93ca2d Mon Sep 17 00:00:00 2001 From: JeremyStarTM Date: Sun, 21 Jul 2024 21:17:06 +0200 Subject: [PATCH] Require OpenGL version during window creation --- .../sosengine/graphics/opengl/classes/Window.java | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/graphics/opengl/src/main/java/de/staropensource/sosengine/graphics/opengl/classes/Window.java b/graphics/opengl/src/main/java/de/staropensource/sosengine/graphics/opengl/classes/Window.java index fbe8f39..35a7826 100644 --- a/graphics/opengl/src/main/java/de/staropensource/sosengine/graphics/opengl/classes/Window.java +++ b/graphics/opengl/src/main/java/de/staropensource/sosengine/graphics/opengl/classes/Window.java @@ -68,12 +68,18 @@ public class Window extends de.staropensource.sosengine.graphics.classes.Window if (!Miscellaneous.onMainThread()) throw new NotOnMainThreadException(); + // Set required version and profile + glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 4); + glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 0); + + // Create window long identifier = glfwCreateWindow(getSize().getX(), getSize().getY(), getTitle(), MemoryUtil.NULL, MemoryUtil.NULL); if (identifier == MemoryUtil.NULL) { new GraphicsApiErrorEvent().callEvent("Unable to create window: Identifier is null"); throw new de.staropensource.sosengine.graphics.opengl.exceptions.WindowCreationFailureException(); } + // Set identifier setIdentifier(String.valueOf(identifier)); ownContext(identifier); // Own context