package glwidget
import "golang.org/x/exp/shiny/widget/glwidget"
Package glwidget provides a widget containing a GL ES framebuffer.
Index ¶
Types ¶
type GL ¶
GL is a widget that maintains an OpenGL ES context.
The Draw function is responsible for configuring the GL viewport and for publishing the result to the widget by calling the Publish method when the frame is complete. A typical draw function:
func(w *glwidget.GL) { w.Ctx.Viewport(0, 0, w.Rect.Dx(), w.Rect.Dy()) w.Ctx.ClearColor(0, 0, 0, 1) w.Ctx.Clear(gl.COLOR_BUFFER_BIT) // ... draw the frame w.Publish() }
The GL context is separate from the one used by the gldriver to render the window, and is only used by the glwidget package during initialization and for the duration of the Publish call. This means a glwidget user is free to use Ctx as a background GL context concurrently with the primary UI drawing done by the gldriver.
func NewGL ¶
NewGL creates a GL widget with a Draw function called when painted.
func (*GL) PaintBase ¶
func (*GL) Publish ¶
func (w *GL) Publish()
Publish renders the default framebuffer of Ctx onto the area of the window occupied by the widget.
Source Files ¶
glwidget.go
- Version
- v0.0.0-20250218142911-aa4b98e5adaa (latest)
- Published
- Feb 18, 2025
- Platform
- linux/amd64
- Imports
- 6 packages
- Last checked
- 1 month ago –
Tools for package owners.