webgl

package
v0.0.3 Latest Latest
Warning

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

Go to latest
Published: Aug 26, 2026 License: AGPL-3.0 Imports: 7 Imported by: 0

Documentation

Rendered for js/wasm

Index

Constants

View Source
const ErrorNoContextFound = "failed to get WebGL context from canvas"

Variables

This section is empty.

Functions

This section is empty.

Types

type ActiveInfo

type ActiveInfo struct {
	Name string
	Size int
	Type Enum
}

type Bitfield

type Bitfield = int
const (
	DepthBufferBit   Bitfield = 0x00000100
	StencilBufferBit Bitfield = 0x00000400
	ColorBufferBit   Bitfield = 0x00004000
)

type Bridge

type Bridge struct {
	// contains filtered or unexported fields
}

Bridge exposes shared low-level context machinery to renderer packages. It is not a rendering API; WebGL and WebGL2 keep their public methods on their respective Context types.

func NewBridge

func NewBridge(context *Context) (bridge *Bridge)

NewBridge creates a low-level bridge over an existing context.

func (*Bridge) Bytes

func (b *Bridge) Bytes(values []byte) (result js.Value)

Bytes creates a Uint8Array view for a Go byte slice.

func (*Bridge) Call

func (b *Bridge) Call(method string, arguments ...any) (result js.Value)

Call submits queued commands and invokes a context method directly.

func (*Bridge) DeleteResource

func (b *Bridge) DeleteResource(id uint32)

DeleteResource removes a browser-owned object from the executor registry.

func (*Bridge) Direct

func (b *Bridge) Direct(method string, arguments ...any) (result js.Value)

Direct invokes a context method without submitting the command buffer.

func (*Bridge) Float32Array

func (b *Bridge) Float32Array(values []float32) (result js.Value)

Float32Array creates a Float32Array view for a Go slice.

func (*Bridge) Int32Array

func (b *Bridge) Int32Array(values []int32) (result js.Value)

Int32Array creates an Int32Array view for a Go slice.

func (*Bridge) RecordU32

func (b *Bridge) RecordU32(operation byte, values ...uint32) (recorded bool)

RecordU32 appends a fixed-width command while a frame is recording.

func (*Bridge) RegisterResource

func (b *Bridge) RegisterResource(value js.Value) (id uint32)

RegisterResource assigns an executor ID to a browser-owned object.

func (*Bridge) Uint32Array

func (b *Bridge) Uint32Array(values []uint32) (result js.Value)

Uint32Array creates a Uint32Array view for a Go slice.

type Buffer

type Buffer struct {
	// contains filtered or unexported fields
}

func (*Buffer) Value

func (b *Buffer) Value() (value js.Value)

Value exposes the browser object wrapped by a shared WebGL resource.

type Context

type Context struct {
	OnFrame           func(dt, width, height float64)
	OnContextLost     func()
	OnContextRestored func()
	// contains filtered or unexported fields
}

func GetContext

func GetContext(canvas *wasmdraw.CanvasElement, options *Options) (context *Context, err error)

GetContext creates a WebGL1 context and starts its frame lifecycle.

func NewContext

func NewContext(canvas *wasmdraw.CanvasElement, contextID string, options *Options) (context *Context, err error)

NewContext creates the shared WebGL base using a specific browser context ID.

func (*Context) ActiveTexture

func (c *Context) ActiveTexture(texture Enum) (self *Context)

func (*Context) AttachShader

func (c *Context) AttachShader(program *Program, shader *Shader) (self *Context)

func (*Context) BindAttribLocation

func (c *Context) BindAttribLocation(program *Program, index uint32, name string) (self *Context)

func (*Context) BindBuffer

func (c *Context) BindBuffer(target Enum, buffer *Buffer) (self *Context)

func (*Context) BindFramebuffer

func (c *Context) BindFramebuffer(target Enum, framebuffer *Framebuffer) (self *Context)

func (*Context) BindRenderbuffer

func (c *Context) BindRenderbuffer(target Enum, renderbuffer *Renderbuffer) (self *Context)

func (*Context) BindTexture

func (c *Context) BindTexture(target Enum, texture *Texture) (self *Context)

func (*Context) BlendColor

func (c *Context) BlendColor(red, green, blue, alpha float64) (self *Context)

func (*Context) BlendEquation

func (c *Context) BlendEquation(mode Enum) (self *Context)

func (*Context) BlendEquationSeparate

func (c *Context) BlendEquationSeparate(rgb, alpha Enum) (self *Context)

func (*Context) BlendFunc

func (c *Context) BlendFunc(source, destination Enum) (self *Context)

func (*Context) BlendFuncSeparate

func (c *Context) BlendFuncSeparate(sourceRGB, destinationRGB, sourceAlpha, destinationAlpha Enum) (self *Context)

func (*Context) BufferData

func (c *Context) BufferData(target Enum, data []byte, usage Enum) (self *Context)

func (*Context) BufferDataFloat32

