Documentation ¶
Overview ¶
Package snippets exposes functions for building simple GLES command streams.
Index ¶
- type Builder
- func (b *Builder) Add(cmds ...api.Cmd) api.CmdID
- func (b *Builder) AddAttributeVec3(ctx context.Context, prog gles.ProgramId, name string) gles.AttributeLocation
- func (b *Builder) AddUniformSampler(ctx context.Context, prog gles.ProgramId, name string) gles.UniformLocation
- func (b *Builder) Capture(ctx context.Context, name string) *path.Capture
- func (b *Builder) ClearBackbuffer(ctx context.Context) (red, green, blue, black api.CmdID)
- func (b *Builder) ClearColor(red, green, blue, alpha gles.GLfloat) api.CmdID
- func (b *Builder) ClearDepth() api.CmdID
- func (b *Builder) CreateContext(width, height int, shared, preserveBuffersOnSwap bool) (eglContext, eglSurface, eglDisplay memory.Pointer)
- func (b *Builder) CreateProgram(ctx context.Context, vertexShaderSource, fragmentShaderSource string) gles.ProgramId
- func (b *Builder) Data(ctx context.Context, v ...interface{}) api.AllocResult
- func (b *Builder) DrawTexturedSquare(ctx context.Context) (draw, swap api.CmdID)
- func (b *Builder) Last() api.CmdID
- func (b *Builder) ResizeBackbuffer(width, height int) api.CmdID
- func (b *Builder) SwapBuffers() api.CmdID
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Builder ¶
type Builder struct { Cmds []api.Cmd CB gles.CommandBuilder // contains filtered or unexported fields }
Builder is used to build OpenGL ES command snippets.
func NewBuilder ¶
NewBuilder returns a new builder.
func (*Builder) Add ¶
Add appends cmds to the command list, returning the command identifier of the first added command.
func (*Builder) AddAttributeVec3 ¶
func (b *Builder) AddAttributeVec3(ctx context.Context, prog gles.ProgramId, name string) gles.AttributeLocation
AddAttributeVec3 adds a vec3 attribute to the given program.
func (*Builder) AddUniformSampler ¶
func (b *Builder) AddUniformSampler(ctx context.Context, prog gles.ProgramId, name string) gles.UniformLocation
AddUniformSampler adds a sampler 2D uniform to the given program.
func (*Builder) Capture ¶
Capture encodes and writes the command list to the database, returning an identifier to the newly constructed and stored Capture.
func (*Builder) ClearBackbuffer ¶
ClearBackbuffer returns the command list needed to sequentially clear the backbuffer to red, green, blue and black.
func (*Builder) ClearColor ¶
ClearColor appends a the commands to clear the backbuffer with the given color.
func (*Builder) ClearDepth ¶
ClearDepth appends a the commands to clear the backbuffer depth map.
func (*Builder) CreateContext ¶
func (b *Builder) CreateContext(width, height int, shared, preserveBuffersOnSwap bool) (eglContext, eglSurface, eglDisplay memory.Pointer)
CreateContext appends the commands to create a new EGL context with the given parameters.
func (*Builder) CreateProgram ¶
func (b *Builder) CreateProgram(ctx context.Context, vertexShaderSource, fragmentShaderSource string) gles.ProgramId
CreateProgram appends the commands to create and link a new program.
func (*Builder) Data ¶
func (b *Builder) Data(ctx context.Context, v ...interface{}) api.AllocResult
Data allocates memory for the given values.
func (*Builder) DrawTexturedSquare ¶
DrawTexturedSquare returns the command list needed draw a textured square.
func (*Builder) ResizeBackbuffer ¶
ResizeBackbuffer appends the commands to resize the backbuffer to the given dimensions.
func (*Builder) SwapBuffers ¶
SwapBuffers appends a call to eglSwapBuffers.