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 | |
| parent | ebe4a92027aabc9c01caf0fbe791d22773abfe75 (diff) | |
render: switch from glew to glad
Diffstat (limited to 'src')
| -rw-r--r-- | src/games/tetris/Tetris.cpp | 1 | ||||
| -rw-r--r-- | src/main.cpp | 20 | ||||
| -rw-r--r-- | src/renderer/RSoftwareBackend.cpp | 2 | ||||
| -rw-r--r-- | src/renderer/Renderer.hpp | 1 |
4 files changed, 9 insertions, 15 deletions
diff --git a/src/games/tetris/Tetris.cpp b/src/games/tetris/Tetris.cpp index 7273cdd..043033f 100644 --- a/src/games/tetris/Tetris.cpp +++ b/src/games/tetris/Tetris.cpp @@ -201,7 +201,6 @@ Tetris::DrawGameOverMenu() ImGui::Text("Score = %d", m_score); ImGui::Text("HighScore = %d", m_highscore); if (ImGui::Button("Restart")) { - printf("restarted\n"); Start(); } if (ImGui::Button("Exit")) { 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); diff --git a/src/renderer/RSoftwareBackend.cpp b/src/renderer/RSoftwareBackend.cpp index 754a30f..00a8da2 100644 --- a/src/renderer/RSoftwareBackend.cpp +++ b/src/renderer/RSoftwareBackend.cpp @@ -2,8 +2,8 @@ #include "renderer/Renderer.hpp" #include "renderer/RSoftwareBackend.hpp" +#include <glad/gl.h> #include <SDL3/SDL_video.h> -#include <GL/glew.h> #include <algorithm> #include <cstdlib> diff --git a/src/renderer/Renderer.hpp b/src/renderer/Renderer.hpp index 91a919d..ad935e3 100644 --- a/src/renderer/Renderer.hpp +++ b/src/renderer/Renderer.hpp @@ -6,7 +6,6 @@ #include "common/MemoryManager.hpp" #include <SDL3/SDL.h> -#include <SDL3/SDL_video.h> #include <imgui.h> #include <vector> |