func (c *Context) BufferDataFloat32(target Enum, data []float32, usage Enum) (self *Context)

func (*Context) BufferDataFloat64

func (c *Context) BufferDataFloat64(target Enum, data []float64, usage Enum) (self *Context)

func (*Context) BufferDataInt16

func (c *Context) BufferDataInt16(target Enum, data []int16, usage Enum) (self *Context)

func (*Context) BufferDataInt32

func (c *Context) BufferDataInt32(target Enum, data []int32, usage Enum) (self *Context)

func (*Context) BufferDataSize

func (c *Context) BufferDataSize(target Enum, size Size, usage Enum) (self *Context)

func (*Context) BufferDataUint16

func (c *Context) BufferDataUint16(target Enum, data []uint16, usage Enum) (self *Context)

func (*Context) BufferDataUint32

func (c *Context) BufferDataUint32(target Enum, data []uint32, usage Enum) (self *Context)

func (*Context) BufferSubData

func (c *Context) BufferSubData(target Enum, offset Offset, data []byte) (self *Context)

func (*Context) BufferSubDataFloat32

func (c *Context) BufferSubDataFloat32(target Enum, offset Offset, data []float32) (self *Context)

func (*Context) BufferSubDataFloat64

func (c *Context) BufferSubDataFloat64(target Enum, offset Offset, data []float64) (self *Context)

func (*Context) BufferSubDataInt16

func (c *Context) BufferSubDataInt16(target Enum, offset Offset, data []int16) (self *Context)

func (*Context) BufferSubDataInt32

func (c *Context) BufferSubDataInt32(target Enum, offset Offset, data []int32) (self *Context)

func (*Context) BufferSubDataUint16

func (c *Context) BufferSubDataUint16(target Enum, offset Offset, data []uint16) (self *Context)

func (*Context) BufferSubDataUint32

func (c *Context) BufferSubDataUint32(target Enum, offset Offset, data []uint32) (self *Context)

func (*Context) CheckFramebufferStatus

func (c *Context) CheckFramebufferStatus(target Enum) (status Enum)

func (*Context) Clear

func (c *Context) Clear(mask Bitfield) (self *Context)

func (*Context) ClearColor

func (c *Context) ClearColor(red, green, blue, alpha float64) (self *Context)

func (*Context) ClearDepth

func (c *Context) ClearDepth(depth float64) (self *Context)

func (*Context) ClearStencil

func (c *Context) ClearStencil(stencil int) (self *Context)

func (*Context) ColorMask

func (c *Context) ColorMask(red, green, blue, alpha bool) (self *Context)

func (*Context) CompileShader

func (c *Context) CompileShader(shaderType Enum, source string) (shader *Shader, err error)

CompileShader compiles source and returns the browser diagnostic on failure.

func (*Context) CompressedTexImage2D

func (c *Context) CompressedTexImage2D(target Enum, level int, internalFormat Enum, width, height, border int, data []byte) (self *Context)

func (*Context) CompressedTexSubImage2D

func (c *Context) CompressedTexSubImage2D(target Enum, level, xOffset, yOffset, width, height int, format Enum, data []byte) (self *Context)

func (*Context) CopyTexImage2D

func (c *Context) CopyTexImage2D(target Enum, level int, internalFormat Enum, x, y, width, height, border int) (self *Context)

func (*Context) CopyTexSubImage2D

func (c *Context) CopyTexSubImage2D(target Enum, level, xOffset, yOffset, x, y, width, height int) (self *Context)

func (*Context) CreateBuffer

func (c *Context) CreateBuffer() (buffer *Buffer)

func (*Context) CreateFramebuffer

func (c *Context) CreateFramebuffer() (framebuffer *Framebuffer)

func (*Context) CreateProgram

func (c *Context) CreateProgram() (program *Program)

func (*Context) CreateRenderbuffer

func (c *Context) CreateRenderbuffer() (renderbuffer *Renderbuffer)

func (*Context) CreateShader

func (c *Context) CreateShader(shaderType Enum) (shader *Shader)

func (*Context) CreateTexture

func (c *Context) CreateTexture() (texture *Texture)

func (*Context) CullFace

func (c *Context) CullFace(mode Enum) (self *Context)

func (*Context) DeleteBuffer

func (c *Context) DeleteBuffer(buffer *Buffer)

func (*Context) DeleteFramebuffer

func (c *Context) DeleteFramebuffer(framebuffer *Framebuffer)

func (*Context) DeleteProgram

func (c *Context) DeleteProgram(program *Program)

func (*Context) DeleteRenderbuffer

func (c *Context) DeleteRenderbuffer(renderbuffer *Renderbuffer)

func (*Context) DeleteShader

func (c *Context) DeleteShader(shader *Shader)

func (*Context) DeleteTexture

func (c *Context) DeleteTexture(texture *Texture)

func (*Context) DepthFunc

func (c *Context) DepthFunc(function Enum) (self *Context)

func (*Context) DepthMask

func (c *Context) DepthMask(flag bool) (self *Context)

func (*Context) DepthRange

func (c *Context) DepthRange(near, far float64) (self *Context)

func (*Context) DetachShader

func (c *Context) DetachShader(program *Program, shader *Shader) (self *Context)

func (*Context) Disable

func (c *Context) Disable(capability Enum) (self *Context)

func (*Context) DisableVertexAttribArray

func (c *Context) DisableVertexAttribArray(index uint32) (self *Context)

func (*Context) Dispose

func (c *Context) Dispose()

func (*Context) DrawArrays

func (c *Context) DrawArrays(mode Enum, first, count int) (self *Context)

func (*Context) DrawElements

func (c *Context) DrawElements(mode Enum, count int, valueType Enum, offset Offset) (self *Context)

func (*Context) DrawingBufferSize

func (c *Context) DrawingBufferSize() (width, height int)

DrawingBufferSize returns the actual WebGL drawing-buffer dimensions.

func (*Context) Enable

func (c *Context) Enable(capability Enum) (self *Context)

func (*Context) EnableVertexAttribArray

func (c *Context) EnableVertexAttribArray(index uint32) (self *Context)

func (*Context) Finish

func (c *Context) Finish() (self *Context)

func (*Context) Flush

func (c *Context) Flush() (self *Context)

func (*Context) FramebufferRenderbuffer

func (c *Context) FramebufferRenderbuffer(target, attachment, renderbufferTarget Enum, renderbuffer *Renderbuffer) (self *Context)

func (*Context) FramebufferTexture2D

func (c *Context) FramebufferTexture2D(target, attachment, textureTarget Enum, texture *Texture, level int) (self *Context)

func (*Context) FrontFace

func (c *Context) FrontFace(mode Enum) (self *Context)

func (*Context) GenerateMipmap

func (c *Context) GenerateMipmap(target Enum) (self *Context)

func (*Context) GetActiveAttrib

func (c *Context) GetActiveAttrib(program *Program, index uint32) (info *ActiveInfo)

func (*Context) GetActiveUniform

func (c *Context) GetActiveUniform(program *Program, index uint32) (info *ActiveInfo)

func (*Context) GetAttachedShaders

func (c *Context) GetAttachedShaders(program *Program) (shaders []*Shader)

func (*Context) GetAttribLocation

func (c *Context) GetAttribLocation(program *Program, name string) (location int)

func (*Context) GetBool

func (c *Context) GetBool(name Enum) (value bool)

func (*Context) GetBufferParameter

func (c *Context) GetBufferParameter(target, name Enum) (value js.Value)

func (*Context) GetContextAttributes

func (c *Context) GetContextAttributes() (attributes js.Value)

func (*Context) GetError

func (c *Context) GetError() (value Enum)

func (*Context) GetExtension

func (c *Context) GetExtension(name string) (extension *Extension, ok bool)

func (*Context) GetFPS

func (c *Context) GetFPS() (fps int)

func (*Context) GetFloat

func (c *Context) GetFloat(name Enum) (value float64)

func (*Context) GetFramebufferAttachmentParameter

func (c *Context) GetFramebufferAttachmentParameter(target, attachment, name Enum) (value js.Value)

func (*Context) GetInt

func (c *Context) GetInt(name Enum) (value int)

func (*Context) GetMSPerFrame

func (c *Context) GetMSPerFrame() (mean, minValue, maxValue float64)

func (*Context) GetParameter

func (c *Context) GetParameter(name Enum) (value js.Value)

func (*Context) GetProgramInfoLog

func (c *Context) GetProgramInfoLog(program *Program) (log string)

func (*Context) GetProgramParameter

func (c *Context) GetProgramParameter(program *Program, name Enum) (value js.Value)

func (*Context) GetRenderbufferParameter

func (c *Context) GetRenderbufferParameter(target, name Enum) (value js.Value)

func (*Context) GetShaderInfoLog

func (c *Context) GetShaderInfoLog(shader *Shader) (log string)

func (*Context) GetShaderParameter

func (c *Context) GetShaderParameter(shader *Shader, name Enum) (value js.Value)

func (*Context) GetShaderPrecisionFormat

func (c *Context) GetShaderPrecisionFormat(shaderType, precisionType Enum) (format *ShaderPrecisionFormat)

func (*Context) GetShaderSource

func (c *Context) GetShaderSource(shader *Shader) (source string)

func (*Context) GetString

func (c *Context) GetString(name Enum) (value string)

func (*Context) GetSupportedExtensions

func (c *Context) GetSupportedExtensions() (extensions []string)

func (*Context) GetTexParameter

func (c *Context) GetTexParameter(target, name Enum) (value js.Value)

func (*Context) GetUniform

func (c *Context) GetUniform(program *Program, location *UniformLocation) (value js.Value)

func (*Context) GetUniformLocation

func (c *Context) GetUniformLocation(program *Program, name string) (location *UniformLocation)

