Skip to content
This repository
Browse code

[Examples] BindAttribLocation must precede LinkProgram

  • Loading branch information...
commit 0e7f237d5e6937e24dda0a47313c6001921643d7 1 parent bc95477
authored January 30, 2014

Showing 1 changed file with 3 additions and 2 deletions. Show diff stats Hide diff stats

  1. 5  Source/Examples/OpenGL/3.x/HelloGL3.cs
5  Source/Examples/OpenGL/3.x/HelloGL3.cs
@@ -131,6 +131,9 @@ void CreateShaders()
131 131
             GL.AttachShader(shaderProgramHandle, vertexShaderHandle);
132 132
             GL.AttachShader(shaderProgramHandle, fragmentShaderHandle);
133 133
 
  134
+            GL.BindAttribLocation(shaderProgramHandle, 0, "in_position");
  135
+            GL.BindAttribLocation(shaderProgramHandle, 1, "in_normal");
  136
+
134 137
             GL.LinkProgram(shaderProgramHandle);
135 138
             Debug.WriteLine(GL.GetProgramInfoLog(shaderProgramHandle));
136 139
             GL.UseProgram(shaderProgramHandle);
@@ -183,12 +186,10 @@ void CreateVAOs()
183 186
             GL.EnableVertexAttribArray(0);
184 187
             GL.BindBuffer(BufferTarget.ArrayBuffer, positionVboHandle);
185 188
             GL.VertexAttribPointer(0, 3, VertexAttribPointerType.Float, true, Vector3.SizeInBytes, 0);
186  
-            GL.BindAttribLocation(shaderProgramHandle, 0, "in_position");
187 189
 
188 190
             GL.EnableVertexAttribArray(1);
189 191
             GL.BindBuffer(BufferTarget.ArrayBuffer, normalVboHandle);
190 192
             GL.VertexAttribPointer(1, 3, VertexAttribPointerType.Float, true, Vector3.SizeInBytes, 0);
191  
-            GL.BindAttribLocation(shaderProgramHandle, 1, "in_normal");
192 193
 
193 194
             GL.BindBuffer(BufferTarget.ElementArrayBuffer, eboHandle);
194 195
 

0 notes on commit 0e7f237

Please sign in to comment.
Something went wrong with that request. Please try again.