summaryrefslogtreecommitdiff
path: root/ui
diff options
context:
space:
mode:
authorDan Goodliffe <dan@randomdan.homeip.net>2022-01-01 16:44:19 +0000
committerDan Goodliffe <dan@randomdan.homeip.net>2022-01-01 16:44:19 +0000
commit7c03d93c367b842c464dca30e121bc4c20547c36 (patch)
tree6df340dc3b0bd16f6ced2a051a68fc8a3c67a08c /ui
parentFirst iteration with font/text support (diff)
downloadilt-7c03d93c367b842c464dca30e121bc4c20547c36.tar.bz2
ilt-7c03d93c367b842c464dca30e121bc4c20547c36.tar.xz
ilt-7c03d93c367b842c464dca30e121bc4c20547c36.zip
Generic solution for glGen/glDel arrays, then tidy-up the uses
Diffstat (limited to 'ui')
-rw-r--r--ui/icon.cpp10
-rw-r--r--ui/icon.h10
-rw-r--r--ui/iconButton.cpp3
-rw-r--r--ui/iconButton.h3
-rw-r--r--ui/text.cpp3
-rw-r--r--ui/text.h3
6 files changed, 9 insertions, 23 deletions
diff --git a/ui/icon.cpp b/ui/icon.cpp
index 371410a..657e953 100644
--- a/ui/icon.cpp
+++ b/ui/icon.cpp
@@ -1,4 +1,6 @@
#include "icon.h"
+#include "glArrays.h"
+#include <GL/glew.h>
#include <gfx/image.h>
#include <resource.h>
#include <stb/stb_image.h>
@@ -7,9 +9,8 @@ Icon::Icon(const std::filesystem::path & fileName) : Icon {Image {Resource::mapP
{
}
-Icon::Icon(const Image & tex) : size {tex.width, tex.height}, m_texture {}
+Icon::Icon(const Image & tex) : size {tex.width, tex.height}
{
- glGenTextures(1, &m_texture);
glBindTexture(GL_TEXTURE_2D, m_texture);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP);
@@ -21,11 +22,6 @@ Icon::Icon(const Image & tex) : size {tex.width, tex.height}, m_texture {}
GL_RGBA, GL_UNSIGNED_BYTE, tex.data.data());
}
-Icon::~Icon()
-{
- glDeleteTextures(1, &m_texture);
-}
-
void
Icon::Bind() const
{
diff --git a/ui/icon.h b/ui/icon.h
index cc6df87..2650218 100644
--- a/ui/icon.h
+++ b/ui/icon.h
@@ -1,10 +1,9 @@
#ifndef ICON_H
#define ICON_H
-#include <GL/glew.h>
#include <filesystem>
+#include <glArrays.h>
#include <glm/glm.hpp>
-#include <special_members.hpp>
class Image;
@@ -13,16 +12,11 @@ public:
explicit Icon(const std::filesystem::path & fileName);
explicit Icon(const Image & image);
- virtual ~Icon();
-
- NO_COPY(Icon);
- NO_MOVE(Icon);
-
void Bind() const;
const glm::vec2 size;
private:
- GLuint m_texture;
+ glTexture m_texture;
};
#endif
diff --git a/ui/iconButton.cpp b/ui/iconButton.cpp
index c97896f..f74b3fc 100644
--- a/ui/iconButton.cpp
+++ b/ui/iconButton.cpp
@@ -1,6 +1,5 @@
#include "iconButton.h"
-#include "glBuffers.h"
-#include "glVertexArrays.h"
+#include "glArrays.h"
#include "ui/icon.h"
#include "ui/uiComponent.h"
#include <GL/glew.h>
diff --git a/ui/iconButton.h b/ui/iconButton.h
index 76e3f1b..53ada74 100644
--- a/ui/iconButton.h
+++ b/ui/iconButton.h
@@ -3,8 +3,7 @@
#include "icon.h"
#include "uiComponent.h"
-#include <glBuffers.h>
-#include <glVertexArrays.h>
+#include <glArrays.h>
#include <glm/glm.hpp>
#include <string>
diff --git a/ui/text.cpp b/ui/text.cpp
index be696c3..2acfb7e 100644
--- a/ui/text.cpp
+++ b/ui/text.cpp
@@ -3,8 +3,7 @@
#include "gfx/gl/uiShader.h"
#include "uiComponent.h"
#include <array>
-#include <glBuffers.h>
-#include <glVertexArrays.h>
+#include <glArrays.h>
#include <glm/gtc/type_ptr.hpp>
#include <map>
#include <utility>
diff --git a/ui/text.h b/ui/text.h
index 81122de..cbe49de 100644
--- a/ui/text.h
+++ b/ui/text.h
@@ -2,8 +2,7 @@
#include "uiComponent.h"
#include <GL/glew.h>
-#include <glBuffers.h>
-#include <glVertexArrays.h>
+#include <glArrays.h>
#include <glm/glm.hpp>
#include <string_view>
#include <vector>