func (*Context) GetVertexAttrib

func (c *Context) GetVertexAttrib(index uint32, name Enum) (value js.Value)

func (*Context) GetVertexAttribOffset

func (c *Context) GetVertexAttribOffset(index uint32, name Enum) (offset int)

func (*Context) Hint

func (c *Context) Hint(target, mode Enum) (self *Context)

func (*Context) IsBuffer

func (c *Context) IsBuffer(buffer *Buffer) (valid bool)

func (*Context) IsContextLost

func (c *Context) IsContextLost() (lost bool)

func (*Context) IsEnabled

func (c *Context) IsEnabled(capability Enum) (enabled bool)

func (*Context) IsFramebuffer

func (c *Context) IsFramebuffer(framebuffer *Framebuffer) (valid bool)

func (*Context) IsProgram

func (c *Context) IsProgram(program *Program) (valid bool)

func (*Context) IsRenderbuffer

func (c *Context) IsRenderbuffer(renderbuffer *Renderbuffer) (valid bool)

func (*Context) IsShader

func (c *Context) IsShader(shader *Shader) (valid bool)

func (*Context) IsTexture

func (c *Context) IsTexture(texture *Texture) (valid bool)

func (*Context) LineWidth

func (c *Context) LineWidth(width float64) (self *Context)

func (*Context) LinkProgram

func (c *Context) LinkProgram(shaders ...*Shader) (program *Program, err error)

LinkProgram links a program and returns the browser diagnostic on failure.

func (*Context) PixelStorei

func (c *Context) PixelStorei(name Enum, value int) (self *Context)

func (*Context) PolygonOffset

func (c *Context) PolygonOffset(factor, units float64) (self *Context)

func (*Context) ReadPixels

func (c *Context) ReadPixels(x, y, width, height int, format, valueType Enum, destination []byte) (count int)

func (*Context) ReadPixelsFloat32

func (c *Context) ReadPixelsFloat32(x, y, width, height int, format, valueType Enum, destination []float32) (count int)

func (*Context) ReadPixelsUint16

func (c *Context) ReadPixelsUint16(x, y, width, height int, format, valueType Enum, destination []uint16) (count int)

func (*Context) RenderbufferStorage

func (c *Context) RenderbufferStorage(target, internalFormat Enum, width, height int) (self *Context)

func (*Context) SampleCoverage

func (c *Context) SampleCoverage(value float64, invert bool) (self *Context)

func (*Context) Scissor

func (c *Context) Scissor(x, y, width, height int) (self *Context)

func (*Context) ShaderSource

func (c *Context) ShaderSource(shader *Shader, source string) (self *Context)

func (*Context) Start

func (c *Context) Start() (self *Context)

func (*Context) StencilFunc

func (c *Context) StencilFunc(function Enum, reference int, mask uint32) (self *Context)

func (*Context) StencilFuncSeparate

func (c *Context) StencilFuncSeparate(face, function Enum, reference int, mask uint32) (self *Context)

func (*Context) StencilMask

func (c *Context) StencilMask(mask uint32) (self *Context)

func (*Context) StencilMaskSeparate

func (c *Context) StencilMaskSeparate(face Enum, mask uint32) (self *Context)

func (*Context) StencilOp

func (c *Context) StencilOp(fail, depthFail, depthPass Enum) (self *Context)

func (*Context) StencilOpSeparate

func (c *Context) StencilOpSeparate(face, fail, depthFail, depthPass Enum) (self *Context)

func (*Context) Stop

func (c *Context) Stop() (self *Context)

func (*Context) TexImage2D

func (c *Context) TexImage2D(target Enum, level int, internalFormat Enum, width, height, border int, format, valueType Enum, pixels []byte) (self *Context)

func (*Context) TexImage2DFloat32

func (c *Context) TexImage2DFloat32(target Enum, level int, internalFormat Enum, width, height, border int, format, valueType Enum, pixels []float32) (self *Context)

func (*Context) TexImage2DSource

func (c *Context) TexImage2DSource(target Enum, level int, internalFormat, format, valueType Enum, source wasmdraw.CanvasImageSource) (self *Context)

func (*Context) TexImage2DUint16

func (c *Context) TexImage2DUint16(target Enum, level int, internalFormat Enum, width, height, border int, format, valueType Enum, pixels []uint16) (self *Context)

func (*Context) TexParameterf

func (c *Context) TexParameterf(target, name Enum, value float64) (self *Context)

func (*Context) TexParameteri

func (c *Context) TexParameteri(target, name Enum, value int) (self *Context)

func (*Context) TexSubImage2D

func (c *Context) TexSubImage2D(target Enum, level, xOffset, yOffset, width, height int, format, valueType Enum, pixels []byte) (self *Context)

func (*Context) TexSubImage2DFloat32

func (c *Context) TexSubImage2DFloat32(target Enum, level, xOffset, yOffset, width, height int, format, valueType Enum, pixels []float32) (self *Context)

