From 20646758939562c0fbad4d52774efcfacf7e22fc Mon Sep 17 00:00:00 2001 From: Dan Goodliffe Date: Wed, 22 Dec 2021 14:10:34 +0000 Subject: RAII for glVertex and glBuffer --- ui/iconButton.cpp | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) (limited to 'ui/iconButton.cpp') diff --git a/ui/iconButton.cpp b/ui/iconButton.cpp index c35303f..c97896f 100644 --- a/ui/iconButton.cpp +++ b/ui/iconButton.cpp @@ -1,6 +1,9 @@ #include "iconButton.h" +#include "glBuffers.h" +#include "glVertexArrays.h" #include "ui/icon.h" #include "ui/uiComponent.h" +#include #include #include #include @@ -9,14 +12,10 @@ #include IconButton::IconButton(const std::string & icon_, glm::vec2 position_, UIEvent click_) : - UIComponent {{position_, ICON_SIZE}}, icon {icon_}, click {std::move(click_)}, m_vertexArrayObject {}, - m_vertexArrayBuffer {} + UIComponent {{position_, ICON_SIZE}}, icon {icon_}, click {std::move(click_)} { - glGenVertexArrays(1, &m_vertexArrayObject); glBindVertexArray(m_vertexArrayObject); - glGenBuffers(1, &m_vertexArrayBuffer); - glBindBuffer(GL_ARRAY_BUFFER, m_vertexArrayBuffer); glBufferData(GL_ARRAY_BUFFER, static_cast(sizeof(glm::vec4) * 4), nullptr, GL_DYNAMIC_DRAW); -- cgit v1.2.3