From 4a52f3a7ddfe80354b99f2130b23930d2402ea4a Mon Sep 17 00:00:00 2001
From: faiface <faiface@ksp.sk>
Date: Wed, 23 Nov 2016 14:03:23 +0100
Subject: [PATCH] add vertex format primitives

---
 pixelgl/vertex.go | 34 ++++++++++++++++++++++++++++++++++
 1 file changed, 34 insertions(+)
 create mode 100644 pixelgl/vertex.go

diff --git a/pixelgl/vertex.go b/pixelgl/vertex.go
new file mode 100644
index 0000000..d0af0ed
--- /dev/null
+++ b/pixelgl/vertex.go
@@ -0,0 +1,34 @@
+package pixelgl
+
+// VertexFormat defines a data format in a vertex buffer.
+//
+// Example:
+//
+//   vf := VertexFormat{{Position, 2}, {Color, 4}, {TexCoord, 2}}
+type VertexFormat []VertexAttribute
+
+// VertexAttribute specifies a single attribute in a vertex buffer.
+// All vertex attributes are composed of float64s.
+//
+// A vertex attribute has a Purpose (such as Position, Color, etc.) and Size. Size specifies
+// the number of float64s the vertex attribute is composed of.
+type VertexAttribute struct {
+	Purpose VertexAttributePurpose
+	Size    int
+}
+
+// VertexAttributePurpose clarifies the purpose of a vertex attribute. This can be a color, position, texture
+// coordinates or anything else.
+//
+// VertexAttributePurpose may be used to correctly assign data to a vertex buffer.
+type VertexAttributePurpose int
+
+// Position, Color and TexCoord are the standard vertex attributes.
+//
+// Feel free to define more vertex attribute purposes (e.g. in an effects library).
+const (
+	Position VertexAttributePurpose = iota
+	Color
+	TexCoord
+	NumStandardVertexAttrib
+)
-- 
GitLab