Update doc URL for new import path
1 file changed
tree: dfcfe1cec66eb83573fa8fd585d0c955ca1eab2f
  1. glfw/
  2. v3.0/
  3. AUTHORS
  4. build.go
  5. cocoainit_darwin.go
  6. cocoamonitor_darwin.go
  7. cocoawindow_darwin.go
  8. context.go
  9. error.c
  10. error.go
  11. glfw.go
  12. GLFW_C_REVISION.txt
  13. glfw_context.c
  14. glfw_egl_context.c
  15. glfw_glx_context.c
  16. glfw_init.c
  17. glfw_input.c
  18. glfw_linux_joystick.c
  19. glfw_mach_time.c
  20. glfw_monitor.c
  21. glfw_posix_time.c
  22. glfw_posix_tls.c
  23. glfw_wgl_context.c
  24. glfw_win32_init.c
  25. glfw_win32_monitor.c
  26. glfw_win32_time.c
  27. glfw_win32_tls.c
  28. glfw_win32_window.c
  29. glfw_window.c
  30. glfw_winmm_joystick.c
  31. glfw_wl_init.c
  32. glfw_wl_monitor.c
  33. glfw_wl_window.c
  34. glfw_x11_init.c
  35. glfw_x11_monitor.c
  36. glfw_x11_window.c
  37. glfw_xkb_unicode.c
  38. input.c
  39. input.go
  40. iokitjoystick_darwin.go
  41. LICENSE
  42. monitor.c
  43. monitor.go
  44. native_darwin.go
  45. native_linbsd.go
  46. native_windows.go
  47. nsglcontext_darwin.go
  48. README.md
  49. time.go
  50. util.go
  51. window.c
  52. window.go
README.md

Go Bindings for GLFW 3.1

  • ATTENTION: As of GLFW 3.1 we break API. See Changelog below.
  • See here for documentation.
  • You can help by submitting examples to go-gl/examples.

Installation

  • Installation is easy, just 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)!
  • Go 1.4 is required on Windows (otherwise you must use MinGW v4.8.1 exactly, see Go issue 8811).

Usage

package main

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

func init() {
	// This is needed to arrange that main() runs on main thread.
	// See documentation for functions that are only allowed to be called from the main thread.
	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()
	}
}

Changelog

  • Easy go get installation. GLFW source code is now included in-repo and compiled in so you don't have to build GLFW on your own and distribute shared libraries. The revision of GLFW C library used is listed in GLFW_C_REVISION.txt file.
  • The error callback is now set internally. Functions return an error with corresponding code and description (do a type assertion to glfw3.Error for accessing the variables) if the error is recoverable. If not a panic will occur.

GLFW 3.1 Specfic Changes

  • Added type Cursor.
  • Added function Window.SetDropCallback.
  • Added function Window.SetCharModsCallback.
  • Added function PostEmptyEvent.
  • Added function CreateCursor.
  • Added function CreateStandardCursor.
  • Added function Cursor.Destroy.
  • Added function Window.SetCursor.
  • Added function Window.GetFrameSize.
  • Added window hint Floating.
  • Added window hint AutoIconify.
  • Added window hint ContextReleaseBehavior.
  • Added window hint DoubleBuffer.
  • Added hint value AnyReleaseBehavior.
  • Added hint value ReleaseBehaviorFlush.
  • Added hint value ReleaseBehaviorNone.
  • Added hint value DontCare.

API changes

  • Window.Iconfiy Returns an error.
  • Window.Restore Returns an error.
  • Init Returns an error instead of bool.
  • GetJoystickAxes No longer returns an error.
  • GetJoystickButtons No longer returns an error.
  • GetJoystickName No longer returns an error.
  • GetMonitors No longer returns an error.
  • GetPrimaryMonitor No longer returns an error.
  • Monitor.GetGammaRamp No longer returns an error.
  • Monitor.GetVideoMode No longer returns an error.
  • Monitor.GetVideoModes No longer returns an error.
  • GetCurrentContext No longer returns an error.
  • Window.SetCharCallback Accepts rune instead of uint.
  • Added type Error.
  • Removed SetErrorCallback.
  • Removed error code NotInitialized.
  • Removed error code NoCurrentContext.
  • Removed error code InvalidEnum.
  • Removed error code InvalidValue.
  • Removed error code OutOfMemory.
  • Removed error code PlatformError.
  • Removed KeyBracket.
  • Renamed Window.SetCharacterCallback to Window.SetCharCallback.
  • Renamed Window.GetCursorPosition to GetCursorPos.
  • Renamed Window.SetCursorPosition to SetCursorPos.
  • Renamed CursorPositionCallback to CursorPosCallback.
  • Renamed Window.SetCursorPositionCallback to SetCursorPosCallback.
  • Renamed VideoMode to VidMode.
  • Renamed Monitor.GetPosition to Monitor.GetPos.
  • Renamed Window.GetPosition to Window.GetPos.
  • Renamed Window.SetPosition to Window.SetPos.
  • Renamed Window.GetAttribute to Window.GetAttrib.
  • Renamed Window.SetPositionCallback to Window.SetPosCallback.
  • Renamed PositionCallback to PosCallback.
  • Ranamed Cursor to CursorMode.
  • Renamed StickyKeys to StickyKeysMode.
  • Renamed StickyMouseButtons to StickyMouseButtonsMode.
  • Renamed ApiUnavailable to APIUnavailable.
  • Renamed ClientApi to ClientAPI.
  • Renamed OpenglForwardCompatible to OpenGLForwardCompatible.
  • Renamed OpenglDebugContext to OpenGLDebugContext.
  • Renamed OpenglProfile to OpenGLProfile.
  • Renamed SrgbCapable to SRGBCapable.
  • Renamed OpenglApi to OpenGLAPI.
  • Renamed OpenglEsApi to OpenGLESAPI.
  • Renamed OpenglAnyProfile to OpenGLAnyProfile.
  • Renamed OpenglCoreProfile to OpenGLCoreProfile.
  • Renamed OpenglCompatProfile to OpenGLCompatProfile.
  • Renamed KeyKp... to KeyKP....