doc.go 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. // Copyright 2014 The Go Authors. All rights reserved.
  2. // Use of this source code is governed by a BSD-style
  3. // license that can be found in the LICENSE file.
  4. /*
  5. Package gl is a Go cross-platform binding for OpenGL, with an OpenGL ES 2-like API.
  6. It supports:
  7. - macOS, Linux and Windows via OpenGL 2.1 backend,
  8. - iOS and Android via OpenGL ES 2.0 backend,
  9. - Modern Browsers (desktop and mobile) via WebGL 1.0 backend.
  10. This is a fork of golang.org/x/mobile/gl package with [CL 8793](https://go-review.googlesource.com/8793)
  11. merged in and Windows support added. This package is fully functional, but may eventually become superceded by
  12. the new x/mobile/gl plan. It will exist and be fully supported until it can be safely replaced by a better package.
  13. Usage
  14. This OpenGL binding has a ContextWatcher, which implements [glfw.ContextWatcher](https://godoc.org/github.com/goxjs/glfw#ContextWatcher)
  15. interface. Recommended usage is with github.com/goxjs/glfw package, which accepts a ContextWatcher in its Init, and takes on the responsibility
  16. of notifying it when context is made current or detached.
  17. if err := glfw.Init(gl.ContextWatcher); err != nil {
  18. // Handle error.
  19. }
  20. defer glfw.Terminate()
  21. If you're not using a ContextWatcher-aware glfw library, you must call methods of gl.ContextWatcher yourself whenever
  22. you make a context current or detached.
  23. window.MakeContextCurrent()
  24. gl.ContextWatcher.OnMakeCurrent(nil)
  25. glfw.DetachCurrentContext()
  26. gl.ContextWatcher.OnDetach()
  27. */
  28. package gl // import "github.com/fyne-io/gl-js"