Home

Awesome

GLFW 3.3 for Go Build Status GoDoc

Installation

go get -u github.com/go-gl/glfw/v3.3/glfw

OpenGL ES

If your target system only provides an OpenGL ES implementation (true for some ARM boards), you need to link against that implementation. You do this by defining the appropriate build tags, e.g.

go get -u -tags=gles2 github.com/go-gl/glfw/v3.3/glfw

Supported tags are gles1, gles2, gles3 and vulkan. Note that required packages might differ from those listed above; consult your hardware's documentation.

Usage

package main

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

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

GLFW 3.3 Specific Changes

GLFW 3.2 Specfic Changes

GLFW 3.1 Specfic Changes

API changes