func (*Context) TexSubImage2DSource

func (c *Context) TexSubImage2DSource(target Enum, level, xOffset, yOffset int, format, valueType Enum, source wasmdraw.CanvasImageSource) (self *Context)

func (*Context) TexSubImage2DUint16

func (c *Context) TexSubImage2DUint16(target Enum, level, xOffset, yOffset, width, height int, format, valueType Enum, pixels []uint16) (self *Context)

func (*Context) Uniform1f

func (c *Context) Uniform1f(location *UniformLocation, x float64) (self *Context)

func (*Context) Uniform1fv

func (c *Context) Uniform1fv(location *UniformLocation, values []float32) (self *Context)

func (*Context) Uniform1i

func (c *Context) Uniform1i(location *UniformLocation, x int) (self *Context)

func (*Context) Uniform1iv

func (c *Context) Uniform1iv(location *UniformLocation, values []int32) (self *Context)

func (*Context) Uniform2f

func (c *Context) Uniform2f(location *UniformLocation, x, y float64) (self *Context)

func (*Context) Uniform2fv

func (c *Context) Uniform2fv(location *UniformLocation, values []float32) (self *Context)

func (*Context) Uniform2i

func (c *Context) Uniform2i(location *UniformLocation, x, y int) (self *Context)

func (*Context) Uniform2iv

func (c *Context) Uniform2iv(location *UniformLocation, values []int32) (self *Context)

func (*Context) Uniform3f

func (c *Context) Uniform3f(location *UniformLocation, x, y, z float64) (self *Context)

func (*Context) Uniform3fv

func (c *Context) Uniform3fv(location *UniformLocation, values []float32) (self *Context)

func (*Context) Uniform3i

func (c *Context) Uniform3i(location *UniformLocation, x, y, z int) (self *Context)

func (*Context) Uniform3iv

func (c *Context) Uniform3iv(location *UniformLocation, values []int32) (self *Context)

func (*Context) Uniform4f

func (c *Context) Uniform4f(location *UniformLocation, x, y, z, w float64) (self *Context)

func (*Context) Uniform4fv

func (c *Context) Uniform4fv(location *UniformLocation, values []float32) (self *Context)

func (*Context) Uniform4i

func (c *Context) Uniform4i(location *UniformLocation, x, y, z, w int) (self *Context)

func (*Context) Uniform4iv

func (c *Context) Uniform4iv(location *UniformLocation, values []int32) (self *Context)

func (*Context) UniformMatrix2fv

func (c *Context) UniformMatrix2fv(location *UniformLocation, transpose bool, values []float32) (self *Context)

func (*Context) UniformMatrix3fv

func (c *Context) UniformMatrix3fv(location *UniformLocation, transpose bool, values []float32) (self *Context)

func (*Context) UniformMatrix4fv

func (c *Context) UniformMatrix4fv(location *UniformLocation, transpose bool, values []float32) (self *Context)

func (*Context) UseProgram

func (c *Context) UseProgram(program *Program) (self *Context)

func (*Context) ValidateProgram

func (c *Context) ValidateProgram(program *Program) (valid bool)

func (*Context) Version

func (c *Context) Version() (version int)

Version reports the WebGL major version represented by this context.

func (*Context) VertexAttrib1f

func (c *Context) VertexAttrib1f(index uint32, x float64) (self *Context)

func (*Context) VertexAttrib1fv

func (c *Context) VertexAttrib1fv(index uint32, values []float32) (self *Context)

func (*Context) VertexAttrib2f

func (c *Context) VertexAttrib2f(index uint32, x, y float64) (self *Context)

func (*Context) VertexAttrib2fv

func (c *Context) VertexAttrib2fv(index uint32, values []float32) (self *Context)

func (*Context) VertexAttrib3f

func (c *Context) VertexAttrib3f(index uint32, x, y, z float64) (self *Context)

func (*Context) VertexAttrib3fv

func (c *Context) VertexAttrib3fv(index uint32, values []float32) (self *Context)

func (*Context) VertexAttrib4f

func (c *Context) VertexAttrib4f(index uint32, x, y, z, w float64) (self *Context)

func (*Context) VertexAttrib4fv

func (c *Context) VertexAttrib4fv(index uint32, values []float32) (self *Context)

func (*Context) VertexAttribPointer

func (c *Context) VertexAttribPointer(index uint32, size int, valueType Enum, normalized bool, stride, offset int) (self *Context)

func (*Context) Viewport

func (c *Context) Viewport(x, y, width, height int) (self *Context)

type Enum

