Documentation ¶
Index ¶
- Variables
- func Context() gl.Context
- func Duration(d time.Duration) func(Animator)
- func ExpDecay(t float64) float64
- func Interp(fn func(float64) float64) func(Animator)
- func MustOpen(name string) asset.File
- func MustReadAll(filename string) []byte
- func Notify(p *uint32) func(Animator)
- func Ntou(n float32) float32
- func RGBA(c color.Color) (r, g, b, a float32)
- func RotateAt(angle float32, axis f32.Vec3) func(Transformer)
- func RotateBy(angle float32, axis f32.Vec3) func(Transformer)
- func RotateTo(angle float32, axis f32.Vec3) func(Transformer)
- func ScaleAt(v f32.Vec4) func(Transformer)
- func ScaleBy(v f32.Vec4) func(Transformer)
- func ScaleTo(v f32.Vec4) func(Transformer)
- func ShearAt(v f32.Vec4) func(Transformer)
- func ShearBy(v f32.Vec4) func(Transformer)
- func ShearTo(v f32.Vec4) func(Transformer)
- func TextureFilter(min, mag int) func(*Texture)
- func TextureWrap(s, t int) func(*Texture)
- func Tick(d time.Duration) func(Animator)
- func To(t Transform) func(Transformer)
- func TranslateAt(v f32.Vec4) func(Transformer)
- func TranslateBy(v f32.Vec4) func(Transformer)
- func TranslateTo(v f32.Vec4) func(Transformer)
- func Uton(u float32) float32
- func Vec2(v0, v1 float32) f32.Vec2
- func Vec3(v0, v1, v2 float32) f32.Vec3
- func Vec4(v0, v1, v2, v3 float32) f32.Vec4
- func With(glctx gl.Context) gl.Context
- type A2fv
- type A3fv
- type A4fv
- type Animator
- type FPS
- type FloatBuffer
- type FragAsset
- type FragSrc
- type FrameBuffer
- type Program
- func (prg Program) Attrib(name string) gl.Attrib
- func (prg *Program) Build(vsrc VertSrc, fsrc FragSrc) error
- func (prg *Program) BuildAssets(vtag VertAsset, ftag FragAsset) error
- func (prg Program) Delete()
- func (prg *Program) Install(vsrc VertSrc, fsrc FragSrc) error
- func (prg *Program) MustBuild(vsrc VertSrc, fsrc FragSrc)
- func (prg *Program) MustBuildAssets(vtag VertAsset, ftag FragAsset)
- func (prg Program) Uniform(name string) gl.Uniform
- func (prg Program) Unmarshal(dst interface{})
- func (prg Program) Use()
- type Sampler
- type Side
- type T
- type Texture
- func (tex Texture) At(x, y int) color.Color
- func (tex Texture) Bind()
- func (tex Texture) Bounds() image.Rectangle
- func (tex Texture) ColorModel() color.Model
- func (tex *Texture) Create(options ...func(*Texture))
- func (tex *Texture) Delete()
- func (tex *Texture) DrawSrc(src *image.RGBA)
- func (tex Texture) GenerateMipmap()
- func (tex Texture) Unbind()
- func (tex *Texture) Upload(src *image.RGBA)
- type Transform
- func (a *Transform) RotateBy(angle float32, axis f32.Vec3)
- func (a *Transform) RotateTo(angle float32, axis f32.Vec3)
- func (a *Transform) ScaleBy(v f32.Vec4)
- func (a *Transform) ScaleTo(v f32.Vec4)
- func (a *Transform) ShearBy(v f32.Vec4)
- func (a *Transform) ShearTo(v f32.Vec4)
- func (a *Transform) TranslateBy(v f32.Vec4)
- func (a *Transform) TranslateTo(v f32.Vec4)
- type Transformer
- type U16fv
- func (u U16fv) Animator(options ...func(Animator)) Animator
- func (u U16fv) At() Transform
- func (u *U16fv) Inv2f(nx, ny float32) (float32, float32)
- func (u *U16fv) Ortho(l, r float32, b, t float32, n, f float32)
- func (u U16fv) Stage(epoch time.Time, transforms ...func(Transformer))
- func (u U16fv) Step(now time.Time) (ok bool)
- func (u U16fv) String() string
- func (u U16fv) Transform(transforms ...func(Transformer))
- func (u *U16fv) Update()
- type U1f
- type U1i
- type U2fv
- type U2i
- type U3fv
- type U3i
- type U4fv
- type U4i
- type U9fv
- type UintBuffer
- type Uniform
- type VertAsset
- type VertSrc
- type VertexArray
- type VertexElement
- func (vert *VertexElement) Bind()
- func (vert *VertexElement) Create(usage gl.Enum, size int, floats []float32, uints []uint32)
- func (vert VertexElement) Delete()
- func (vert VertexElement) Draw(mode gl.Enum)
- func (vert VertexElement) Unbind()
- func (vert *VertexElement) Update(floats []float32, uints []uint32)
Constants ¶
This section is empty.
Variables ¶
var ( FilterNearest = TextureFilter(gl.NEAREST, gl.NEAREST) FilterLinear = TextureFilter(gl.LINEAR, gl.LINEAR) WrapClamp = TextureWrap(gl.CLAMP_TO_EDGE, gl.CLAMP_TO_EDGE) WrapRepeat = TextureWrap(gl.REPEAT, gl.REPEAT) )
var ErrNotZero = errors.New("Metric distance not zero")
Functions ¶
func MustReadAll ¶
MustReadAll reads the file named by filename from assets and returns the contents or panics on error.
func ScaleAt ¶
func ScaleAt(v f32.Vec4) func(Transformer)
func ScaleBy ¶
func ScaleBy(v f32.Vec4) func(Transformer)
func ScaleTo ¶
func ScaleTo(v f32.Vec4) func(Transformer)
func ShearAt ¶
func ShearAt(v f32.Vec4) func(Transformer)
func ShearBy ¶
func ShearBy(v f32.Vec4) func(Transformer)
func ShearTo ¶
func ShearTo(v f32.Vec4) func(Transformer)
func TextureFilter ¶
func TextureWrap ¶
func To ¶
func To(t Transform) func(Transformer)
func TranslateAt ¶
func TranslateAt(v f32.Vec4) func(Transformer)
func TranslateBy ¶
func TranslateBy(v f32.Vec4) func(Transformer)
func TranslateTo ¶
func TranslateTo(v f32.Vec4) func(Transformer)
Types ¶
type Animator ¶
type Animator interface { // Apply sets default options on animator. Any animation in progress is cancelled // first unless the length of options is zero, then this call has no effect. Apply(options ...func(Animator)) Tick(time.Duration) Duration(time.Duration) // Interp defaults to exponential decay. Interp(func(float64) float64) Notify(*uint32) At() Transform Start(transforms ...func(Transformer)) Stage(epoch time.Time, transforms ...func(Transformer)) Step(now time.Time) bool Cancel() }
type FloatBuffer ¶
func (*FloatBuffer) Bind ¶
func (buf *FloatBuffer) Bind()
func (FloatBuffer) Delete ¶
func (buf FloatBuffer) Delete()
func (FloatBuffer) Draw ¶
func (buf FloatBuffer) Draw(mode gl.Enum)
func (FloatBuffer) Unbind ¶
func (buf FloatBuffer) Unbind()
func (*FloatBuffer) Update ¶
func (buf *FloatBuffer) Update(data []float32)
type FragAsset ¶
type FragAsset string
FragAsset is a filename in assets containing fragment shader source code.
type FrameBuffer ¶
type FrameBuffer struct { gl.Framebuffer // contains filtered or unexported fields }
func (*FrameBuffer) Attach ¶
func (buf *FrameBuffer) Attach()
func (*FrameBuffer) Create ¶
func (buf *FrameBuffer) Create(options ...func(*Texture))
func (*FrameBuffer) Delete ¶
func (buf *FrameBuffer) Delete()
func (*FrameBuffer) Detach ¶
func (buf *FrameBuffer) Detach()
func (*FrameBuffer) RGBA ¶
func (buf *FrameBuffer) RGBA() *image.RGBA
func (*FrameBuffer) Update ¶
func (buf *FrameBuffer) Update(width, height int)
type Program ¶
Program identifies a compiled shader program. The bool Program.Init can be used to check if valid.
func (*Program) BuildAssets ¶
BuildAssets is a helper that wraps Program.Build with asset file contents of filenames vtag and ftag.
func (Program) Delete ¶
func (prg Program) Delete()
Delete frees the memory and invalidates the name associated with the program.
func (*Program) MustBuildAssets ¶
MustBuildAssets is a helper that wraps Program.BuildAssets and panics on error.
type Texture ¶
func (Texture) ColorModel ¶
func (Texture) GenerateMipmap ¶
func (tex Texture) GenerateMipmap()
type Transform ¶
TODO this is essentially type Sheet, but should vectors be tucked behind Transform type ???
func TransformIdent ¶
func TransformIdent() (a Transform)
func (*Transform) TranslateBy ¶
func (*Transform) TranslateTo ¶
type Transformer ¶
type Transformer interface { To(Transform) TranslateAt(f32.Vec4) TranslateBy(f32.Vec4) TranslateTo(f32.Vec4) ShearAt(f32.Vec4) ShearBy(f32.Vec4) ShearTo(f32.Vec4) RotateAt(angle float32, axis f32.Vec3) RotateBy(angle float32, axis f32.Vec3) RotateTo(angle float32, axis f32.Vec3) ScaleAt(f32.Vec4) ScaleBy(f32.Vec4) ScaleTo(f32.Vec4) }
type U16fv ¶
type U16fv struct {
// contains filtered or unexported fields
}
func (U16fv) Stage ¶
func (u U16fv) Stage(epoch time.Time, transforms ...func(Transformer))
func (U16fv) Transform ¶
func (u U16fv) Transform(transforms ...func(Transformer))
type U1f ¶
type U1f struct {
// contains filtered or unexported fields
}
func (U1f) Stage ¶
func (u U1f) Stage(epoch time.Time, transforms ...func(Transformer))
func (U1f) Transform ¶
func (u U1f) Transform(transforms ...func(Transformer))
type UintBuffer ¶
func (*UintBuffer) Bind ¶
func (buf *UintBuffer) Bind()
func (UintBuffer) Delete ¶
func (buf UintBuffer) Delete()
func (UintBuffer) Draw ¶
func (buf UintBuffer) Draw(mode gl.Enum)
func (UintBuffer) Unbind ¶
func (buf UintBuffer) Unbind()
func (*UintBuffer) Update ¶
func (buf *UintBuffer) Update(data []uint32)
type Uniform ¶
type Uniform interface { // Animator allows setting additional options. Animator(options ...func(Animator)) Animator // Stage transforms to occur the next time Step is called. // Previously staged transforms or animations in progress // are cancelled with each call. Stage(epoch time.Time, transforms ...func(Transformer)) // Step through staged transforms, returning true if work // was performed. The first false result returned performs // work to animate to final destination; subsequent calls // do not perform any work. Step(now time.Time) (ok bool) // Transform immediately starts an animation in a separate // goroutine, cancelling any staged transforms or animations // currently in progress. Transform(transforms ...func(Transformer)) }
type VertAsset ¶
type VertAsset string
VertAsset is a filename in assets containing vertex shader source code.
type VertexArray ¶
type VertexArray struct { gl.Attrib Floats FloatBuffer // contains filtered or unexported fields }
func (*VertexArray) Bind ¶
func (vert *VertexArray) Bind()
func (*VertexArray) Create ¶
func (vert *VertexArray) Create(usage gl.Enum, size int, floats []float32)
func (VertexArray) Delete ¶
func (vert VertexArray) Delete()
func (VertexArray) Draw ¶
func (vert VertexArray) Draw(mode gl.Enum)
func (VertexArray) Unbind ¶
func (vert VertexArray) Unbind()
func (*VertexArray) Update ¶
func (vert *VertexArray) Update(floats []float32)
type VertexElement ¶
type VertexElement struct { gl.Attrib Floats FloatBuffer Uints UintBuffer // contains filtered or unexported fields }
func (*VertexElement) Bind ¶
func (vert *VertexElement) Bind()
func (VertexElement) Delete ¶
func (vert VertexElement) Delete()
func (VertexElement) Draw ¶
func (vert VertexElement) Draw(mode gl.Enum)
func (VertexElement) Unbind ¶
func (vert VertexElement) Unbind()
func (*VertexElement) Update ¶
func (vert *VertexElement) Update(floats []float32, uints []uint32)