summaryrefslogtreecommitdiff
path: root/ui
diff options
context:
space:
mode:
authorDan Goodliffe <dan@randomdan.homeip.net>2023-05-28 11:45:22 +0100
committerDan Goodliffe <dan@randomdan.homeip.net>2023-05-28 11:45:22 +0100
commitfdea7529ba09a615d92da5823429b49c7e565c9d (patch)
tree67b12689c60dc2e75a5587988dd11bf36c12da9a /ui
parentMark main rule as always, so we can always launch it (diff)
parentSwap GLEW for more modern glad (diff)
downloadilt-fdea7529ba09a615d92da5823429b49c7e565c9d.tar.bz2
ilt-fdea7529ba09a615d92da5823429b49c7e565c9d.tar.xz
ilt-fdea7529ba09a615d92da5823429b49c7e565c9d.zip
Merge branch 'glad'
Diffstat (limited to 'ui')
-rw-r--r--ui/font.h2
-rw-r--r--ui/gameMainWindow.cpp2
-rw-r--r--ui/icon.cpp2
-rw-r--r--ui/iconButton.cpp2
-rw-r--r--ui/text.h2
-rw-r--r--ui/window.cpp10
-rw-r--r--ui/window.h6
7 files changed, 13 insertions, 13 deletions
diff --git a/ui/font.h b/ui/font.h
index 52b92a7..6c86e18 100644
--- a/ui/font.h
+++ b/ui/font.h
@@ -1,12 +1,12 @@
#pragma once
-#include <GL/glew.h>
#include <array>
#include <cache.h>
#include <cstddef>
#include <cstdint>
#include <filesystem>
#include <glArrays.h>
+#include <glad/gl.h>
#include <glm/glm.hpp>
#include <map>
#include <string_view>
diff --git a/ui/gameMainWindow.cpp b/ui/gameMainWindow.cpp
index a7f17dc..c35c9c6 100644
--- a/ui/gameMainWindow.cpp
+++ b/ui/gameMainWindow.cpp
@@ -6,13 +6,13 @@
#include "modeHelper.h"
#include "toolbar.h"
#include "window.h"
-#include <GL/glew.h>
#include <SDL2/SDL.h>
#include <collection.h>
#include <game/gamestate.h>
#include <game/network/rail.h>
#include <game/worldobject.h> // IWYU pragma: keep
#include <gfx/renderable.h>
+#include <glad/gl.h>
#include <glm/glm.hpp>
#include <memory>
#include <utility>
diff --git a/ui/icon.cpp b/ui/icon.cpp
index be1a63c..38f4bf9 100644
--- a/ui/icon.cpp
+++ b/ui/icon.cpp
@@ -1,7 +1,7 @@
#include "icon.h"
#include "glArrays.h"
-#include <GL/glew.h>
#include <gfx/image.h>
+#include <glad/gl.h>
#include <resource.h>
#include <stb/stb_image.h>
diff --git a/ui/iconButton.cpp b/ui/iconButton.cpp
index f74b3fc..fe8c817 100644
--- a/ui/iconButton.cpp
+++ b/ui/iconButton.cpp
@@ -2,11 +2,11 @@
#include "glArrays.h"
#include "ui/icon.h"
#include "ui/uiComponent.h"
-#include <GL/glew.h>
#include <SDL2/SDL.h>
#include <array>
#include <filesystem>
#include <functional>
+#include <glad/gl.h>
#include <glm/gtc/type_ptr.hpp>
#include <utility>
diff --git a/ui/text.h b/ui/text.h
index cbe49de..9fe87d1 100644
--- a/ui/text.h
+++ b/ui/text.h
@@ -1,8 +1,8 @@
#pragma once
#include "uiComponent.h"
-#include <GL/glew.h>
#include <glArrays.h>
+#include <glad/gl.h>
#include <glm/glm.hpp>
#include <string_view>
#include <vector>
diff --git a/ui/window.cpp b/ui/window.cpp
index 731996a..93e85bd 100644
--- a/ui/window.cpp
+++ b/ui/window.cpp
@@ -1,20 +1,20 @@
#include "window.h"
#include "uiComponent.h"
#include "worldOverlay.h"
-#include <GL/glew.h>
+#include <glad/gl.h>
#include <glm/glm.hpp>
#include <stdexcept>
#include <tuple>
#include <type_traits>
-Window::GlewInitHelper::GlewInitHelper()
+Window::GLInitHelper::GLInitHelper()
{
[[maybe_unused]] static auto init = []() {
- if (const auto r = glewInit(); r != GLEW_OK) {
- throw std::runtime_error {reinterpret_cast<const char *>(glewGetErrorString(r))};
+ if (const auto version = gladLoadGL(reinterpret_cast<GLADloadfunc>(SDL_GL_GetProcAddress)); version != 40006) {
+ throw std::runtime_error {std::to_string(version)};
}
else {
- return r;
+ return version;
}
}();
}
diff --git a/ui/window.h b/ui/window.h
index be9e114..369228a 100644
--- a/ui/window.h
+++ b/ui/window.h
@@ -31,14 +31,14 @@ public:
protected:
virtual void render() const;
- struct GlewInitHelper {
- GlewInitHelper();
+ struct GLInitHelper {
+ GLInitHelper();
};
const glm::ivec2 size;
SDL_WindowPtr m_window;
SDL_GLContextPtr glContext;
- GlewInitHelper glewinithelper;
+ GLInitHelper glInithelper;
Collection<UIComponent> uiComponents;
UIShader uiShader;
};