type Enum = int
const (
	Points                Enum = 0x0000
	Lines                 Enum = 0x0001
	LineLoop              Enum = 0x0002
	LineStrip             Enum = 0x0003
	Triangles             Enum = 0x0004
	TriangleStrip         Enum = 0x0005
	TriangleFan           Enum = 0x0006
	Zero                  Enum = 0
	One                   Enum = 1
	SrcColor              Enum = 0x0300
	OneMinusSrcColor      Enum = 0x0301
	SrcAlpha              Enum = 0x0302
	OneMinusSrcAlpha      Enum = 0x0303
	DstAlpha              Enum = 0x0304
	OneMinusDstAlpha      Enum = 0x0305
	DstColor              Enum = 0x0306
	OneMinusDstColor      Enum = 0x0307
	SrcAlphaSaturate      Enum = 0x0308
	FuncAdd               Enum = 0x8006
	FuncSubtract          Enum = 0x800A
	FuncReverseSubtract   Enum = 0x800B
	ConstantColor         Enum = 0x8001
	OneMinusConstantColor Enum = 0x8002
	ConstantAlpha         Enum = 0x8003
	OneMinusConstantAlpha Enum = 0x8004
)
const (
	ArrayBuffer               Enum = 0x8892
	ElementArrayBuffer        Enum = 0x8893
	ArrayBufferBinding        Enum = 0x8894
	ElementArrayBufferBinding Enum = 0x8895
	StreamDraw                Enum = 0x88E0
	StaticDraw                Enum = 0x88E4
	DynamicDraw               Enum = 0x88E8
	BufferSize                Enum = 0x8764
	BufferUsage               Enum = 0x8765
)
const (
	Front                 Enum = 0x0404
	Back                  Enum = 0x0405
	FrontAndBack          Enum = 0x0408
	CullFace              Enum = 0x0B44
	Blend                 Enum = 0x0BE2
	Dither                Enum = 0x0BD0
	StencilTest           Enum = 0x0B90
	DepthTest             Enum = 0x0B71
	ScissorTest           Enum = 0x0C11
	PolygonOffsetFill     Enum = 0x8037
	SampleAlphaToCoverage Enum = 0x809E
	SampleCoverage        Enum = 0x80A0
	CW                    Enum = 0x0900
	CCW                   Enum = 0x0901
)
const (
	Never    Enum = 0x0200
	Less     Enum = 0x0201
	Equal    Enum = 0x0202
	LEqual   Enum = 0x0203
	Greater  Enum = 0x0204
	NotEqual Enum = 0x0205
	GEqual   Enum = 0x0206
	Always   Enum = 0x0207
	Keep     Enum = 0x1E00
	Replace  Enum = 0x1E01
	Incr     Enum = 0x1E02
	Decr     Enum = 0x1E03
	Invert   Enum = 0x150A
	IncrWrap Enum = 0x8507
	DecrWrap Enum = 0x8508
)
const (
	Byte          Enum = 0x1400
	UnsignedByte  Enum = 0x1401
	Short         Enum = 0x1402
	UnsignedShort Enum = 0x1403
	Int           Enum = 0x1404
	UnsignedInt   Enum = 0x1405
	Float         Enum = 0x1406
)
const (
	FragmentShader   Enum = 0x8B30
	VertexShader     Enum = 0x8B31
	CompileStatus    Enum = 0x8B81
	DeleteStatus     Enum = 0x8B80
	LinkStatus       Enum = 0x8B82
	ValidateStatus   Enum = 0x8B83
	AttachedShaders  Enum = 0x8B85
	ActiveUniforms   Enum = 0x8B86
	ActiveAttributes Enum = 0x8B89
)
const (
	Texture2D               Enum = 0x0DE1
	TextureCubeMap          Enum = 0x8513
	TextureCubeMapPositiveX Enum = 0x8515
	TextureCubeMapNegativeX Enum = 0x8516
	TextureCubeMapPositiveY Enum = 0x8517
	TextureCubeMapNegativeY Enum = 0x8518
	TextureCubeMapPositiveZ Enum = 0x8519
	TextureCubeMapNegativeZ Enum = 0x851A
	TextureMagFilter        Enum = 0x2800
	TextureMinFilter        Enum = 0x2801
	TextureWrapS            Enum = 0x2802
	TextureWrapT            Enum = 0x2803
	Nearest                 Enum = 0x2600
	Linear                  Enum = 0x2601
	NearestMipmapNearest    Enum = 0x2700
	LinearMipmapNearest     Enum = 0x2701
	NearestMipmapLinear     Enum = 0x2702
	LinearMipmapLinear      Enum = 0x2703
	Repeat                  Enum = 0x2901
	ClampToEdge             Enum = 0x812F
	MirroredRepeat          Enum = 0x8370
	RGBA                    Enum = 0x1908
	RGB                     Enum = 0x1907
	Alpha                   Enum = 0x1906
	Luminance               Enum = 0x1909
	LuminanceAlpha          Enum = 0x190A
	Texture0                Enum = 0x84C0
)
const (
	FramebufferTarget      Enum = 0x8D40
	RenderbufferTarget     Enum = 0x8D41
	ColorAttachment0       Enum = 0x8CE0
	DepthAttachment        Enum = 0x8D00
	StencilAttachment      Enum = 0x8D20
	DepthStencilAttachment Enum = 0x821A
	FramebufferComplete    Enum = 0x8CD5
	RGBA4                  Enum = 0x8056
	RGB5A1                 Enum = 0x8057
	RGB565                 Enum = 0x8D62
	DepthComponent16       Enum = 0x81A5
	StencilIndex8          Enum = 0x8D48
	DepthStencil           Enum = 0x84F9
)
const (
	NoError                Enum = 0
	InvalidEnum            Enum = 0x0500
	InvalidValue           Enum = 0x0501
	InvalidOperation       Enum = 0x0502
	OutOfMemory            Enum = 0x0505
	ContextLostWebGL       Enum = 0x9242
	Vendor                 Enum = 0x1F00
	Renderer               Enum = 0x1F01
	Version                Enum = 0x1F02
	ShadingLanguageVersion Enum = 0x8B8C
)
const (
	BlendEquationRGB              Enum = 0x8009
	BlendEquationAlpha            Enum = 0x883D
	BlendDstRGB                   Enum = 0x80C8
	BlendSrcRGB                   Enum = 0x80C9
	BlendDstAlpha                 Enum = 0x80CA
	BlendSrcAlpha                 Enum = 0x80CB
	LineWidthValue                Enum = 0x0B21
	AliasedPointSizeRange         Enum = 0x846D
	AliasedLineWidthRange         Enum = 0x846E
	CullFaceMode                  Enum = 0x0B45
	FrontFaceMode                 Enum = 0x0B46
	DepthRangeValue               Enum = 0x0B70
	DepthWriteMask                Enum = 0x0B72
	DepthClearValue               Enum = 0x0B73
	DepthFuncValue                Enum = 0x0B74
	StencilClearValue             Enum = 0x0B91
	StencilFuncValue              Enum = 0x0B92
	StencilFail                   Enum = 0x0B94
	StencilPassDepthFail          Enum = 0x0B95
	StencilPassDepthPass          Enum = 0x0B96
	StencilRef                    Enum = 0x0B97
	StencilValueMask              Enum = 0x0B93
	StencilWriteMask              Enum = 0x0B98
	StencilBackFunc               Enum = 0x8800
	StencilBackFail               Enum = 0x8801
	StencilBackPassDepthFail      Enum = 0x8802
	StencilBackPassDepthPass      Enum = 0x8803
	StencilBackRef                Enum = 0x8CA3
	StencilBackValueMask          Enum = 0x8CA4
	StencilBackWriteMask          Enum = 0x8CA5
	ViewportValue                 Enum = 0x0BA2
	ScissorBox                    Enum = 0x0C10
	ColorClearValue               Enum = 0x0C22
	ColorWriteMask                Enum = 0x0C23
	UnpackAlignment               Enum = 0x0CF5
	PackAlignment                 Enum = 0x0D05
	MaxTextureSize                Enum = 0x0D33
	MaxViewportDims               Enum = 0x0D3A
	SubpixelBits                  Enum = 0x0D50
	RedBits                       Enum = 0x0D52
	GreenBits                     Enum = 0x0D53
	BlueBits                      Enum = 0x0D54
	AlphaBits                     Enum = 0x0D55
	DepthBits                     Enum = 0x0D56
	StencilBits                   Enum = 0x0D57
	PolygonOffsetUnits            Enum = 0x2A00
	PolygonOffsetFactor           Enum = 0x8038
	SampleBuffers                 Enum = 0x80A8
	Samples                       Enum = 0x80A9
	SampleCoverageValue           Enum = 0x80AA
	SampleCoverageInvert          Enum = 0x80AB
	CompressedTextureFormats      Enum = 0x86A3
	ImplementationColorReadType   Enum = 0x8B9A
	ImplementationColorReadFormat Enum = 0x8B9B
)
const (
	CurrentProgram                 Enum = 0x8B8D
	ShaderType                     Enum = 0x8B4F
	ShaderCompiler                 Enum = 0x8DFA
	LowFloat                       Enum = 0x8DF0
	MediumFloat                    Enum = 0x8DF1
	HighFloat                      Enum = 0x8DF2
	LowInt                         Enum = 0x8DF3
	MediumInt                      Enum = 0x8DF4
	HighInt                        Enum = 0x8DF5
	MaxVertexAttribs               Enum = 0x8869
	MaxVertexUniformVectors        Enum = 0x8DFB
	MaxVaryingVectors              Enum = 0x8DFC
	MaxCombinedTextureImageUnits   Enum = 0x8B4D
	MaxVertexTextureImageUnits     Enum = 0x8B4C
	MaxTextureImageUnits           Enum = 0x8872
	MaxFragmentUniformVectors      Enum = 0x8DFD
	VertexAttribArrayEnabled       Enum = 0x8622
	VertexAttribArraySize          Enum = 0x8623
	VertexAttribArrayStride        Enum = 0x8624
	VertexAttribArrayType          Enum = 0x8625
	CurrentVertexAttrib            Enum = 0x8626
	VertexAttribArrayNormalized    Enum = 0x886A
	VertexAttribArrayPointer       Enum = 0x8645
	VertexAttribArrayBufferBinding Enum = 0x889F
)
const (
	TextureBinding2D                Enum = 0x8069
	TextureBindingCubeMap           Enum = 0x8514
	ActiveTextureValue              Enum = 0x84E0
	MaxCubeMapTextureSize           Enum = 0x851C
	UnpackFlipYWebGL                Enum = 0x9240
	UnpackPremultiplyAlphaWebGL     Enum = 0x9241
	UnpackColorspaceConversionWebGL Enum = 0x9243
	BrowserDefaultWebGL             Enum = 0x9244
	DontCare                        Enum = 0x1100
	Fastest                         Enum = 0x1101
	Nicest                          Enum = 0x1102
	GenerateMipmapHint              Enum = 0x8192
)
const (
	FramebufferBinding                      Enum = 0x8CA6
	RenderbufferBinding                     Enum = 0x8CA7
	FramebufferIncompleteAttachment         Enum = 0x8CD6
	FramebufferIncompleteMissingAttachment  Enum = 0x8CD7
	FramebufferIncompleteDimensions         Enum = 0x8CD9
	FramebufferUnsupported                  Enum = 0x8CDD
	FramebufferAttachmentObjectType         Enum = 0x8CD0
	FramebufferAttachmentObjectName         Enum = 0x8CD1
	FramebufferAttachmentTextureLevel       Enum = 0x8CD2
	FramebufferAttachmentTextureCubeMapFace Enum = 0x8CD3
	RenderbufferWidth                       Enum = 0x8D42
	RenderbufferHeight                      Enum = 0x8D43
	RenderbufferInternalFormat              Enum = 0x8D44
	RenderbufferRedSize                     Enum = 0x8D50
	RenderbufferGreenSize                   Enum = 0x8D51
	RenderbufferBlueSize                    Enum = 0x8D52
	RenderbufferAlphaSize                   Enum = 0x8D53
	RenderbufferDepthSize                   Enum = 0x8D54
	RenderbufferStencilSize                 Enum = 0x8D55
)

