Skip to content
Snippets Groups Projects
Commit 32583297 authored by faiface's avatar faiface
Browse files

add Init function

parent b81eba03
No related branches found
No related tags found
No related merge requests found
......@@ -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.
//
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment