webgl

package module
v0.0.0-...-8372a11 Latest Latest
Warning

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

Go to latest
Published: Mar 3, 2021 License: BSD-2-Clause Imports: 3 Imported by: 0

README

webgl

GoDoc Go Report Card

change from https://godoc.org/github.com/gopherjs/webgl support "syscall/js"

Example

Screenshot

webgl_example.go:

package main

import (
	"syscall/js"
	"github.com/n2d/webgl"
)

func main() {
	var canvas js.Value = js.
		Global().
		Get("document").
		Call("getElementById", "canvas")


	canvas.Set("height", 600)
	canvas.Set("width", 800)

	gl, _ := webgl.NewContext(canvas)

	gl.ClearColor(1, 0, 0, 1)
	gl.Clear(gl.COLOR_BUFFER_BIT)
}

webgl_example.html:

<html><body><script src="webgl_example.js"></script><canvas id='canvas'></canvas></br></body></html>

To produce webgl_example.js file, run gopherjs build webgl_example.go.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Context

type Context struct {
	js.Value
	ARRAY_BUFFER                                 js.Value `js:"ARRAY_BUFFER"`
	ARRAY_BUFFER_BINDING                         js.Value `js:"ARRAY_BUFFER_BINDING"`
	ATTACHED_SHADERS                             js.Value `js:"ATTACHED_SHADERS"`
	BACK                                         js.Value `js:"BACK"`
	BLEND                                        js.Value `js:"BLEND"`
	BLEND_COLOR                                  js.Value `js:"BLEND_COLOR"`
	BLEND_DST_ALPHA                              js.Value `js:"BLEND_DST_ALPHA"`
	BLEND_DST_RGB                                js.Value `js:"BLEND_DST_RGB"`
	BLEND_EQUATION                               js.Value `js:"BLEND_EQUATION"`
	BLEND_EQUATION_ALPHA                         js.Value `js:"BLEND_EQUATION_ALPHA"`
	BLEND_EQUATION_RGB                           js.Value `js:"BLEND_EQUATION_RGB"`
	BLEND_SRC_ALPHA                              js.Value `js:"BLEND_SRC_ALPHA"`
	BLEND_SRC_RGB                                js.Value `js:"BLEND_SRC_RGB"`
	BLUE_BITS                                    js.Value `js:"BLUE_BITS"`
	BOOL                                         js.Value `js:"BOOL"`
	BOOL_VEC2                                    js.Value `js:"BOOL_VEC2"`
	BOOL_VEC3                                    js.Value `js:"BOOL_VEC3"`
	BOOL_VEC4                                    js.Value `js:"BOOL_VEC4"`
	BROWSER_DEFAULT_WEBGL                        js.Value `js:"BROWSER_DEFAULT_WEBGL"`
	BUFFER_SIZE                                  js.Value `js:"BUFFER_SIZE"`
	BUFFER_USAGE                                 js.Value `js:"BUFFER_USAGE"`
	BYTE                                         js.Value `js:"BYTE"`
	CCW                                          js.Value `js:"CCW"`
	CLAMP_TO_EDGE                                js.Value `js:"CLAMP_TO_EDGE"`
	COLOR_ATTACHMENT0                            js.Value `js:"COLOR_ATTACHMENT0"`
	COLOR_BUFFER_BIT                             js.Value `js:"COLOR_BUFFER_BIT"`
	COLOR_CLEAR_VALUE                            js.Value `js:"COLOR_CLEAR_VALUE"`
	COLOR_WRITEMASK                              js.Value `js:"COLOR_WRITEMASK"`
	COMPILE_STATUS                               js.Value `js:"COMPILE_STATUS"`
	COMPRESSED_TEXTURE_FORMATS                   js.Value `js:"COMPRESSED_TEXTURE_FORMATS"`
	CONSTANT_ALPHA                               js.Value `js:"CONSTANT_ALPHA"`
	CONSTANT_COLOR                               js.Value `js:"CONSTANT_COLOR"`
	CONTEXT_LOST_WEBGL                           js.Value `js:"CONTEXT_LOST_WEBGL"`
	CULL_FACE                                    js.Value `js:"CULL_FACE"`
	CULL_FACE_MODE                               js.Value `js:"CULL_FACE_MODE"`
	CURRENT_PROGRAM                              js.Value `js:"CURRENT_PROGRAM"`
	CURRENT_VERTEX_ATTRIB                        js.Value `js:"CURRENT_VERTEX_ATTRIB"`
	CW                                           js.Value `js:"CW"`
	DECR                                         js.Value `js:"DECR"`
	DECR_WRAP                                    js.Value `js:"DECR_WRAP"`
	DELETE_STATUS                                js.Value `js:"DELETE_STATUS"`
	DEPTH_ATTACHMENT                             js.Value `js:"DEPTH_ATTACHMENT"`
	DEPTH_BITS                                   js.Value `js:"DEPTH_BITS"`
	DEPTH_BUFFER_BIT                             js.Value `js:"DEPTH_BUFFER_BIT"`
	DEPTH_CLEAR_VALUE                            js.Value `js:"DEPTH_CLEAR_VALUE"`
	DEPTH_COMPONENT                              js.Value `js:"DEPTH_COMPONENT"`
	DEPTH_COMPONENT16                            js.Value `js:"DEPTH_COMPONENT16"`
	DEPTH_FUNC                                   js.Value `js:"DEPTH_FUNC"`
	DEPTH_RANGE                                  js.Value `js:"DEPTH_RANGE"`
	DEPTH_STENCIL                                js.Value `js:"DEPTH_STENCIL"`
	DEPTH_STENCIL_ATTACHMENT                     js.Value `js:"DEPTH_STENCIL_ATTACHMENT"`
	DEPTH_TEST                                   js.Value `js:"DEPTH_TEST"`
	DEPTH_WRITEMASK                              js.Value `js:"DEPTH_WRITEMASK"`
	DITHER                                       js.Value `js:"DITHER"`
	DONT_CARE                                    js.Value `js:"DONT_CARE"`
	DST_ALPHA                                    js.Value `js:"DST_ALPHA"`
	DST_COLOR                                    js.Value `js:"DST_COLOR"`
	DYNAMIC_DRAW                                 js.Value `js:"DYNAMIC_DRAW"`
	ELEMENT_ARRAY_BUFFER                         js.Value `js:"ELEMENT_ARRAY_BUFFER"`
	ELEMENT_ARRAY_BUFFER_BINDING                 js.Value `js:"ELEMENT_ARRAY_BUFFER_BINDING"`
	EQUAL                                        js.Value `js:"EQUAL"`
	FASTEST                                      js.Value `js:"FASTEST"`
	FLOAT                                        js.Value `js:"FLOAT"`
	FLOAT_MAT2                                   js.Value `js:"FLOAT_MAT2"`
	FLOAT_MAT3                                   js.Value `js:"FLOAT_MAT3"`
	FLOAT_MAT4                                   js.Value `js:"FLOAT_MAT4"`
	FLOAT_VEC2                                   js.Value `js:"FLOAT_VEC2"`
	FLOAT_VEC3                                   js.Value `js:"FLOAT_VEC3"`
	FLOAT_VEC4                                   js.Value `js:"FLOAT_VEC4"`
	FRAGMENT_SHADER                              js.Value `js:"FRAGMENT_SHADER"`
	FRAMEBUFFER                                  js.Value `js:"FRAMEBUFFER"`
	FRAMEBUFFER_ATTACHMENT_OBJECT_NAME           js.Value `js:"FRAMEBUFFER_ATTACHMENT_OBJECT_NAME"`
	FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE           js.Value `js:"FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE"`
	FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE js.Value `js:"FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE"`
	FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL         js.Value `js:"FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL"`
	FRAMEBUFFER_BINDING                          js.Value `js:"FRAMEBUFFER_BINDING"`
	FRAMEBUFFER_COMPLETE                         js.Value `js:"FRAMEBUFFER_COMPLETE"`
	FRAMEBUFFER_INCOMPLETE_ATTACHMENT            js.Value `js:"FRAMEBUFFER_INCOMPLETE_ATTACHMENT"`
	FRAMEBUFFER_INCOMPLETE_DIMENSIONS            js.Value `js:"FRAMEBUFFER_INCOMPLETE_DIMENSIONS"`
	FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT    js.Value `js:"FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT"`
	FRAMEBUFFER_UNSUPPORTED                      js.Value `js:"FRAMEBUFFER_UNSUPPORTED"`
	FRONT                                        js.Value `js:"FRONT"`
	FRONT_AND_BACK                               js.Value `js:"FRONT_AND_BACK"`
	FRONT_FACE                                   js.Value `js:"FRONT_FACE"`
	FUNC_ADD                                     js.Value `js:"FUNC_ADD"`
	FUNC_REVERSE_SUBTRACT                        js.Value `js:"FUNC_REVERSE_SUBTRACT"`
	FUNC_SUBTRACT                                js.Value `js:"FUNC_SUBTRACT"`
	GENERATE_MIPMAP_HINT                         js.Value `js:"GENERATE_MIPMAP_HINT"`
	GEQUAL                                       js.Value `js:"GEQUAL"`
	GREATER                                      js.Value `js:"GREATER"`
	GREEN_BITS                                   js.Value `js:"GREEN_BITS"`
	HIGH_FLOAT                                   js.Value `js:"HIGH_FLOAT"`
	HIGH_INT                                     js.Value `js:"HIGH_INT"`
	INCR                                         js.Value `js:"INCR"`
	INCR_WRAP                                    js.Value `js:"INCR_WRAP"`
	INFO_LOG_LENGTH                              js.Value `js:"INFO_LOG_LENGTH"`
	INT                                          js.Value `js:"INT"`
	INT_VEC2                                     js.Value `js:"INT_VEC2"`
	INT_VEC3                                     js.Value `js:"INT_VEC3"`
	INT_VEC4                                     js.Value `js:"INT_VEC4"`
	INVALID_ENUM                                 js.Value `js:"INVALID_ENUM"`
	INVALID_FRAMEBUFFER_OPERATION                js.Value `js:"INVALID_FRAMEBUFFER_OPERATION"`
	INVALID_OPERATION                            js.Value `js:"INVALID_OPERATION"`
	INVALID_VALUE                                js.Value `js:"INVALID_VALUE"`
	INVERT                                       js.Value `js:"INVERT"`
	KEEP                                         js.Value `js:"KEEP"`
	LEQUAL                                       js.Value `js:"LEQUAL"`
	LESS                                         js.Value `js:"LESS"`
	LINEAR                                       js.Value `js:"LINEAR"`
	LINEAR_MIPMAP_LINEAR                         js.Value `js:"LINEAR_MIPMAP_LINEAR"`
	LINEAR_MIPMAP_NEAREST                        js.Value `js:"LINEAR_MIPMAP_NEAREST"`
	LINES                                        js.Value `js:"LINES"`
	LINE_LOOP                                    js.Value `js:"LINE_LOOP"`
	LINE_STRIP                                   js.Value `js:"LINE_STRIP"`
	LINE_WIDTH                                   js.Value `js:"LINE_WIDTH"`
	LINK_STATUS                                  js.Value `js:"LINK_STATUS"`
	LOW_FLOAT                                    js.Value `js:"LOW_FLOAT"`
	LOW_INT                                      js.Value `js:"LOW_INT"`
	LUMINANCE                                    js.Value `js:"LUMINANCE"`
	LUMINANCE_ALPHA                              js.Value `js:"LUMINANCE_ALPHA"`
	MAX_COMBINED_TEXTURE_IMAGE_UNITS             js.Value `js:"MAX_COMBINED_TEXTURE_IMAGE_UNITS"`
	MAX_CUBE_MAP_TEXTURE_SIZE                    js.Value `js:"MAX_CUBE_MAP_TEXTURE_SIZE"`
	MAX_FRAGMENT_UNIFORM_VECTORS                 js.Value `js:"MAX_FRAGMENT_UNIFORM_VECTORS"`
	MAX_RENDERBUFFER_SIZE                        js.Value `js:"MAX_RENDERBUFFER_SIZE"`
	MAX_TEXTURE_IMAGE_UNITS                      js.Value `js:"MAX_TEXTURE_IMAGE_UNITS"`
	MAX_TEXTURE_SIZE                             js.Value `js:"MAX_TEXTURE_SIZE"`
	MAX_VARYING_VECTORS                          js.Value `js:"MAX_VARYING_VECTORS"`
	MAX_VERTEX_ATTRIBS                           js.Value `js:"MAX_VERTEX_ATTRIBS"`
	MAX_VERTEX_TEXTURE_IMAGE_UNITS               js.Value `js:"MAX_VERTEX_TEXTURE_IMAGE_UNITS"`
	MAX_VERTEX_UNIFORM_VECTORS                   js.Value `js:"MAX_VERTEX_UNIFORM_VECTORS"`
	MAX_VIEWPORT_DIMS                            js.Value `js:"MAX_VIEWPORT_DIMS"`
	MEDIUM_FLOAT                                 js.Value `js:"MEDIUM_FLOAT"`
	MEDIUM_INT                                   js.Value `js:"MEDIUM_INT"`
	MIRRORED_REPEAT                              js.Value `js:"MIRRORED_REPEAT"`
	NEAREST                                      js.Value `js:"NEAREST"`
	NEAREST_MIPMAP_LINEAR                        js.Value `js:"NEAREST_MIPMAP_LINEAR"`
	NEAREST_MIPMAP_NEAREST                       js.Value `js:"NEAREST_MIPMAP_NEAREST"`
	NEVER                                        js.Value `js:"NEVER"`
	NICEST                                       js.Value `js:"NICEST"`
	NONE                                         js.Value `js:"NONE"`
	NOTEQUAL                                     js.Value `js:"NOTEQUAL"`
	NO_ERROR                                     js.Value `js:"NO_ERROR"`
	NUM_COMPRESSED_TEXTURE_FORMATS               js.Value `js:"NUM_COMPRESSED_TEXTURE_FORMATS"`
	ONE                                          js.Value `js:"ONE"`
	ONE_MINUS_CONSTANT_ALPHA                     js.Value `js:"ONE_MINUS_CONSTANT_ALPHA"`
	ONE_MINUS_CONSTANT_COLOR                     js.Value `js:"ONE_MINUS_CONSTANT_COLOR"`
	ONE_MINUS_DST_ALPHA                          js.Value `js:"ONE_MINUS_DST_ALPHA"`
	ONE_MINUS_DST_COLOR                          js.Value `js:"ONE_MINUS_DST_COLOR"`
	ONE_MINUS_SRC_ALPHA                          js.Value `js:"ONE_MINUS_SRC_ALPHA"`
	ONE_MINUS_SRC_COLOR                          js.Value `js:"ONE_MINUS_SRC_COLOR"`
	OUT_OF_MEMORY                                js.Value `js:"OUT_OF_MEMORY"`
	PACK_ALIGNMENT                               js.Value `js:"PACK_ALIGNMENT"`
	POINTS                                       js.Value `js:"POINTS"`
	POLYGON_OFFSET_FACTOR                        js.Value `js:"POLYGON_OFFSET_FACTOR"`
	POLYGON_OFFSET_FILL                          js.Value `js:"POLYGON_OFFSET_FILL"`
	POLYGON_OFFSET_UNITS                         js.Value `js:"POLYGON_OFFSET_UNITS"`
	RED_BITS                                     js.Value `js:"RED_BITS"`
	RENDERBUFFER                                 js.Value `js:"RENDERBUFFER"`
	RENDERBUFFER_ALPHA_SIZE                      js.Value `js:"RENDERBUFFER_ALPHA_SIZE"`
	RENDERBUFFER_BINDING                         js.Value `js:"RENDERBUFFER_BINDING"`
	RENDERBUFFER_BLUE_SIZE                       js.Value `js:"RENDERBUFFER_BLUE_SIZE"`
	RENDERBUFFER_DEPTH_SIZE                      js.Value `js:"RENDERBUFFER_DEPTH_SIZE"`
	RENDERBUFFER_GREEN_SIZE                      js.Value `js:"RENDERBUFFER_GREEN_SIZE"`
	RENDERBUFFER_HEIGHT                          js.Value `js:"RENDERBUFFER_HEIGHT"`
	RENDERBUFFER_INTERNAL_FORMAT                 js.Value `js:"RENDERBUFFER_INTERNAL_FORMAT"`
	RENDERBUFFER_RED_SIZE                        js.Value `js:"RENDERBUFFER_RED_SIZE"`
	RENDERBUFFER_STENCIL_SIZE                    js.Value `js:"RENDERBUFFER_STENCIL_SIZE"`
	RENDERBUFFER_WIDTH                           js.Value `js:"RENDERBUFFER_WIDTH"`
	RENDERER                                     js.Value `js:"RENDERER"`
	REPEAT                                       js.Value `js:"REPEAT"`
	REPLACE                                      js.Value `js:"REPLACE"`
	RGB                                          js.Value `js:"RGB"`
	RGB5_A1                                      js.Value `js:"RGB5_A1"`
	RGB565                                       js.Value `js:"RGB565"`
	RGBA                                         js.Value `js:"RGBA"`
	RGBA4                                        js.Value `js:"RGBA4"`
	SAMPLER_2D                                   js.Value `js:"SAMPLER_2D"`
	SAMPLER_CUBE                                 js.Value `js:"SAMPLER_CUBE"`
	SAMPLES                                      js.Value `js:"SAMPLES"`
	SAMPLE_ALPHA_TO_COVERAGE                     js.Value `js:"SAMPLE_ALPHA_TO_COVERAGE"`
	SAMPLE_BUFFERS                               js.Value `js:"SAMPLE_BUFFERS"`
	SAMPLE_COVERAGE                              js.Value `js:"SAMPLE_COVERAGE"`
	SAMPLE_COVERAGE_INVERT                       js.Value `js:"SAMPLE_COVERAGE_INVERT"`
	SAMPLE_COVERAGE_VALUE                        js.Value `js:"SAMPLE_COVERAGE_VALUE"`
	SCISSOR_BOX                                  js.Value `js:"SCISSOR_BOX"`
	SCISSOR_TEST                                 js.Value `js:"SCISSOR_TEST"`
	SHADER_COMPILER                              js.Value `js:"SHADER_COMPILER"`
	SHADER_SOURCE_LENGTH                         js.Value `js:"SHADER_SOURCE_LENGTH"`
	SHADER_TYPE                                  js.Value `js:"SHADER_TYPE"`
	SHADING_LANGUAGE_VERSION                     js.Value `js:"SHADING_LANGUAGE_VERSION"`
	SHORT                                        js.Value `js:"SHORT"`
	SRC_ALPHA                                    js.Value `js:"SRC_ALPHA"`
	SRC_ALPHA_SATURATE                           js.Value `js:"SRC_ALPHA_SATURATE"`
	SRC_COLOR                                    js.Value `js:"SRC_COLOR"`
	STATIC_DRAW                                  js.Value `js:"STATIC_DRAW"`
	STENCIL_ATTACHMENT                           js.Value `js:"STENCIL_ATTACHMENT"`
	STENCIL_BACK_FAIL                            js.Value `js:"STENCIL_BACK_FAIL"`
	STENCIL_BACK_FUNC                            js.Value `js:"STENCIL_BACK_FUNC"`
	STENCIL_BACK_PASS_DEPTH_FAIL                 js.Value `js:"STENCIL_BACK_PASS_DEPTH_FAIL"`
	STENCIL_BACK_PASS_DEPTH_PASS                 js.Value `js:"STENCIL_BACK_PASS_DEPTH_PASS"`
	STENCIL_BACK_REF                             js.Value `js:"STENCIL_BACK_REF"`
	STENCIL_BACK_VALUE_MASK                      js.Value `js:"STENCIL_BACK_VALUE_MASK"`
	STENCIL_BACK_WRITEMASK                       js.Value `js:"STENCIL_BACK_WRITEMASK"`
	STENCIL_BITS                                 js.Value `js:"STENCIL_BITS"`
	STENCIL_BUFFER_BIT                           js.Value `js:"STENCIL_BUFFER_BIT"`
	STENCIL_CLEAR_VALUE                          js.Value `js:"STENCIL_CLEAR_VALUE"`
	STENCIL_FAIL                                 js.Value `js:"STENCIL_FAIL"`
	STENCIL_FUNC                                 js.Value `js:"STENCIL_FUNC"`
	STENCIL_INDEX                                js.Value `js:"STENCIL_INDEX"`
	STENCIL_INDEX8                               js.Value `js:"STENCIL_INDEX8"`
	STENCIL_PASS_DEPTH_FAIL                      js.Value `js:"STENCIL_PASS_DEPTH_FAIL"`
	STENCIL_PASS_DEPTH_PASS                      js.Value `js:"STENCIL_PASS_DEPTH_PASS"`
	STENCIL_REF                                  js.Value `js:"STENCIL_REF"`
	STENCIL_TEST                                 js.Value `js:"STENCIL_TEST"`
	STENCIL_VALUE_MASK                           js.Value `js:"STENCIL_VALUE_MASK"`
	STENCIL_WRITEMASK                            js.Value `js:"STENCIL_WRITEMASK"`
	STREAM_DRAW                                  js.Value `js:"STREAM_DRAW"`
	SUBPIXEL_BITS                                js.Value `js:"SUBPIXEL_BITS"`
	TEXTURE                                      js.Value `js:"TEXTURE"`
	TEXTURE0                                     js.Value `js:"TEXTURE0"`
	TEXTURE1                                     js.Value `js:"TEXTURE1"`
	TEXTURE2                                     js.Value `js:"TEXTURE2"`
	TEXTURE3                                     js.Value `js:"TEXTURE3"`
	TEXTURE4                                     js.Value `js:"TEXTURE4"`
	TEXTURE5                                     js.Value `js:"TEXTURE5"`
	TEXTURE6                                     js.Value `js:"TEXTURE6"`
	TEXTURE7                                     js.Value `js:"TEXTURE7"`
	TEXTURE8                                     js.Value `js:"TEXTURE8"`
	TEXTURE9                                     js.Value `js:"TEXTURE9"`
	TEXTURE10                                    js.Value `js:"TEXTURE10"`
	TEXTURE11                                    js.Value `js:"TEXTURE11"`
	TEXTURE12                                    js.Value `js:"TEXTURE12"`
	TEXTURE13                                    js.Value `js:"TEXTURE13"`
	TEXTURE14                                    js.Value `js:"TEXTURE14"`
	TEXTURE15                                    js.Value `js:"TEXTURE15"`
	TEXTURE16                                    js.Value `js:"TEXTURE16"`
	TEXTURE17                                    js.Value `js:"TEXTURE17"`
	TEXTURE18                                    js.Value `js:"TEXTURE18"`
	TEXTURE19                                    js.Value `js:"TEXTURE19"`
	TEXTURE20                                    js.Value `js:"TEXTURE20"`
	TEXTURE21                                    js.Value `js:"TEXTURE21"`
	TEXTURE22                                    js.Value `js:"TEXTURE22"`
	TEXTURE23                                    js.Value `js:"TEXTURE23"`
	TEXTURE24                                    js.Value `js:"TEXTURE24"`
	TEXTURE25                                    js.Value `js:"TEXTURE25"`
	TEXTURE26                                    js.Value `js:"TEXTURE26"`
	TEXTURE27                                    js.Value `js:"TEXTURE27"`
	TEXTURE28                                    js.Value `js:"TEXTURE28"`
	TEXTURE29                                    js.Value `js:"TEXTURE29"`
	TEXTURE30                                    js.Value `js:"TEXTURE30"`
	TEXTURE31                                    js.Value `js:"TEXTURE31"`
	TEXTURE_2D                                   js.Value `js:"TEXTURE_2D"`
	TEXTURE_BINDING_2D                           js.Value `js:"TEXTURE_BINDING_2D"`
	TEXTURE_BINDING_CUBE_MAP                     js.Value `js:"TEXTURE_BINDING_CUBE_MAP"`
	TEXTURE_CUBE_MAP                             js.Value `js:"TEXTURE_CUBE_MAP"`
	TEXTURE_CUBE_MAP_NEGATIVE_X                  js.Value `js:"TEXTURE_CUBE_MAP_NEGATIVE_X"`
	TEXTURE_CUBE_MAP_NEGATIVE_Y                  js.Value `js:"TEXTURE_CUBE_MAP_NEGATIVE_Y"`
	TEXTURE_CUBE_MAP_NEGATIVE_Z                  js.Value `js:"TEXTURE_CUBE_MAP_NEGATIVE_Z"`
	TEXTURE_CUBE_MAP_POSITIVE_X                  js.Value `js:"TEXTURE_CUBE_MAP_POSITIVE_X"`
	TEXTURE_CUBE_MAP_POSITIVE_Y                  js.Value `js:"TEXTURE_CUBE_MAP_POSITIVE_Y"`
	TEXTURE_CUBE_MAP_POSITIVE_Z                  js.Value `js:"TEXTURE_CUBE_MAP_POSITIVE_Z"`
	TEXTURE_MAG_FILTER                           js.Value `js:"TEXTURE_MAG_FILTER"`
	TEXTURE_MIN_FILTER                           js.Value `js:"TEXTURE_MIN_FILTER"`
	TEXTURE_WRAP_S                               js.Value `js:"TEXTURE_WRAP_S"`
	TEXTURE_WRAP_T                               js.Value `js:"TEXTURE_WRAP_T"`
	TRIANGLES                                    js.Value `js:"TRIANGLES"`
	TRIANGLE_FAN                                 js.Value `js:"TRIANGLE_FAN"`
	TRIANGLE_STRIP                               js.Value `js:"TRIANGLE_STRIP"`
	UNPACK_ALIGNMENT                             js.Value `js:"UNPACK_ALIGNMENT"`
	UNPACK_COLORSPACE_CONVERSION_WEBGL           js.Value `js:"UNPACK_COLORSPACE_CONVERSION_WEBGL"`
	UNPACK_FLIP_Y_WEBGL                          js.Value `js:"UNPACK_FLIP_Y_WEBGL"`
	UNPACK_PREMULTIPLY_ALPHA_WEBGL               js.Value `js:"UNPACK_PREMULTIPLY_ALPHA_WEBGL"`
	UNSIGNED_BYTE                                js.Value `js:"UNSIGNED_BYTE"`
	UNSIGNED_INT                                 js.Value `js:"UNSIGNED_INT"`
	UNSIGNED_SHORT                               js.Value `js:"UNSIGNED_SHORT"`
	UNSIGNED_SHORT_4_4_4_4                       js.Value `js:"UNSIGNED_SHORT_4_4_4_4"`
	UNSIGNED_SHORT_5_5_5_1                       js.Value `js:"UNSIGNED_SHORT_5_5_5_1"`
	UNSIGNED_SHORT_5_6_5                         js.Value `js:"UNSIGNED_SHORT_5_6_5"`
	VALIDATE_STATUS                              js.Value `js:"VALIDATE_STATUS"`
	VENDOR                                       js.Value `js:"VENDOR"`
	VERSION                                      js.Value `js:"VERSION"`
	VERTEX_ATTRIB_ARRAY_BUFFER_BINDING           js.Value `js:"VERTEX_ATTRIB_ARRAY_BUFFER_BINDING"`
	VERTEX_ATTRIB_ARRAY_ENABLED                  js.Value `js:"VERTEX_ATTRIB_ARRAY_ENABLED"`
	VERTEX_ATTRIB_ARRAY_NORMALIZED               js.Value `js:"VERTEX_ATTRIB_ARRAY_NORMALIZED"`
	VERTEX_ATTRIB_ARRAY_POINTER                  js.Value `js:"VERTEX_ATTRIB_ARRAY_POINTER"`
	VERTEX_ATTRIB_ARRAY_SIZE                     js.Value `js:"VERTEX_ATTRIB_ARRAY_SIZE"`
	VERTEX_ATTRIB_ARRAY_STRIDE                   js.Value `js:"VERTEX_ATTRIB_ARRAY_STRIDE"`
	VERTEX_ATTRIB_ARRAY_TYPE                     js.Value `js:"VERTEX_ATTRIB_ARRAY_TYPE"`
	VERTEX_SHADER                                js.Value `js:"VERTEX_SHADER"`
	VIEWPORT                                     js.Value `js:"VIEWPORT"`
	ZERO                                         js.Value `js:"ZERO"`
}

