snippets

package
v0.0.0-...-6c7272e Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 13, 2022 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Overview

Package snippets exposes functions for building simple GLES command streams.

Index

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

func NewBuilder(ctx context.Context, dev *device.Instance) *Builder

NewBuilder returns a new builder.

func (*Builder) Add

func (b *Builder) Add(cmds ...api.Cmd) api.CmdID

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

func (b *Builder) Capture(ctx context.Context, name string) *path.Capture

Capture encodes and writes the command list to the database, returning an identifier to the newly constructed and stored Capture.

func (*Builder) ClearBackbuffer

func (b *Builder) ClearBackbuffer(ctx context.Context) (red, green, blue, black api.CmdID)

ClearBackbuffer returns the command list needed to sequentially clear the backbuffer to red, green, blue and black.

func (*Builder) ClearColor

func (b *Builder) ClearColor(red, green, blue, alpha gles.GLfloat) api.CmdID

ClearColor appends a the commands to clear the backbuffer with the given color.

func (*Builder) ClearDepth

func (b *Builder) ClearDepth() api.CmdID

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

func (b *Builder) DrawTexturedSquare(ctx context.Context) (draw, swap api.CmdID)

DrawTexturedSquare returns the command list needed draw a textured square.

func (*Builder) Last

func (b *Builder) Last() api.CmdID

Last returns the command identifier of the last added command.

func (*Builder) ResizeBackbuffer

func (b *Builder) ResizeBackbuffer(width, height int) api.CmdID

ResizeBackbuffer appends the commands to resize the backbuffer to the given dimensions.

func (*Builder) SwapBuffers

func (b *Builder) SwapBuffers() api.CmdID

SwapBuffers appends a call to eglSwapBuffers.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL