

while (!glfwWindowShouldClose(handle)) glfwWaitEvents();

glfwInit();
long handle = glfwCreateWindow(800, 600, "Demo", NULL, NULL);
new Thread(() -> {
  glfwMakeContextCurrent(handle);
  GL.createCapabilities();
  int shader = loadShaders();
  int vao = createVao();
  while (!glfwWindowShouldClose(handle)) {
    glUseProgram(shader);
    glBindVertexArray(vao);
    glDrawArrays(GL_TRIANGLES, 0, 3);
    glfwSwapBuffers(handle);
    glfwPollEvents();
  }
}).start();