func NewContext

func NewContext(canvas js.Value) (*Context, error)

NewContext takes an HTML5 canvas object and optional context attributes. If an error is returned it means you won't have access to WebGL functionality.

func (*Context) ActiveTexture

func (c *Context) ActiveTexture(texture int)

Specifies the active texture unit.

func (*Context) AttachShader

func (c *Context) AttachShader(program js.Value, shader js.Value)

Attaches a WebGLShader object to a WebGLProgram object.

func (*Context) BindAttribLocation

func (c *Context) BindAttribLocation(program js.Value, index int, name string)

Binds a generic vertex index to a user-defined attribute variable.

func (*Context) BindBuffer

func (c *Context) BindBuffer(target int, buffer js.Value)

Associates a buffer with a buffer target.

func (*Context) BindFramebuffer

func (c *Context) BindFramebuffer(target int, framebuffer js.Value)

Associates a WebGLFramebuffer object with the FRAMEBUFFER bind target.

func (*Context) BindRenderbuffer

func (c *Context) BindRenderbuffer(target int, renderbuffer js.Value)

Binds a WebGLRenderbuffer object to be used for rendering.

func (*Context) BindTexture

func (c *Context) BindTexture(target int, texture js.Value)

Binds a named texture object to a target.

func (*Context) BlendColor

