commit | e63db133c9b8c3bafaf8d0137ed10888a0848827 | [log] [tgz] |
---|---|---|
author | Stephen Gutekanst <stephen.gutekanst@gmail.com> | Sun Jan 18 20:39:08 2015 -0700 |
committer | Dmitri Shuralyov <shurcooL@gmail.com> | Sat Feb 21 18:51:43 2015 -0800 |
tree | 34d7643e5dc0d4ea1b0378d0c37c016fcad4dac9 | |
parent | 6519f8247a6291f803d082a6d994f7256a4039bd [diff] |
Add a stringer for ErrorCode. With this change we go from hard to reason about errors like: Error 65537: The GLFW library is not initialized To more clean ones: NotInitialized: The GLFW library is not initialized Note: can't use go:generate + stringer because they are C constants.
go get github.com/go-gl/glfw3
and be done (GLFW sources are included so you don't have to build GLFW on your own)!package main import ( "runtime" glfw "github.com/go-gl/glfw3" ) func init() { runtime.LockOSThread() } func main() { err := glfw.Init() if err != nil { panic(err) } defer glfw.Terminate() window, err := glfw.CreateWindow(640, 480, "Testing", nil, nil) if err != nil { panic(err) } window.MakeContextCurrent() for !window.ShouldClose() { // Do OpenGL stuff window.SwapBuffers() glfw.PollEvents() } }
The revision of GLFW C library used is listed in GLFW_C_REVISION.txt file.
Floating
and AutoIconify
window hints.go get
installation (GLFW source code included in-repo and compiled in so you don't have to build GLFW on your own first and you don't have to distribute shared libraries).