document pixelgl.Frame
@@ -8,12 +8,14 @@ import (
"github.com/go-gl/gl/v3.3-core/gl"
)
+// Frame is a fixed resolution texture that you can draw on.
type Frame struct {
fb binder
tex *Texture
width, height int
}
+// NewFrame creates a new fully transparent Frame with given dimensions.
func NewFrame(width, height int, smooth bool) *Frame {
f := &Frame{
fb: binder{
@@ -46,22 +48,29 @@ func (f *Frame) delete() {
})
}
+// Width returns the width of the Frame in pixels.
func (f *Frame) Width() int {
return f.width
}
+// Height returns the height of the Frame in pixels.
func (f *Frame) Height() int {
return f.height
}
+// Begin binds the Frame. All draw operations will target this Frame until End is called.
func (f *Frame) Begin() {
f.fb.bind()
}
+// End unbinds the Frame. All draw operations will go to whatever was bound before this Frame.
func (f *Frame) End() {
f.fb.restore()
}
+// Texture returns the Texture that this Frame draws to. The Texture changes as you use the Frame.
+//
+// The Texture pointer returned from this method is always the same.
func (f *Frame) Texture() *Texture {
return f.tex
}