func (c *Context) BlendColor(r, g, b, a float64)

The GL_BLEND_COLOR may be used to calculate the source and destination blending factors.

func (*Context) BlendEquation

func (c *Context) BlendEquation(mode int)

Sets the equation used to blend RGB and Alpha values of an incoming source fragment with a destination values as stored in the fragment's frame buffer.

func (*Context) BlendEquationSeparate

func (c *Context) BlendEquationSeparate(modeRGB, modeAlpha int)

Controls the blending of an incoming source fragment's R, G, B, and A values with a destination R, G, B, and A values as stored in the fragment's WebGLFramebuffer.

func (*Context) BlendFunc

func (c *Context) BlendFunc(sfactor, dfactor int)

Sets the blending factors used to combine source and destination pixels.

func (*Context) BlendFuncSeparate

func (c *Context) BlendFuncSeparate(srcRGB, dstRGB, srcAlpha, dstAlpha int)

Sets the weighting factors that are used by blendEquationSeparate.

func (*Context) BufferData

func (c *Context) BufferData(target int, data interface{}, usage int)

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.

func (*Context) BufferSubData

func (c *Context) BufferSubData(target int, offset int, data interface{})

Used to modify or update some or all of a data store for a bound buffer object.

func (*Context) CheckFramebufferStatus

