Permalink
Browse files

[Examples] BindAttribLocation must precede LinkProgram

  • Loading branch information...
1 parent bc95477 commit 0e7f237d5e6937e24dda0a47313c6001921643d7 @thefiddler thefiddler committed Jan 30, 2014
Showing with 3 additions and 2 deletions.
  1. +3 −2 Source/Examples/OpenGL/3.x/HelloGL3.cs
View
5 Source/Examples/OpenGL/3.x/HelloGL3.cs
@@ -131,6 +131,9 @@ void CreateShaders()
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 CreateVAOs()
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);

0 comments on commit 0e7f237

Please sign in to comment.