webgl

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Nov 17, 2026 License: MIT Imports: 4 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Rendered for js/wasm

Overview

Package webgl implements OpenGL ES 3.0 on top of a WebGL2 context.

Index

Constants

This section is empty.

Variables

View Source
var (
	Buffers            = newTable()
	Textures           = newTable()
	Framebuffers       = newTable()
	Renderbuffers      = newTable()
	Programs           = newTable()
	Shaders            = newTable()
	VertexArrays       = newTable()
	Queries            = newTable()
	Samplers           = newTable()
	TransformFeedbacks = newTable()
	Syncs              = newTable()
)

Functions

func BindAttribLocation

func BindAttribLocation(program uint32, index uint32, name *uint8)

BindAttribLocation binds a vertex attribute index to a named attribute.

func BindBuffer

func BindBuffer(target uint32, buffer uint32)

BindBuffer binds buffer to target.

func Bool

func Bool(v js.Value) bool

Bool converts a WebGL boolean result.

func BufferData

func BufferData(target uint32, size int, data unsafe.Pointer, usage uint32)

BufferData creates the data store of the bound buffer.

func BufferSubData

func BufferSubData(target uint32, offset int, size int, data unsafe.Pointer)

BufferSubData updates a subset of the data store of the bound buffer.

func ClearBufferfv

func ClearBufferfv(buffer uint32, drawbuffer int32, value *float32)

ClearBufferfv clears a buffer of the draw framebuffer.

func ClearBufferiv

func ClearBufferiv(buffer uint32, drawbuffer int32, value *int32)

ClearBufferiv clears a buffer of the draw framebuffer.

func ClearBufferuiv

func ClearBufferuiv(buffer uint32, drawbuffer int32, value *uint32)

ClearBufferuiv clears a buffer of the draw framebuffer.

func CompressedTexImage2D

func CompressedTexImage2D(target uint32, level int32, internalformat uint32, width int32, height int32, border int32, imageSize int32, data unsafe.Pointer)

CompressedTexImage2D specifies a compressed two-dimensional texture image.

func CompressedTexImage3D

func CompressedTexImage3D(target uint32, level int32, internalformat uint32, width int32, height int32, depth int32, border int32, imageSize int32, data unsafe.Pointer)

CompressedTexImage3D specifies a compressed three-dimensional texture image.

func CompressedTexSubImage2D

func CompressedTexSubImage2D(target uint32, level int32, xoffset int32, yoffset int32, width int32, height int32, format uint32, imageSize int32, data unsafe.Pointer)

CompressedTexSubImage2D specifies a compressed two-dimensional texture subimage.

func CompressedTexSubImage3D

func CompressedTexSubImage3D(target uint32, level int32, xoffset int32, yoffset int32, zoffset int32, width int32, height int32, depth int32, format uint32, imageSize int32, data unsafe.Pointer)

CompressedTexSubImage3D specifies a compressed three-dimensional texture subimage.

func Context

func Context() js.Value

Context returns the WebGL2 rendering context.

func DeleteProgram

func DeleteProgram(program uint32)

DeleteProgram deletes program and its uniform locations.

func DrawBuffers

func DrawBuffers(n int32, bufs *uint32)

DrawBuffers specifies the color buffers to draw into.

func DrawElements

func DrawElements(mode uint32, count int32, xtype uint32, indices unsafe.Pointer)

DrawElements renders primitives from the bound element array buffer.

func DrawElementsInstanced

func DrawElementsInstanced(mode uint32, count int32, xtype uint32, indices unsafe.Pointer, instancecount int32)

DrawElementsInstanced renders instanced primitives from the bound element array buffer.

func DrawElementsInstancedBaseInstanceEXT

func DrawElementsInstancedBaseInstanceEXT(mode uint32, count int32, xtype uint32, indices unsafe.Pointer, instancecount int32, baseinstance uint32)

DrawElementsInstancedBaseInstanceEXT renders instanced primitives with a base instance.

func DrawElementsInstancedBaseVertexBaseInstanceEXT

