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/games/tetris/Tetris.cpp | 1 - src/main.cpp | 20 ++++++++------------ src/renderer/RSoftwareBackend.cpp | 2 +- src/renderer/Renderer.hpp | 1 - 4 files changed, 9 insertions(+), 15 deletions(-) (limited to 'src') 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 #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); 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 #include -#include #include #include 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 -#include #include #include -- cgit v1.2.3