From be66c702739fcf953dc943c9c10ebd925b665bdc Mon Sep 17 00:00:00 2001 From: fschildt Date: Wed, 14 Jan 2026 16:00:36 +0100 Subject: render: switch from glew to glad --- src/main.cpp | 20 ++++++++------------ 1 file changed, 8 insertions(+), 12 deletions(-) (limited to 'src/main.cpp') diff --git a/src/main.cpp b/src/main.cpp index a768040..e3241d4 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -2,10 +2,9 @@ #include "games/Game.hpp" #include "common/MemoryManager.hpp" +#include #include #include -#include -#include #include #include @@ -68,11 +67,11 @@ CreateWindow() } - const char* glsl_version = "#version 130"; + const char* glsl_version = "#version 330"; SDL_GL_SetAttribute(SDL_GL_CONTEXT_FLAGS, 0); - SDL_GL_SetAttribute(SDL_GL_CONTEXT_PROFILE_MASK, SDL_GL_CONTEXT_PROFILE_CORE); + SDL_GL_SetAttribute(SDL_GL_CONTEXT_PROFILE_MASK, SDL_GL_CONTEXT_PROFILE_COMPATIBILITY); SDL_GL_SetAttribute(SDL_GL_CONTEXT_MAJOR_VERSION, 3); - SDL_GL_SetAttribute(SDL_GL_CONTEXT_MINOR_VERSION, 0); + SDL_GL_SetAttribute(SDL_GL_CONTEXT_MINOR_VERSION, 3); SDL_GL_SetAttribute(SDL_GL_DOUBLEBUFFER, 1); SDL_GL_SetAttribute(SDL_GL_DEPTH_SIZE, 24); @@ -91,20 +90,17 @@ CreateWindow() SDL_DestroyWindow(window); return nullptr; } + SDL_GL_MakeCurrent(window, sdl_gl_context); + SDL_GL_SetSwapInterval(1); // enable vsync - GLenum glew_error = glewInit(); - if (glew_error != GLEW_OK) - { + if (!gladLoadGL(SDL_GL_GetProcAddress)) { SDL_GL_DestroyContext(sdl_gl_context); SDL_DestroyWindow(window); - std::cerr << "Failed to init glew: " << glewGetErrorString(glew_error) << '\n'; + std::cerr << "Failed to init GLAD!\n"; return nullptr; } - - SDL_GL_MakeCurrent(window, sdl_gl_context); - SDL_GL_SetSwapInterval(1); // enable vsync SDL_SetWindowPosition(window, SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED); SDL_ShowWindow(window); -- cgit v1.2.3