func (c *Context) CheckFramebufferStatus(target int) int

Returns whether the currently bound WebGLFramebuffer is complete. If not complete, returns the reason why.

func (*Context) Clear

func (c *Context) Clear(flags js.Value)

Sets all pixels in a specific buffer to the same value.

func (*Context) ClearColor

func (c *Context) ClearColor(r, g, b, a float32)

Specifies color values to use by the clear method to clear the color buffer.

func (*Context) ClearDepth

func (c *Context) ClearDepth(depth float64)

Clears the depth buffer to a specific value.

func (*Context) ClearStencil

func (c *Context) ClearStencil(s int)

func (*Context) ColorMask

func (c *Context) ColorMask(r, g, b, a bool)

Lets you set whether individual colors can be written when drawing or rendering to a framebuffer.

func (*Context) CompileShader

func (c *Context) CompileShader(shader js.Value)

Compiles the GLSL shader source into binary data used by the WebGLProgram object.

func (*Context) CopyTexImage2D

func (c *Context) CopyTexImage2D(target, level, internal, x, y, w, h, border int)

Copies a rectangle of pixels from the current WebGLFramebuffer into a texture image.

func (*Context) CopyTexSubImage2D

func (c *Context) CopyTexSubImage2D(target, level, xoffset, yoffset, x, y, w, h int)

