Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CreateAttribs ¶
func CreateAttribs(gl *GL, data ObjectData) (map[string]*Attrib, error)
Types ¶
type Attrib ¶
type Attrib struct { Name string // Only needed when creating setters //Location js.Value Buffer *Buffer NumComponents int Type GLType Normalize bool Offset int Stride int }
Attrib is shader attribute
func CreateAttrib ¶
func CreateAttrib(gl *GL, name string, arr array.TypedArray, numComponents int, typ GLType) (*Attrib, error)
CreateAttrib from array
type Buffer ¶
type Buffer struct {
// contains filtered or unexported fields
}
func CreateBuffer ¶
CreateBuffer from js typed array Default bufferType should be gl.Types.ArrayBuffer Default drawType should be gl.Types.StaticDraw
type BufferInfo ¶
func CreateBufferInfo ¶
func CreateBufferInfo(gl *GL, data ObjectData) (*BufferInfo, error)
type GL ¶
type GL struct { Types GLTypes Width GLType Height GLType // contains filtered or unexported fields }
GL wrapper for WebGL
type GLTypes ¶
type GLTypes struct { StaticDraw GLType ArrayBuffer GLType ElementArrayBuffer GLType VertexShader GLType FragmentShader GLType DepthTest GLType ColorBufferBit GLType DepthBufferBit GLType Triangles GLType UnsignedShort GLType UnsignedByte GLType LineLoop GLType CompileStatus GLType LinkStatus GLType Float GLType FloatVec2 GLType FloatVec3 GLType FloatVec4 GLType Int GLType IntVec2 GLType IntVec3 GLType IntVec4 GLType Bool GLType BoolVec2 GLType BoolVec3 GLType BoolVec4 GLType FloatMat2 GLType FloatMat3 GLType FloatMat4 GLType Sampler2D GLType SamplerCube GLType Texture2D GLType TextureCubeMap GLType Texture0 GLType ActiveUniforms GLType ActiveAttributes GLType Rgba GLType TextureMinFilter GLType TextureMagFilter GLType Nearest GLType LEqual GLType }
GLTypes provides WebGL bindings.
type ObjectData ¶
type ObjectData struct { // vec4 in shader? Positions []float32 Normals []float32 TexCoords []float32 Indices []uint16 }
ObjectData vertices
type Program ¶
type Program struct { UniformSetters map[string]func(gl *GL, val any) AttribMap map[string]js.Value AttribSetters map[string]func(*Attrib) // contains filtered or unexported fields }
Program is a shader program.
func CreateProgram ¶
CreateProgram creates a new program from shader sources.
func (*Program) SetAttributes ¶
func (p *Program) SetAttributes(gl *GL, bufferInfo *BufferInfo)
func (*Program) SetBuffersAndAttributes ¶
func (p *Program) SetBuffersAndAttributes(gl *GL, bufferInfo *BufferInfo)
type Shader ¶
type Shader struct {
// contains filtered or unexported fields
}
Shader represents a WebGL shader.
func CreateShader ¶
CreateShader creates and compiles a WebGLShader.
type ShaderProgram ¶
func CreateShaderProgram ¶
func CreateShaderProgram(gl *GL, vertShader Shader, fragShader Shader) (p ShaderProgram, err error)
func (*ShaderProgram) JSValue ¶
func (p *ShaderProgram) JSValue() js.Value
type UniformInfo ¶
Click to show internal directories.
Click to hide internal directories.