From 26c44125cf85a9a3c5d567dfb535dbafeb0ea5c7 Mon Sep 17 00:00:00 2001
From: faiface <faiface@ksp.sk>
Date: Sat, 3 Dec 2016 02:02:52 +0100
Subject: [PATCH] fix window viewport

---
 pixelgl/orphan.go | 7 +++++++
 window.go         | 3 +++
 2 files changed, 10 insertions(+)

diff --git a/pixelgl/orphan.go b/pixelgl/orphan.go
index b67f8fc..8e4f95a 100644
--- a/pixelgl/orphan.go
+++ b/pixelgl/orphan.go
@@ -11,3 +11,10 @@ func Clear(r, g, b, a float32) {
 		gl.Clear(gl.COLOR_BUFFER_BIT)
 	})
 }
+
+// SetViewport sets the OpenGL viewport.
+func SetViewport(x, y, w, h int32) {
+	DoNoBlock(func() {
+		gl.Viewport(x, y, w, h)
+	})
+}
diff --git a/window.go b/window.go
index eadc0da..a85fcaa 100644
--- a/window.go
+++ b/window.go
@@ -142,6 +142,9 @@ func (w *Window) Update() {
 			w.window.SwapBuffers()
 			glfw.PollEvents()
 		})
+
+		w, h := w.window.GetSize()
+		pixelgl.SetViewport(0, 0, int32(w), int32(h))
 	})
 }
 
-- 
GitLab