Replaces a portion of an existing 2D texture image with data from the current framebuffer.

func (*Context) CreateBuffer

func (c *Context) CreateBuffer() js.Value

Creates and initializes a WebGLBuffer.

func (*Context) CreateFramebuffer

func (c *Context) CreateFramebuffer() js.Value

Returns a WebGLFramebuffer object.

func (*Context) CreateProgram

func (c *Context) CreateProgram() js.Value

Creates an empty WebGLProgram object to which vector and fragment WebGLShader objects can be bound.

func (*Context) CreateRenderbuffer

func (c *Context) CreateRenderbuffer() js.Value

Creates and returns a WebGLRenderbuffer object.

func (*Context) CreateShader

func (c *Context) CreateShader(typ int) js.Value

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

func (*Context) CreateTexture

func (c *Context) CreateTexture() js.Value

Used to generate a WebGLTexture object to which images can be bound.

func (*Context) CullFace

func (c *Context) CullFace(mode int)

Sets whether or not front, back, or both facing facets are able to be culled.

func (*Context) DeleteBuffer

func (c *Context) DeleteBuffer(buffer js.Value)

Delete a specific buffer.

func (*Context) DeleteFramebuffer

func (c *Context) DeleteFramebuffer(framebuffer js.Value)

Deletes a specific WebGLFramebuffer object. If you delete the currently bound framebuffer, the default framebuffer will be bound. Deleting a framebuffer detaches all of its attachments.

