From a3e76569226c90ce50e4281649290a2569570e89 Mon Sep 17 00:00:00 2001
From: faiface <faiface@ksp.sk>
Date: Sat, 3 Dec 2016 15:38:33 +0100
Subject: [PATCH] remove orphan functions from pixelgl (use OpenGL directly
 instead)

---
 pixelgl/orphan.go | 20 --------------------
 window.go         | 12 ++++++++----
 2 files changed, 8 insertions(+), 24 deletions(-)
 delete mode 100644 pixelgl/orphan.go

diff --git a/pixelgl/orphan.go b/pixelgl/orphan.go
deleted file mode 100644
index 8e4f95a..0000000
--- a/pixelgl/orphan.go
+++ /dev/null
@@ -1,20 +0,0 @@
-package pixelgl
-
-import "github.com/go-gl/gl/v3.3-core/gl"
-
-// This file defines functions that can operate without a parent Doer.
-
-// Clear clears the current OpenGL context.
-func Clear(r, g, b, a float32) {
-	DoNoBlock(func() {
-		gl.ClearColor(r, g, b, a)
-		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 a85fcaa..c6104e2 100644
--- a/window.go
+++ b/window.go
@@ -5,6 +5,7 @@ import (
 	"sync"
 
 	"github.com/faiface/pixel/pixelgl"
+	"github.com/go-gl/gl/v3.3-core/gl"
 	"github.com/go-gl/glfw/v3.2/glfw"
 	"github.com/pkg/errors"
 )
@@ -128,7 +129,10 @@ func (w *Window) Delete() {
 // Clear clears the window with a color.
 func (w *Window) Clear(c color.Color) {
 	w.Do(func(pixelgl.Context) {
-		pixelgl.Clear(colorToRGBA(c))
+		pixelgl.DoNoBlock(func() {
+			gl.ClearColor(colorToRGBA(c))
+			gl.Clear(gl.COLOR_BUFFER_BIT)
+		})
 	})
 }
 
@@ -141,10 +145,10 @@ func (w *Window) Update() {
 			}
 			w.window.SwapBuffers()
 			glfw.PollEvents()
-		})
 
-		w, h := w.window.GetSize()
-		pixelgl.SetViewport(0, 0, int32(w), int32(h))
+			w, h := w.window.GetSize()
+			gl.Viewport(0, 0, int32(w), int32(h))
+		})
 	})
 }
 
-- 
GitLab