title: OpenTK - Transformation matrices
body: <p>I'm trying to create an editor for my game engine in C# WinForms using OpenTK and glControl. I'm trying to implemented the same code base in C#. I'm stuck at the transformation matrices in OpenTK.</p>
  
  <p>Here is the vertex shader</p>
  
  <pre><code>#version 330 core
  layout(location = 0) in vec3 position;
  layout(location = 1) in vec3 color;
  
  uniform mat4 model;
  uniform mat4 view;
  uniform mat4 projection;
  
  void main()
  {
      gl_Position = model * view * projection * vec4(position, 1.0f);
  }
  </code></pre>
  
  <p>And here is the code in C#</p>
  
  <pre><code>Matrix4 projectionMatrix;
  Matrix4 modelMatrix;
  Matrix4 viewMatrix;
  
  modelMatrix = Matrix4.Identity;
  viewMatrix = Matrix4.Identity;
  projectionMatrix = Matrix4.Identity;
  
  int modelLoc = GL.GetUniformLocation(shader.getProgram(), "model");
  GL.UniformMatrix4(modelLoc, false, ref modelMatrix);
  
  viewMatrix = Matrix4.LookAt(new Vector3(0, 0, 3), new Vector3(0, 0, 3) + new Vector3(0, 0, -1.0f), new Vector3(0, 1, 0));
  int viewLoc = GL.GetUniformLocation(shader.getProgram(), "view");
  GL.UniformMatrix4(viewLoc, false, ref viewMatrix);
  
  projectionMatrix = Matrix4.CreatePerspectiveFieldOfView(1.3f, glWindow.Width / (float)glWindow.Height, 1.0f, 40.0f);
  int projectionLoc = GL.GetUniformLocation(shader.getProgram(), "projection");
  GL.UniformMatrix4(viewLoc, false, ref projectionMatrix);
  </code></pre>
  
  <p>I dont know how OpenTK deals with matrices. Nothing is displayed in the viewport. I'm i setting the matrices correctly ? My code works very well in C++ using GLM. </p>