From 0e7f237d5e6937e24dda0a47313c6001921643d7 Mon Sep 17 00:00:00 2001 From: "Stefanos A." Date: Thu, 30 Jan 2014 11:42:07 +0100 Subject: [PATCH] [Examples] BindAttribLocation must precede LinkProgram --- Source/Examples/OpenGL/3.x/HelloGL3.cs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/Source/Examples/OpenGL/3.x/HelloGL3.cs b/Source/Examples/OpenGL/3.x/HelloGL3.cs index e56537c4..6b390cf2 100644 --- a/Source/Examples/OpenGL/3.x/HelloGL3.cs +++ b/Source/Examples/OpenGL/3.x/HelloGL3.cs @@ -131,6 +131,9 @@ void main(void) GL.AttachShader(shaderProgramHandle, vertexShaderHandle); GL.AttachShader(shaderProgramHandle, fragmentShaderHandle); + GL.BindAttribLocation(shaderProgramHandle, 0, "in_position"); + GL.BindAttribLocation(shaderProgramHandle, 1, "in_normal"); + GL.LinkProgram(shaderProgramHandle); Debug.WriteLine(GL.GetProgramInfoLog(shaderProgramHandle)); GL.UseProgram(shaderProgramHandle); @@ -183,12 +186,10 @@ void main(void) GL.EnableVertexAttribArray(0); GL.BindBuffer(BufferTarget.ArrayBuffer, positionVboHandle); GL.VertexAttribPointer(0, 3, VertexAttribPointerType.Float, true, Vector3.SizeInBytes, 0); - GL.BindAttribLocation(shaderProgramHandle, 0, "in_position"); GL.EnableVertexAttribArray(1); GL.BindBuffer(BufferTarget.ArrayBuffer, normalVboHandle); GL.VertexAttribPointer(1, 3, VertexAttribPointerType.Float, true, Vector3.SizeInBytes, 0); - GL.BindAttribLocation(shaderProgramHandle, 1, "in_normal"); GL.BindBuffer(BufferTarget.ElementArrayBuffer, eboHandle);