func DrawElementsInstancedBaseVertexBaseInstanceEXT(mode uint32, count int32, xtype uint32, indices unsafe.Pointer, instancecount int32, basevertex int32, baseinstance uint32)

DrawElementsInstancedBaseVertexBaseInstanceEXT renders instanced primitives with a base vertex and instance.

func DrawElementsInstancedBaseVertexEXT

func DrawElementsInstancedBaseVertexEXT(mode uint32, count int32, xtype uint32, indices unsafe.Pointer, instancecount int32, basevertex int32)

DrawElementsInstancedBaseVertexEXT renders instanced primitives with a base vertex.

func DrawElementsWithOffset

func DrawElementsWithOffset(mode uint32, count int32, xtype uint32, indices uintptr)

DrawElementsWithOffset renders primitives from the bound element array buffer.

func DrawRangeElements

func DrawRangeElements(mode uint32, start uint32, end uint32, count int32, xtype uint32, indices unsafe.Pointer)

DrawRangeElements renders primitives from the bound element array buffer.

func Extension

func Extension(name string) js.Value

Extension enables and returns the WebGL extension name, null when unsupported.

func Float32List

func Float32List(p unsafe.Pointer, n int) js.Value

Float32List copies n float32 values at p to a Float32Array.

func FlushMappedBufferRange

func FlushMappedBufferRange(target uint32, offset int, length int)

FlushMappedBufferRange writes a range of an explicitly flushed mapping to the buffer.

func GetActiveAttrib

func GetActiveAttrib(program uint32, index uint32, bufSize int32, length *int32, size *int32, xtype *uint32, name *uint8)

GetActiveAttrib returns information about an active attribute.

func GetActiveUniform

func GetActiveUniform(program uint32, index uint32, bufSize int32, length *int32, size *int32, xtype *uint32, name *uint8)

GetActiveUniform returns information about an active uniform.

func GetActiveUniformBlockName

func GetActiveUniformBlockName(program uint32, uniformBlockIndex uint32, bufSize int32, length *int32, uniformBlockName *uint8)

GetActiveUniformBlockName returns the name of a uniform block.

func GetActiveUniformBlockiv

func GetActiveUniformBlockiv(program uint32, uniformBlockIndex uint32, pname uint32, params *int32)

GetActiveUniformBlockiv queries a uniform block parameter.

func GetActiveUniformsiv

func GetActiveUniformsiv(program uint32, uniformCount int32, uniformIndices *uint32, pname uint32, params *int32)

GetActiveUniformsiv queries parameters of active uniforms.

func GetAttachedShaders

func GetAttachedShaders(program uint32, maxCount int32, count *int32, shaders *uint32)

GetAttachedShaders returns the shaders attached to program.

func GetAttribLocation

func GetAttribLocation(program uint32, name *uint8) int32

GetAttribLocation returns the location of an attribute.

func GetBooleanv

func GetBooleanv(pname uint32, data *bool)

GetBooleanv returns the value of a state variable.

func GetBufferParameteri64v

func GetBufferParameteri64v(target uint32, pname uint32, params *int64)

GetBufferParameteri64v queries a parameter of the bound buffer.

func GetBufferParameteriv

func GetBufferParameteriv(target uint32, pname uint32, params *int32)

GetBufferParameteriv queries a parameter of the bound buffer.

func GetBufferPointerv

func GetBufferPointerv(target uint32, pname uint32, params *unsafe.Pointer)

GetBufferPointerv returns the mapped pointer of the bound buffer.

func GetError

func GetError() uint32

GetError returns the first recorded error, then the WebGL error.

func GetFloatv

func GetFloatv(pname uint32, data *float32)

GetFloatv returns the value of a state variable.

func GetFragDataLocation

func GetFragDataLocation(program uint32, name *uint8) int32

GetFragDataLocation returns the location of a fragment shader output.

func GetFramebufferAttachmentParameteriv

func GetFramebufferAttachmentParameteriv(target uint32, attachment uint32, pname uint32, params *int32)

GetFramebufferAttachmentParameteriv queries a framebuffer attachment parameter.

func GetGraphicsResetStatusKHR

