From 0659e58f8c94a6a53b03223f837b9317d1d1e9b0 Mon Sep 17 00:00:00 2001 From: thecoshman Date: Fri, 5 Jul 2013 08:36:40 +0100 Subject: [PATCH 1/2] Create vertexArray.hpp This is a very low level wrapper, it is understood that the intention is for a separate more high-level class will bring together a vao, with vbos, textures and a program. --- src/vertexArray.hpp | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 src/vertexArray.hpp diff --git a/src/vertexArray.hpp b/src/vertexArray.hpp new file mode 100644 index 0000000..6ce0c08 --- /dev/null +++ b/src/vertexArray.hpp @@ -0,0 +1,23 @@ +#pragma once +#include "glid.hpp" +namespace gldr{ +struct VertexArray{ + void bind() const{ + if(vaoID){ + gl::BindVertexArray(vaoID); + } + } + + static GLuint create(){ + GLuint id; + gl::GenVertexArrays(1, &id); + return id; + } + + static void destroy(GLuint& id){ + gl::DeleteVertexArrays(1, &id); + } +private: + Glid vaoID; +}; +} From 690b65968c7bad6c326d1db8f4ac19d813960c5d Mon Sep 17 00:00:00 2001 From: thecoshman Date: Fri, 5 Jul 2013 13:01:51 +0100 Subject: [PATCH 2/2] the slightest of changes to remove reference passing. --- src/vertexArray.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/vertexArray.hpp b/src/vertexArray.hpp index 6ce0c08..3380828 100644 --- a/src/vertexArray.hpp +++ b/src/vertexArray.hpp @@ -14,7 +14,7 @@ struct VertexArray{ return id; } - static void destroy(GLuint& id){ + static void destroy(GLuint id){ gl::DeleteVertexArrays(1, &id); } private: