seed: github.com/qlova/seed/script/webgl Index | Files

package webgl

import "github.com/qlova/seed/script/webgl"

Index

Package Files

webgl.go

type Attribute Uses

type Attribute struct {
    qlova.Native
}

Attribute is a shader attribute.

type BindingPoint Uses

type BindingPoint string

BindingPoint is a buffer binding point / target.

type BitField Uses

type BitField string

BitField specifies a buffer bit field type.

type Buffer Uses

type Buffer struct {
    qlova.Native
}

Buffer is a GPU buffer.

type Context Uses

type Context struct {
    GL  string
    Q   script.Ctx

    ColorBufferBit                  BitField
    VertexShader, FragmentShader    ShaderType
    ArrayBuffer, ElementArrayBuffer BindingPoint

    StaticDraw UsagePattern

    Byte, Float DataType

    Triangles DrawMode
}

Context is a gl context for rendering to the screen.

func NewContext Uses

func NewContext(canvas script.Seed) Context

NewContext returns a gl context from the specified seed.

func (*Context) AttachShader Uses

func (ctx *Context) AttachShader(program Program, shader Shader)

AttachShader attaches a Shader to a Program.

func (*Context) BindBuffer Uses

func (ctx *Context) BindBuffer(target BindingPoint, buffer Buffer)

BindBuffer associates a buffer with a buffer target.

func (*Context) BufferData Uses

func (ctx *Context) BufferData(target BindingPoint, data qlova.List, usage UsagePattern)

BufferData creates a buffer in memory and initializes it with array data. If no array is provided, the contents of the buffer is initialized to 0. panics if data is not a Float List.

func (*Context) Clear Uses

func (ctx *Context) Clear(mask BitField)

Clear clears the mask.

func (*Context) ClearColor Uses

func (ctx *Context) ClearColor(red, green, blue, alpha qlova.Float)

ClearColor clears the color of the buffer.

func (*Context) CompileShader Uses

func (ctx *Context) CompileShader(shader Shader)

CompileShader compiles the GLSL shader source into binary data used by the GL Program.

func (*Context) CreateBuffer Uses

func (ctx *Context) CreateBuffer() Buffer

CreateBuffer creates and initializes a Buffer.

func (*Context) CreateProgram Uses

func (ctx *Context) CreateProgram() Program

CreateProgram creates an empty Program to which shaders can be bound.

func (*Context) CreateShader Uses

func (ctx *Context) CreateShader(T ShaderType) Shader

CreateShader returns an empty vertex or fragment shader object based on the type specified.

func (*Context) DrawArrays Uses

func (ctx *Context) DrawArrays(mode DrawMode, first, count qlova.Int)

DrawArrays renders geometric primitives from bound and enabled vertex data.

func (*Context) EnableVertexAttribArray Uses

func (ctx *Context) EnableVertexAttribArray(attribute Attribute)

EnableVertexAttribArray turns on a vertex attribute at a specific index position in a vertex attribute array.

func (*Context) GetAttribLocation Uses

func (ctx *Context) GetAttribLocation(program Program, attrib qlova.String) Attribute

GetAttribLocation returns a named attribute variable.

func (*Context) LinkProgram Uses

func (ctx *Context) LinkProgram(program Program)

LinkProgram links an attached vertex shader and an attached fragment shader to a program so it can be used by the graphics processing unit (GPU).

func (*Context) ShaderSource Uses

func (ctx *Context) ShaderSource(shader Shader, source qlova.String)

ShaderSource sets and replaces shader source code in a shader object.

func (*Context) UseProgram Uses

func (ctx *Context) UseProgram(program Program)

UseProgram sets the program object to use for rendering.

func (*Context) VertexAttribPointer Uses

func (ctx *Context) VertexAttribPointer(attribute Attribute, size qlova.Int, datatype DataType, normalized qlova.Bool, stride, offset qlova.Int)

VertexAttribPointer binds the buffer currently bound to gl.ArrayBuffer to a generic vertex attribute of the current vertex buffer object and specifies its layout.

func (*Context) Viewport Uses

func (ctx *Context) Viewport(x, y, w, h qlova.Float)

Viewport sets the viewport, which specifies the affine transformation of x and y from normalized device coordinates to window coordinates.

type DataType Uses

type DataType string

DataType specified the format of buffer data.

type DrawMode Uses

type DrawMode string

DrawMode specifying the primitive to render.

type Program Uses

type Program struct {
    qlova.Native
}

Program is a GPU program.

type Shader Uses

type Shader struct {
    qlova.Native
}

Shader is a GPU shader.

type ShaderType Uses

type ShaderType string

ShaderType is a type of shader.

type UsagePattern Uses

type UsagePattern string

UsagePattern specifies the intended usage pattern of the data store for optimization purposes.

Package webgl imports 3 packages (graph). Updated 2020-03-26. Refresh now. Tools for package owners.