func GetGraphicsResetStatusKHR() uint32

GetGraphicsResetStatusKHR reports a lost or restored context.

func GetInteger64i_v

func GetInteger64i_v(target uint32, index uint32, data *int64)

GetInteger64i_v returns the value of an indexed state variable.

func GetInteger64v

func GetInteger64v(pname uint32, data *int64)

GetInteger64v returns the value of a state variable.

func GetIntegeri_v

func GetIntegeri_v(target uint32, index uint32, data *int32)

GetIntegeri_v returns the value of an indexed state variable.

func GetIntegerv

func GetIntegerv(pname uint32, data *int32)

GetIntegerv returns the value of a state variable.

func GetInternalformativ

func GetInternalformativ(target uint32, internalformat uint32, pname uint32, count int32, params *int32)

GetInternalformativ queries an internal format parameter.

func GetProgramInfoLog

func GetProgramInfoLog(program uint32, bufSize int32, length *int32, infoLog *uint8)

GetProgramInfoLog returns the information log of program.

func GetProgramiv

func GetProgramiv(program uint32, pname uint32, params *int32)

GetProgramiv queries a program parameter.

func GetQueryObjecti64vEXT

func GetQueryObjecti64vEXT(id uint32, pname uint32, params *int64)

GetQueryObjecti64vEXT queries a query object parameter.

func GetQueryObjectivEXT

func GetQueryObjectivEXT(id uint32, pname uint32, params *int32)

GetQueryObjectivEXT queries a query object parameter.

func GetQueryObjectui64vEXT

func GetQueryObjectui64vEXT(id uint32, pname uint32, params *uint64)

GetQueryObjectui64vEXT queries a query object parameter.

func GetQueryObjectuiv

func GetQueryObjectuiv(id uint32, pname uint32, params *uint32)

GetQueryObjectuiv queries a query object parameter.

func GetQueryiv

func GetQueryiv(target uint32, pname uint32, params *int32)

GetQueryiv queries the active query of target.

func GetRenderbufferParameteriv

func GetRenderbufferParameteriv(target uint32, pname uint32, params *int32)

GetRenderbufferParameteriv queries a parameter of the bound renderbuffer.

func GetSamplerParameterfv

func GetSamplerParameterfv(sampler uint32, pname uint32, params *float32)

GetSamplerParameterfv queries a sampler parameter.

func GetSamplerParameteriv

func GetSamplerParameteriv(sampler uint32, pname uint32, params *int32)

GetSamplerParameteriv queries a sampler parameter.

func GetShaderInfoLog

func GetShaderInfoLog(shader uint32, bufSize int32, length *int32, infoLog *uint8)

GetShaderInfoLog returns the information log of shader.

func GetShaderPrecisionFormat

func GetShaderPrecisionFormat(shadertype uint32, precisiontype uint32, xrange *int32, precision *int32)

GetShaderPrecisionFormat returns the range and precision of a shader numeric format.

func GetShaderSource

func GetShaderSource(shader uint32, bufSize int32, length *int32, source *uint8)

GetShaderSource returns the source code of shader.

func GetShaderiv

func GetShaderiv(shader uint32, pname uint32, params *int32)

GetShaderiv queries a shader parameter.

func GetString

func GetString(name uint32) *uint8

GetString returns a string describing the current connection.

func GetStringi

func GetStringi(name uint32, index uint32) *uint8

GetStringi returns an indexed string.

func GetSynciv

func GetSynciv(sync uintptr, pname uint32, count int32, length *int32, values *int32)

GetSynciv queries a sync object parameter.

func GetTexParameterfv

func GetTexParameterfv(target uint32, pname uint32, params *float32)

GetTexParameterfv queries a texture parameter.

func GetTexParameteriv

func GetTexParameteriv(target uint32, pname uint32, params *int32)

GetTexParameteriv queries a texture parameter.

func GetTransformFeedbackVarying

func GetTransformFeedbackVarying(program uint32, index uint32, bufSize int32, length *int32, size *int32, xtype *uint32, name *uint8)

GetTransformFeedbackVarying returns information about a transform feedback varying.

