From 325832977bb5316c1f4b2ddd8d4ff04fe1a5c769 Mon Sep 17 00:00:00 2001
From: faiface <faiface@ksp.sk>
Date: Wed, 23 Nov 2016 22:27:30 +0100
Subject: [PATCH] add Init function

---
 pixelgl/thread.go | 13 ++++++++++++-
 1 file changed, 12 insertions(+), 1 deletion(-)

diff --git a/pixelgl/thread.go b/pixelgl/thread.go
index 0dda9b9..a8a4e7b 100644
--- a/pixelgl/thread.go
+++ b/pixelgl/thread.go
@@ -4,7 +4,7 @@ import (
 	"errors"
 	"runtime"
 
-	"github.com/go-gl/gl/v2.1/gl"
+	"github.com/go-gl/gl/v3.3-core/gl"
 )
 
 // Due to the existance and usage of thread-local variables by OpenGL, it's recommended to
@@ -23,6 +23,17 @@ func init() {
 	}()
 }
 
+// Init initializes OpenGL by loading the function pointers from the active OpenGL context.
+//
+// It must be called under the presence of an active OpenGL context, e.g., always after calling window.MakeContextCurrent().
+// Also, always call this function when switching contexts.
+func Init() {
+	err := gl.Init()
+	if err != nil {
+		panic(err)
+	}
+}
+
 // Do executes a function inside a dedicated OpenGL thread.
 // Do blocks until the function finishes.
 //
-- 
GitLab