diff --git a/pixelgl/vertex.go b/pixelgl/vertex.go
index 7ab94c70846b62d138c84c613c0c45f060b912a3..19cef47546e3ea39ef870c9253e7fb19aa3d7764 100644
--- a/pixelgl/vertex.go
+++ b/pixelgl/vertex.go
@@ -1,7 +1,6 @@
 package pixelgl
 
 import (
-	"fmt"
 	"unsafe"
 
 	"github.com/go-gl/gl/v3.3-core/gl"
@@ -16,7 +15,7 @@ import (
 //   VertexFormat{"position": {Position, Vec2}, "colr": {Color, Vec4}, "texCoord": {TexCoord, Vec2}}
 //
 // Note: vertex array currently doesn't support matrices in vertex format.
-type VertexFormat map[string]Attr
+type VertexFormat []Attr
 
 // Size calculates the total size of a single vertex in this vertex format (sum of the sizes of all vertex attributes).
 func (vf VertexFormat) Size() int {
@@ -118,12 +117,7 @@ func NewVertexArray(parent Doer, format VertexFormat, mode VertexDrawMode, usage
 			gl.BufferData(gl.ARRAY_BUFFER, len(emptyData), gl.Ptr(emptyData), uint32(usage))
 
 			offset := 0
-			for name, attr := range format {
-				location := gl.GetAttribLocation(ctx.Shader().ID(), gl.Str(name+"\x00"))
-				if location == -1 {
-					return fmt.Errorf("shader does not contain vertex attribute '%s'", name)
-				}
-
+			for i, attr := range format {
 				var size int32
 				switch attr.Type {
 				case Float:
@@ -137,14 +131,14 @@ func NewVertexArray(parent Doer, format VertexFormat, mode VertexDrawMode, usage
 				}
 
 				gl.VertexAttribPointer(
-					uint32(location),
+					uint32(i),
 					size,
 					gl.FLOAT,
 					false,
 					int32(va.stride),
 					gl.PtrOffset(offset),
 				)
-				gl.EnableVertexAttribArray(uint32(location))
+				gl.EnableVertexAttribArray(uint32(i))
 				offset += attr.Type.Size()
 			}
 
diff --git a/window.go b/window.go
index 46195d9737b21959b5c0a3a14f70563e034de980..e8ef87a51e0006f85f2ae3c7940ebf12552400f9 100644
--- a/window.go
+++ b/window.go
@@ -315,9 +315,9 @@ func (w *Window) Do(sub func(pixelgl.Context)) {
 }
 
 var defaultVertexFormat = pixelgl.VertexFormat{
-	"position": {Purpose: pixelgl.Position, Type: pixelgl.Vec2},
-	"color":    {Purpose: pixelgl.Color, Type: pixelgl.Vec4},
-	"texCoord": {Purpose: pixelgl.TexCoord, Type: pixelgl.Vec2},
+	{Purpose: pixelgl.Position, Type: pixelgl.Vec2},
+	{Purpose: pixelgl.Color, Type: pixelgl.Vec4},
+	{Purpose: pixelgl.TexCoord, Type: pixelgl.Vec2},
 }
 
 var defaultUniformFormat = pixelgl.UniformFormat{
@@ -328,9 +328,9 @@ var defaultUniformFormat = pixelgl.UniformFormat{
 var defaultVertexShader = `
 #version 330 core
 
-in vec2 position;
-in vec4 color;
-in vec2 texCoord;
+layout (location = 0) in vec2 position;
+layout (location = 1) in vec4 color;
+layout (location = 2) in vec2 texCoord;
 
 out vec4 Color;
 out vec2 TexCoord;