func (*Context) DeleteProgram

func (c *Context) DeleteProgram(program js.Value)

Flags a specific WebGLProgram object for deletion if currently active. It will be deleted when it is no longer being used. Any shader objects associated with the program will be detached. They will be deleted if they were already flagged for deletion.

func (*Context) DeleteRenderbuffer

func (c *Context) DeleteRenderbuffer(renderbuffer js.Value)

Deletes the specified renderbuffer object. If the renderbuffer is currently bound, it will become unbound. If the renderbuffer is attached to the currently bound framebuffer, it is detached.

func (*Context) DeleteShader

func (c *Context) DeleteShader(shader js.Value)

Deletes a specific shader object.

func (*Context) DeleteTexture

func (c *Context) DeleteTexture(texture js.Value)

Deletes a specific texture object.

func (*Context) DepthFunc

func (c *Context) DepthFunc(fun int)

Sets a function to use to compare incoming pixel depth to the current depth buffer value.

func (*Context) DepthMask

func (c *Context) DepthMask(flag bool)

Sets whether or not you can write to the depth buffer.

func (*Context) DepthRange

func (c *Context) DepthRange(zNear, zFar float64)

Sets the depth range for normalized coordinates to canvas or viewport depth coordinates.

func (*Context) DetachShader

func (c *Context) DetachShader(program, shader js.Value)

Detach a shader object from a program object.

func (*Context) Disable

func (c *Context) Disable(cap int)

Turns off specific WebGL capabilities for this context.

func (*Context) DisableVertexAttribArray

func (c *Context) DisableVertexAttribArray(index int)

Turns off a vertex attribute array at a specific index position.

func (*Context) DrawArrays

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

Render geometric primitives from bound and enabled vertex data.

func (*Context) DrawElements

func (c *Context) DrawElements(mode, count, typ, offset int)

Renders geometric primitives indexed by element array data.

func (*Context) Enable

func (c *Context) Enable(cap int)

Turns on specific WebGL capabilities for this context.

func (*Context) EnableVertexAttribArray

func (c *Context) EnableVertexAttribArray(index int)

Turns on a vertex attribute at a specific index position in a vertex attribute array.

func (*Context) Finish

func (c *Context) Finish()

func (*Context) Flush

func (c *Context) Flush()

func (*Context) FrameBufferRenderBuffer

func (c *Context) FrameBufferRenderBuffer(target, attachment, renderbufferTarget int, renderbuffer js.Value)

Attaches a WebGLRenderbuffer object as a logical buffer to the currently bound WebGLFramebuffer object.

func (*Context) FramebufferTexture2D

func (c *Context) FramebufferTexture2D(target, attachment, textarget int, texture js.Value, level int)

Attaches a texture to a WebGLFramebuffer object.

func (*Context) FrontFace

func (c *Context) FrontFace(mode int)

Sets whether or not polygons are considered front-facing based on their winding direction.

func (*Context) GenerateMipmap

func (c *Context) GenerateMipmap(target int)

Creates a set of textures for a WebGLTexture object with image dimensions from the original size of the image down to a 1x1 image.

func (*Context) GetActiveAttrib

func (c *Context) GetActiveAttrib(program js.Value, index int) js.Value

Returns an WebGLActiveInfo object containing the size, type, and name of a vertex attribute at a specific index position in a program object.

func (*Context) GetActiveUniform

func (c *Context) GetActiveUniform(program js.Value, index int) js.Value

Returns an WebGLActiveInfo object containing the size, type, and name of a uniform attribute at a specific index position in a program object.

func (*Context) GetAttachedShaders

func (c *Context) GetAttachedShaders(program js.Value) []js.Value

Returns a slice of WebGLShaders bound to a WebGLProgram.

func (*Context) GetAttribLocation

func (c *Context) GetAttribLocation(program js.Value, name string) int

Returns an index to the location in a program of a named attribute variable.

func (*Context) GetBufferParameter

func (c *Context) GetBufferParameter(target, pname int) js.Value

TODO: Create type specific variations. Returns the type of a parameter for a given buffer.

func (*Context) GetContextAttributes

func (c *Context) GetContextAttributes() ContextAttributes

Returns the context attributes active on the context. These values might be different than what was requested on context creation if the browser's implementation doesn't support a feature.

func (*Context) GetError

func (c *Context) GetError() int

Returns a value for the WebGL error flag and clears the flag.

func (*Context) GetExtension

func (c *Context) GetExtension(name string) js.Value

TODO: Create type specific variations. Enables a passed extension, otherwise returns null.

func (*Context) GetFramebufferAttachmentParameter

func (c *Context) GetFramebufferAttachmentParameter(target, attachment, pname int) js.Value

TODO: Create type specific variations. Gets a parameter value for a given target and attachment.

func (*Context) GetParameter

func (c *Context) GetParameter(pname int) js.Value

TODO: Create type specific variations. Returns the natural type value for a constant parameter.

func (*Context) GetProgramInfoLog

func (c *Context) GetProgramInfoLog(program js.Value) string

Returns information about the last error that occurred during the failed linking or validation of a WebGL program object.

func (*Context) GetProgramParameterb

func (c *Context) GetProgramParameterb(program js.Value, pname int) bool

Returns the value of the program parameter that corresponds to a supplied pname which is interpreted as a bool.

func (*Context) GetProgramParameteri

func (c *Context) GetProgramParameteri(program js.Value, pname int) int

Returns the value of the program parameter that corresponds to a supplied pname which is interpreted as an int.

func (*Context) GetRenderbufferParameter

func (c *Context) GetRenderbufferParameter(target, pname int) js.Value

TODO: Create type specific variations. Returns a renderbuffer parameter from the currently bound WebGLRenderbuffer object.

func (*Context) GetShaderInfoLog

func (c *Context) GetShaderInfoLog(shader js.Value) string

Returns errors which occur when compiling a shader.

func (*Context) GetShaderParameter

func (c *Context) GetShaderParameter(shader js.Value, pname int) js.Value

TODO: Create type specific variations. Returns the value of the parameter associated with pname for a shader object.

func (*Context) GetShaderParameterb

func (c *Context) GetShaderParameterb(shader js.Value, pname int) bool

Returns the value of the parameter associated with pname for a shader object.

func (*Context) GetShaderSource

func (c *Context) GetShaderSource(shader js.Value) string

Returns source code string associated with a shader object.

func (*Context) GetSupportedExtensions

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

Returns a slice of supported extension strings.

func (*Context) GetTexParameter

func (c *Context) GetTexParameter(target, pname int) js.Value

TODO: Create type specific variations. Returns the value for a parameter on an active texture unit.

func (*Context) GetUniform

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

TODO: Create type specific variations. Gets the uniform value for a specific location in a program.

func (*Context) GetUniformLocation

func (c *Context) GetUniformLocation(program js.Value, name string) js.Value

Returns a WebGLUniformLocation object for the location of a uniform variable within a WebGLProgram object.

func (*Context) GetVertexAttrib

func (c *Context) GetVertexAttrib(index, pname int) js.Value

TODO: Create type specific variations. Returns data for a particular characteristic of a vertex attribute at an index in a vertex attribute array.

func (*Context) GetVertexAttribOffset

func (c *Context) GetVertexAttribOffset(index, pname int) int

Returns the address of a specified vertex attribute.

func (*Context) IsBuffer

func (c *Context) IsBuffer(buffer js.Value) bool

Returns true if buffer is valid, false otherwise.

func (*Context) IsContextLost

func (c *Context) IsContextLost() bool

Returns whether the WebGL context has been lost.

func (*Context) IsEnabled

