title: OpenTK redrawing while window is resized
body: <p>I'm writing a project using OpenTK as its graphics library.</p>
  
  <p>When I resize an <code>OpenTK.GameWindow</code>, the frame doesn't update until the cursor is released. As a result, parts of the viewport are either clipped (when sizing smaller) or filled in with black (when sizing larger). I'm currently following the <a href="https://opentk.net/learn/chapter1/index.html" rel="nofollow noreferrer">learn OpenTK tutorial</a> and have completed drawing a triangle, having derived a new child class of <code>OpenTK.GameWindow</code>.</p>
  
  <p>Here are some of the <code>OpenTK.GameWindow</code> events I've overridden with drawing logic:</p>
  
  <pre><code>        protected override void OnLoad(EventArgs e)
      {
          GL.ClearColor(0.2f, 0.3f, 0.3f, 1.0f);
  
          VertexBufferObject = GL.GenBuffer();
          GL.BindBuffer(BufferTarget.ArrayBuffer, VertexBufferObject);
          GL.BufferData(BufferTarget.ArrayBuffer, vertices.Length * sizeof(float), vertices, BufferUsageHint.StaticDraw);
  
          shader = new Shader("Shaders\\shader.vert", "Shaders\\shader.frag");
          shader.Use();
  
          VertexArrayObject = GL.GenVertexArray();
          GL.BindVertexArray(VertexArrayObject);
          GL.VertexAttribPointer(0, 3, VertexAttribPointerType.Float, false, 3 * sizeof(float), 0);
          GL.EnableVertexAttribArray(0);
          GL.BindBuffer(BufferTarget.ArrayBuffer, VertexBufferObject);
  
          base.OnLoad(e);
      }
  
      protected override void OnUnload(EventArgs e)
      {
          GL.BindBuffer(BufferTarget.ArrayBuffer, 0);
          GL.BindVertexArray(0);
          GL.UseProgram(0);
  
          GL.DeleteBuffer(VertexBufferObject);
          GL.DeleteBuffer(VertexArrayObject);
  
          shader.Dispose();
          base.OnUnload(e);
      }
  
      protected override void OnRenderFrame(FrameEventArgs e)
      {
          GL.Clear(ClearBufferMask.ColorBufferBit);
  
          shader.Use();
          GL.BindVertexArray(VertexArrayObject);
          GL.DrawArrays(PrimitiveType.Triangles, 0, 3);
  
          Context.SwapBuffers();
  
          base.OnRenderFrame(e);
      }
  
      protected override void OnResize(EventArgs e)
      {
          GL.Viewport(0, 0, Width, Height);
          base.OnResize(e);
      }
  </code></pre>
  
  <p>Should I be putting some logic in <code>OnUpdateFrame</code> to resolve this problem? It seems like <code>OnResize</code> doesn't trigger until the window is no longer being resized.</p>
  
  <p>There seems to be <a href="https://www.glfw.org/docs/latest/group__window.html" rel="nofollow noreferrer">some information</a> returned by google regarding this subject that I'm not sure how to follow up with:</p>
  
  <blockquote>
    <p>On some platforms, a window move, resize or menu operation will cause event processing to block. This is due to how event processing is designed on those platforms. You can use the window refresh callback to redraw the contents of your window when necessary during such operations.</p>
  </blockquote>