I'm trying to write an OpenGL application in Go on MacOS, and can't figure out how to create a context with a version higher than OpenGL 2.1
I've tried using multiple OpenGL bindings out there, but settled on github.com/go-gl/gl
The below example will output 2.1 NVIDIA-8.12.47 310.40.00.05f01
. What do I need to do to create an OpenGL 3.2 context?
package main
import (
"fmt"
"github.com/go-gl/gl"
glfw "github.com/go-gl/glfw3"
)
func main() {
//request 3.2 context
glfw.WindowHint(glfw.ContextVersionMajor, 3)
glfw.WindowHint(glfw.ContextVersionMinor, 2)
glfw.WindowHint(glfw.OpenglProfile, glfw.OpenglCoreProfile)
if !glfw.Init() {
panic("glfw init failed")
}
defer glfw.Terminate()
//create and set window context
window, err := glfw.CreateWindow(64, 64, "foo", nil, nil)
if err != nil {
panic(err)
}
window.MakeContextCurrent()
//check version
version := gl.GetString(gl.VERSION)
fmt.Println(version)
}