Skip to content
/ gl-js Public
forked from goxjs/gl

Go cross-platform OpenGL bindings.

License

Notifications You must be signed in to change notification settings

fyne-io/gl-js

This branch is 50 commits ahead of, 1 commit behind goxjs/gl:main.

Folders and files

NameName
Last commit message
Last commit date

Latest commit

8b314af · Feb 8, 2025

History

91 Commits
Feb 8, 2025
Feb 8, 2025
Feb 8, 2025
May 18, 2015
Feb 8, 2025
May 16, 2022
Feb 8, 2025
Feb 8, 2025
Feb 8, 2025
Feb 8, 2025
Feb 8, 2025
Feb 8, 2025
Feb 8, 2025
Feb 8, 2025
Feb 8, 2025
Feb 8, 2025

Repository files navigation

Tests Static Analysis GoDoc

GL

Package gl is a Go cross-platform binding for OpenGL, with an OpenGL ES 2-like API.

It supports:

  • macOS, Linux and Windows via OpenGL 2.1 backend,

  • iOS and Android via OpenGL ES 2.0 backend,

  • Modern Browsers (desktop and mobile) via WebGL 1.0 backend.

This is a fork of golang.org/x/mobile/gl package with CL 8793 merged in and Windows support added. This package is fully functional, but may eventually become superceded by the new x/mobile/gl plan. It will exist and be fully supported until it can be safely replaced by a better package.

Installation

go get github.com/fyne-io/gl-js

Usage

This OpenGL binding has a ContextWatcher, which implements glfw.ContextWatcher interface. Recommended usage is with github.com/fyne-io/glfw-js package, which accepts a ContextWatcher in its Init, and takes on the responsibility of notifying it when context is made current or detached.

if err := glfw.Init(gl.ContextWatcher); err != nil {
	// Handle error.
}
defer glfw.Terminate()

If you're not using a ContextWatcher-aware glfw library, you must call methods of gl.ContextWatcher yourself whenever you make a context current or detached.

window.MakeContextCurrent()
gl.ContextWatcher.OnMakeCurrent(nil)

glfw.DetachCurrentContext()
gl.ContextWatcher.OnDetach()

About

Go cross-platform OpenGL bindings.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Go 100.0%