Add glfwPostEmptyEvent() support.
1 file changed
tree: 09d1bb9e02a0cb9e903a34bcd940e6d18dcca10b
  1. v3.0/
  2. AUTHORS
  3. clipboard.go
  4. context.go
  5. error.c
  6. error.go
  7. glfw.go
  8. input.c
  9. input.go
  10. LICENSE
  11. monitor.c
  12. monitor.go
  13. native_darwin.go
  14. native_linbsd.go
  15. native_windows.go
  16. README.md
  17. time.go
  18. util.go
  19. window.c
  20. window.go
README.md

Go Bindings for GLFW 3

  • Warning: This branch is not backward compatible. See changelog for API breaking changes.
  • See here for documentation.
  • You can help by submitting examples to go-gl/examples.

Remarks

  • Mingw64 users should rename glfw3dll.a to libglfw3dll.a.
  • In Windows and Linux, if you compile GLFW yourself, use -DBUILD_SHARED_LIBS=on with cmake in order to build the dynamic libraries.
  • Some functions -which are marked in the documentation- can be called only from the main thread. Click here for how.
  • In OS X, you can install Go and GLFW via Homebrew.
$ brew install go
$ brew tap homebrew/versions
$ brew install --build-bottle --static glfw3
$ go get github.com/go-gl/glfw3

Example

package main

import (
	glfw "github.com/go-gl/glfw3"
)

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()
	}
}

Changelog

  • SetErrorCallback This function is removed. The callback is now set internally. Functions return an error with corresponding code and description (do a type assertion to GlfwError for accessing the variables).
  • Init Returns an error instead of bool.
  • GetTime Returns an error.
  • GetCurrentContext No longer returns an error.
  • GetJoystickAxes No longer returns an error.
  • GetJoystickButtons No longer returns an error.
  • GetJoystickName No longer returns an error.
  • window.GetMonitor No longer returns an error.
  • window.GetAttribute Returns an error.
  • window.SetCharacterCallback Accepts rune instead of uint.