func (c *Context) IsEnabled(capability int) bool

Returns whether or not a WebGL capability is enabled for this context.

func (*Context) IsFramebuffer

func (c *Context) IsFramebuffer(framebuffer js.Value) bool

Returns true if buffer is valid, false otherwise.

func (*Context) IsProgram

func (c *Context) IsProgram(program js.Value) bool

Returns true if program object is valid, false otherwise.

func (*Context) IsRenderbuffer

func (c *Context) IsRenderbuffer(renderbuffer js.Value) bool

Returns true if buffer is valid, false otherwise.

func (*Context) IsShader

func (c *Context) IsShader(shader js.Value) bool

Returns true if shader is valid, false otherwise.

func (*Context) IsTexture

func (c *Context) IsTexture(texture js.Value) bool

Returns true if texture is valid, false otherwise.

func (*Context) LineWidth

func (c *Context) LineWidth(width float64)

Sets the width of lines in WebGL.

func (*Context) LinkProgram

func (c *Context) LinkProgram(program js.Value)

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) PixelStorei

func (c *Context) PixelStorei(pname, param int)

Sets pixel storage modes for readPixels and unpacking of textures with texImage2D and texSubImage2D.

func (*Context) PolygonOffset

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

Sets the implementation-specific units and scale factor used to calculate fragment depth values.

func (*Context) ReadPixels

func (c *Context) ReadPixels(x, y, width, height, format, typ int, pixels js.Value)

TODO: Figure out if pixels should be a slice. Reads pixel data into an ArrayBufferView object from a rectangular area in the color buffer of the active frame buffer.

func (*Context) RenderbufferStorage

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

Creates or replaces the data store for the currently bound WebGLRenderbuffer object.

func (*Context) Scissor

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

Sets the dimensions of the scissor box.

func (*Context) ShaderSource

func (c *Context) ShaderSource(shader js.Value, source string)

Sets and replaces shader source code in a shader object.

func (*Context) TexImage2D

func (c *Context) TexImage2D(target, level, internalFormat, format, kind int, image js.Value)

Loads the supplied pixel data into a texture.

func (*Context) TexParameteri

func (c *Context) TexParameteri(target int, pname int, param int)

Sets texture parameters for the current texture unit.

func (*Context) TexSubImage2D

func (c *Context) TexSubImage2D(target, level, xoffset, yoffset, format, typ int, image js.Value)

Replaces a portion of an existing 2D texture image with all of another image.

func (*Context) Uniform1f

func (c *Context) Uniform1f(location js.Value, x float32)

Assigns a floating point value to a uniform variable for the current program object.

func (*Context) Uniform1i

func (c *Context) Uniform1i(location js.Value, x int)

Assigns a integer value to a uniform variable for the current program object.

func (*Context) Uniform2f

func (c *Context) Uniform2f(location js.Value, x, y float32)

Assigns 2 floating point values to a uniform variable for the current program object.

func (*Context) Uniform2i

func (c *Context) Uniform2i(location js.Value, x, y int)

Assigns 2 integer values to a uniform variable for the current program object.

func (*Context) Uniform3f

func (c *Context) Uniform3f(location js.Value, x, y, z float32)

Assigns 3 floating point values to a uniform variable for the current program object.

func (*Context) Uniform3i

func (c *Context) Uniform3i(location js.Value, x, y, z int)

Assigns 3 integer values to a uniform variable for the current program object.

func (*Context) Uniform4f

func (c *Context) Uniform4f(location js.Value, x, y, z, w float32)

Assigns 4 floating point values to a uniform variable for the current program object.

func (*Context) Uniform4i

func (c *Context) Uniform4i(location js.Value, x, y, z, w int)

Assigns 4 integer values to a uniform variable for the current program object.

func (*Context) UniformMatrix2fv

func (c *Context) UniformMatrix2fv(location js.Value, transpose bool, value []float32)

Sets values for a 2x2 floating point vector matrix into a uniform location as a matrix or a matrix array.

func (*Context) UniformMatrix3fv

func (c *Context) UniformMatrix3fv(location js.Value, transpose bool, value []float32)

Sets values for a 3x3 floating point vector matrix into a uniform location as a matrix or a matrix array.

func (*Context) UniformMatrix4fv

func (c *Context) UniformMatrix4fv(location js.Value, transpose bool, value []float32)

Sets values for a 4x4 floating point vector matrix into a uniform location as a matrix or a matrix array.

func (*Context) UseProgram

func (c *Context) UseProgram(program js.Value)

Set the program object to use for rendering.

func (*Context) ValidateProgram

func (c *Context) ValidateProgram(program js.Value)

Returns whether a given program can run in the current WebGL state.

func (*Context) VertexAttribPointer

func (c *Context) VertexAttribPointer(index, size, typ int, normal bool, stride int, offset int)

func (*Context) Viewport

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

Represents a rectangular viewable area that contains the rendering results of the drawing buffer.

type ContextAttributes

type ContextAttributes struct {
	// If Alpha is true, the drawing buffer has an alpha channel for
	// the purposes of performing OpenGL destination alpha operations
	// and compositing with the page.
	Alpha bool

	// If Depth is true, the drawing buffer has a depth buffer of at least 16 bits.
	Depth bool

	// If Stencil is true, the drawing buffer has a stencil buffer of at least 8 bits.
	Stencil bool

	// If Antialias is true and the implementation supports antialiasing
	// the drawing buffer will perform antialiasing using its choice of
	// technique (multisample/supersample) and quality.
	Antialias bool

	// If PremultipliedAlpha is true the page compositor will assume the
	// drawing buffer contains colors with premultiplied alpha.
	// This flag is ignored if the alpha flag is false.
	PremultipliedAlpha bool

	// If the value is true the buffers will not be cleared and will preserve
	// their values until cleared or overwritten by the author.
	PreserveDrawingBuffer bool
}

func DefaultAttributes

func DefaultAttributes() *ContextAttributes

Returns a copy of the default WebGL context attributes.

Jump to

Keyboard shortcuts

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