func TextureUnit

func TextureUnit(index int) (unit Enum)

type Extension

type Extension struct {
	// contains filtered or unexported fields
}

func (*Extension) Call

func (e *Extension) Call(method string, arguments ...any) (value js.Value)

func (*Extension) Get

func (e *Extension) Get(name string) (value js.Value)

func (*Extension) Value

func (e *Extension) Value() (value js.Value)

type Framebuffer

type Framebuffer struct {
	// contains filtered or unexported fields
}

func (*Framebuffer) Value

func (f *Framebuffer) Value() (value js.Value)

type Offset

type Offset = int

type Options

type Options struct {
	// contains filtered or unexported fields
}

func DefaultOptions

func DefaultOptions() (options *Options)

DefaultOptions returns browser-default WebGL context attributes.

func (*Options) WithAlpha

func (o *Options) WithAlpha(value bool) (self *Options)

func (*Options) WithAntialias

func (o *Options) WithAntialias(value bool) (self *Options)

func (*Options) WithDepth

func (o *Options) WithDepth(value bool) (self *Options)

func (*Options) WithDesynchronized

func (o *Options) WithDesynchronized(value bool) (self *Options)

func (*Options) WithFailIfMajorPerformanceCaveat

func (o *Options) WithFailIfMajorPerformanceCaveat(value bool) (self *Options)

