Documentation
¶
Overview ¶
Package gl draws scenes with OpenGL 3.3 or OpenGL ES 3.0 into the framebuffer bound when Render is called: the one GTK's GtkGLArea binds while it emits its render signal. Every op of a scene is an instanced quad drawn by one shader (shader.glsl, compiled when the renderer starts), from the instances package gpu builds; clips are scissor rectangles, with the innermost rounded clip computed in the shader, as in packages d3d11 and metal. GL functions come from libepoxy, which GTK resolves its own through, called with purego (no cgo).
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func EffectSource ¶ added in v0.2.10
EffectSource returns the source of an effect's fragment shader, after the version header: shader.glsl with EFFECT defined, the head of effect.glsl, the effect's shader (see scene.Effect), and the tail, which draws its instances with it.
func ReadFramebuffer ¶
ReadFramebuffer returns the pixels of the bound framebuffer, width×height, as the CPU renderer draws them: premultiplied BGRA rows from the top. Tests compare them.
Types ¶
type Offscreen ¶ added in v0.2.10
type Offscreen struct {
// contains filtered or unexported fields
}
Offscreen is a GL context without a window, current on the thread that made it, which must stay locked to it, with a framebuffer bound: for drawing scenes in tests, as packages drawing effects do. EGL makes it with Mesa's surfaceless platform, which draws with llvmpipe without a GPU.
func NewOffscreen ¶ added in v0.2.10
NewOffscreen makes an OpenGL 3.3 context, or with es an OpenGL ES 3.0 one, current on the calling thread, and binds a framebuffer of w×h pixels.
type Presenter ¶
type Presenter struct {
// contains filtered or unexported fields
}
Presenter shows frames drawn in memory in the bound framebuffer: what a GtkGLArea shows when its content draws on the CPU after all, as when the GL renderer fails. GTK shows only what OpenGL draws into a GtkGLArea.
type Renderer ¶
type Renderer struct {
// contains filtered or unexported fields
}
Renderer draws scenes into the framebuffer bound when Render is called, with the GL context that was current when New was called. All its methods must be called with that context current.