diff options
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); |
