Merge pull request #101 from fastpars/master

fix #100. include X11/extensions/Xrandr.h
tree: 5abca2679623e3bbf95feb6a7527a4e601f55cd5
  1. AUTHORS
  2. clipboard.go
  3. context.go
  4. error.c
  5. error.go
  6. glfw.go
  7. input.c
  8. input.go
  9. LICENSE
  10. monitor.c
  11. monitor.go
  12. native_darwin.go
  13. native_linbsd.go
  14. native_windows.go
  15. README.md
  16. time.go
  17. util.go
  18. window.c
  19. window.go
README.md

Go Bindings for GLFW 3

  • This wrapper is now announced stable. There will be no API change until next major revision.
  • API breaking changes are in devel branch.
  • 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 (
	"fmt"
	glfw "github.com/go-gl/glfw3"
)

func errorCallback(err glfw.ErrorCode, desc string) {
	fmt.Printf("%v: %v\n", err, desc)
}

func main() {
	glfw.SetErrorCallback(errorCallback)

	if !glfw.Init() {
		panic("Can't init glfw!")
	}
	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()
	}
}