func GetUniformBlockIndex

func GetUniformBlockIndex(program uint32, uniformBlockName *uint8) uint32

GetUniformBlockIndex returns the index of a uniform block.

func GetUniformIndices

func GetUniformIndices(program uint32, uniformCount int32, uniformNames **uint8, uniformIndices *uint32)

GetUniformIndices returns the indices of uniform variables.

func GetUniformLocation

func GetUniformLocation(program uint32, name *uint8) int32

GetUniformLocation returns the location of a uniform variable.

func GetUniformfv

func GetUniformfv(program uint32, location int32, params *float32)

GetUniformfv returns the value of a uniform variable.

func GetUniformiv

func GetUniformiv(program uint32, location int32, params *int32)

GetUniformiv returns the value of a uniform variable.

func GetUniformuiv

func GetUniformuiv(program uint32, location int32, params *uint32)

GetUniformuiv returns the value of a uniform variable.

func GetVertexAttribIiv

func GetVertexAttribIiv(index uint32, pname uint32, params *int32)

GetVertexAttribIiv returns a vertex attribute parameter.

func GetVertexAttribIuiv

func GetVertexAttribIuiv(index uint32, pname uint32, params *uint32)

GetVertexAttribIuiv returns a vertex attribute parameter.

func GetVertexAttribPointerWithOffsetv

func GetVertexAttribPointerWithOffsetv(index uint32, pname uint32, offset **uintptr)

GetVertexAttribPointerWithOffsetv returns the offset of a vertex attribute array.

func GetVertexAttribPointerv

func GetVertexAttribPointerv(index uint32, pname uint32, pointer *unsafe.Pointer)

GetVertexAttribPointerv returns the offset of a vertex attribute array.

func GetVertexAttribfv

func GetVertexAttribfv(index uint32, pname uint32, params *float32)

GetVertexAttribfv returns a vertex attribute parameter.

func GetVertexAttribiv

func GetVertexAttribiv(index uint32, pname uint32, params *int32)

GetVertexAttribiv returns a vertex attribute parameter.

func Init

func Init(c js.Value) error

Init sets the WebGL2 rendering context.

func Int32List

func Int32List(p unsafe.Pointer, n int) js.Value

Int32List copies n int32 values at p to an Int32Array.

func InvalidateFramebuffer

func InvalidateFramebuffer(target uint32, numAttachments int32, attachments *uint32)

InvalidateFramebuffer invalidates framebuffer attachments.

func InvalidateSubFramebuffer

func InvalidateSubFramebuffer(target uint32, numAttachments int32, attachments *uint32, x int32, y int32, width int32, height int32)

InvalidateSubFramebuffer invalidates a region of framebuffer attachments.

func IsEnablediOES

func IsEnablediOES(target uint32, index uint32) bool

IsEnablediOES reports whether an indexed capability is enabled.

func MapBufferRange

func MapBufferRange(target uint32, offset int, length int, access uint32) unsafe.Pointer

MapBufferRange maps a range of the bound buffer into Go memory.

func Method

func Method(ext, name string) js.Value

Method returns the bound method name of the context, or of the extension ext when not empty. A missing method records GL_INVALID_OPERATION when called.

func MultiDrawArraysEXT

func MultiDrawArraysEXT(mode uint32, first *int32, count *int32, primcount int32)

MultiDrawArraysEXT renders several ranges of array data.

func MultiDrawElementsEXT

func MultiDrawElementsEXT(mode uint32, count *int32, xtype uint32, indices *unsafe.Pointer, primcount int32)

MultiDrawElementsEXT renders several ranges of the bound element array buffer.

func Number

func Number(v js.Value) float64

Number converts a WebGL numeric result, null is 0.

func OnRestore

func OnRestore(f func())

OnRestore sets the function that binds the context methods again after a context restore.

func PixelStorei

func PixelStorei(pname uint32, param int32)

PixelStorei sets pixel storage modes.

func ReadPixels

func ReadPixels(x int32, y int32, width int32, height int32, format uint32, xtype uint32, pixels unsafe.Pointer)

ReadPixels reads a block of pixels from the read framebuffer.

func SamplerParameterfv

func SamplerParameterfv(sampler uint32, pname uint32, param *float32)

SamplerParameterfv sets a sampler parameter.

func SamplerParameteriv

func SamplerParameteriv(sampler uint32, pname uint32, param *int32)

SamplerParameteriv sets a sampler parameter.

func ShaderSource

func ShaderSource(shader uint32, count int32, xstring **uint8, length *int32)

ShaderSource replaces the source code of shader.

func TexImage2D

func TexImage2D(target uint32, level int32, internalformat int32, width int32, height int32, border int32, format uint32, xtype uint32, pixels unsafe.Pointer)

TexImage2D specifies a two-dimensional texture image.

func TexImage3D

func TexImage3D(target uint32, level int32, internalformat int32, width int32, height int32, depth int32, border int32, format uint32, xtype uint32, pixels unsafe.Pointer)

TexImage3D specifies a three-dimensional texture image.

func TexParameterfv

func TexParameterfv(target uint32, pname uint32, params *float32)

TexParameterfv sets a texture parameter.

func TexParameteriv

func TexParameteriv(target uint32, pname uint32, params *int32)

TexParameteriv sets a texture parameter.

func TexSubImage2D

func TexSubImage2D(target uint32, level int32, xoffset int32, yoffset int32, width int32, height int32, format uint32, xtype uint32, pixels unsafe.Pointer)

TexSubImage2D specifies a two-dimensional texture subimage.

func TexSubImage3D

func TexSubImage3D(target uint32, level int32, xoffset int32, yoffset int32, zoffset int32, width int32, height int32, depth int32, format uint32, xtype uint32, pixels unsafe.Pointer)

TexSubImage3D specifies a three-dimensional texture subimage.

func TransformFeedbackVaryings

func TransformFeedbackVaryings(program uint32, count int32, varyings **uint8, bufferMode uint32)

TransformFeedbackVaryings specifies the varyings to record in transform feedback.

func Uint32List

func Uint32List(p unsafe.Pointer, n int) js.Value

Uint32List copies n uint32 values at p to a Uint32Array.

func Uniform

func Uniform(location int32) js.Value

Uniform returns the WebGLUniformLocation of location, null for -1 or unknown locations.

func UnmapBuffer

func UnmapBuffer(target uint32) bool

UnmapBuffer writes a written mapping to the bound buffer and releases it.

func Unsupported

func Unsupported()

Unsupported records GL_INVALID_OPERATION for a command without a WebGL2 equivalent.

func VertexAttribIPointer

func VertexAttribIPointer(index uint32, size int32, xtype uint32, stride int32, pointer unsafe.Pointer)

VertexAttribIPointer defines an array of integer vertex attribute data in the bound array buffer.

func VertexAttribIPointerWithOffset

func VertexAttribIPointerWithOffset(index uint32, size int32, xtype uint32, stride int32, offset uintptr)

VertexAttribIPointerWithOffset defines an array of integer vertex attribute data in the bound array buffer.

func VertexAttribPointer

func VertexAttribPointer(index uint32, size int32, xtype uint32, normalized bool, stride int32, pointer unsafe.Pointer)

VertexAttribPointer defines an array of vertex attribute data in the bound array buffer.

func VertexAttribPointerWithOffset

func VertexAttribPointerWithOffset(index uint32, size int32, xtype uint32, normalized bool, stride int32, offset uintptr)

VertexAttribPointerWithOffset defines an array of vertex attribute data in the bound array buffer.

Types

type Table

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

Table maps GL object names to WebGL objects.

func (*Table) Add

func (t *Table) Add(o js.Value) uint32

Add stores o and returns its name, 0 for null.

func (*Table) Get

func (t *Table) Get(name uint32) js.Value

Get returns the object of name, null for 0 or unknown names.

func (*Table) ID

func (t *Table) ID(o js.Value) uint32

ID returns the name of the object o, 0 for null or foreign objects.

func (*Table) Remove

func (t *Table) Remove(name uint32)

Remove forgets name.

Jump to

Keyboard shortcuts

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