Skip to content

Instantly share code, notes, and snippets.

@kiryl
Created March 1, 2014 22:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kiryl/9298365 to your computer and use it in GitHub Desktop.
Save kiryl/9298365 to your computer and use it in GitHub Desktop.
package main
import (
"runtime"
glfw "github.com/go-gl/glfw3"
gl "github.com/go3d/go-opengl/core"
)
func main() {
runtime.LockOSThread()
if !glfw.Init() {
panic("glfw.Init() failed!")
}
defer glfw.Terminate()
glfw.WindowHint(glfw.ContextVersionMajor, 3)
glfw.WindowHint(glfw.ContextVersionMinor, 2)
glfw.WindowHint(glfw.OpenglProfile, glfw.OpenglCoreProfile)
window, err := glfw.CreateWindow(300, 300, "test", nil, nil)
if err != nil {
panic(err)
}
defer window.Destroy()
window.MakeContextCurrent()
if !gl.Util.Init() {
panic("Failed to initialize at least OpenGL 3.2 or higher.")
}
gl.CreateProgram()
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment