diff --git a/pixelgl/frame.go b/pixelgl/frame.go index e8d663cdd96935122f3fb03ed9b4c010bb4fd1c0..b52150361a5bd3b590485c13f902662c4065e8d4 100644 --- a/pixelgl/frame.go +++ b/pixelgl/frame.go @@ -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 }