func (*Options) WithPowerPreference

func (o *Options) WithPowerPreference(value string) (self *Options)

func (*Options) WithPremultipliedAlpha

func (o *Options) WithPremultipliedAlpha(value bool) (self *Options)

func (*Options) WithPreserveDrawingBuffer

func (o *Options) WithPreserveDrawingBuffer(value bool) (self *Options)

func (*Options) WithStencil

func (o *Options) WithStencil(value bool) (self *Options)

type Program

type Program struct {
	// contains filtered or unexported fields
}

func (*Program) Value

func (p *Program) Value() (value js.Value)

type Renderbuffer

type Renderbuffer struct {
	// contains filtered or unexported fields
}

func (*Renderbuffer) Value

func (r *Renderbuffer) Value() (value js.Value)

type Shader

type Shader struct {
	// contains filtered or unexported fields
}

func (*Shader) Value

func (s *Shader) Value() (value js.Value)

type ShaderPrecisionFormat

type ShaderPrecisionFormat struct {
	RangeMin  int
	RangeMax  int
	Precision int
}

type Size

type Size = int

type Texture

type Texture struct {
	// contains filtered or unexported fields
}

func (*Texture) Value

func (t *Texture) Value() (value js.Value)

type UniformLocation

type UniformLocation struct {
	// contains filtered or unexported fields
}

func (*UniformLocation) Value

func (u *UniformLocation) Value() (value js.Value)

Directories

Path Synopsis
example
app
src command

Jump to

Keyboard shortcuts

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