diff options
| author | fschildt <florian.schildt@protonmail.com> | 2026-01-14 16:00:36 +0100 |
|---|---|---|
| committer | fschildt <florian.schildt@protonmail.com> | 2026-01-14 16:00:36 +0100 |
| commit | be66c702739fcf953dc943c9c10ebd925b665bdc (patch) | |
| tree | 2778a3155d7db3a7c6d754096704105097fad090 /src/main.cpp | |
| parent | ebe4a92027aabc9c01caf0fbe791d22773abfe75 (diff) | |
render: switch from glew to glad
Diffstat (limited to 'src/main.cpp')
| -rw-r--r-- | src/main.cpp | 20 |
1 files changed, 8 insertions, 12 deletions
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 <glad/gl.h> #include <SDL3/SDL.h> #include <SDL3/SDL_video.h> -#include <GL/glew.h> -#include <GL/gl.h> #include <imgui.h> #include <imgui_impl_opengl3.h> @@ -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); |
