webgl

package module
v0.0.0-...-33a8433 Latest Latest
Warning

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

Go to latest
Published: Mar 22, 2019 License: Unlicense Imports: 2 Imported by: 0

README

go-webgl

Testing own wrapper for WebGL

Based on:

https://github.com/bobcob7/wasm-basic-triangle

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BeginMode

type BeginMode uint
const (
	POINTS         BeginMode = 0x0000
	LINES          BeginMode = 0x0001
	LINE_LOOP      BeginMode = 0x0002
	LINE_STRIP     BeginMode = 0x0003
	TRIANGLES      BeginMode = 0x0004
	TRIANGLE_STRIP BeginMode = 0x0005
	TRIANGLE_FAN   BeginMode = 0x0006
)

type Buffer

type Buffer struct {
	js.Value
}

type BufferTarget

type BufferTarget uint
const (
	ARRAY_BUFFER                 BufferTarget = 0x8892
	ELEMENT_ARRAY_BUFFER         BufferTarget = 0x8893
	ARRAY_BUFFER_BINDING         BufferTarget = 0x8894
	ELEMENT_ARRAY_BUFFER_BINDING BufferTarget = 0x8895
)

type Canvas

type Canvas struct {
	Width  uint
	Height uint
	// contains filtered or unexported fields
}

func CreateCanvasAt

func CreateCanvasAt(divID string, withID string) *Canvas

type ClearBufferMask

type ClearBufferMask uint
const (
	DEPTH_BUFFER_BIT   ClearBufferMask = 0x00000100
	STENCIL_BUFFER_BIT ClearBufferMask = 0x00000400
	COLOR_BUFFER_BIT   ClearBufferMask = 0x00004000
)

type Context

type Context struct {
	js.Value
}

func GetContext

func GetContext(canvas *Canvas) (*Context, error)

func (*Context) AttachShader

func (gl *Context) AttachShader(prog *Program, shader *Shader)

func (*Context) BindBuffer

func (gl *Context) BindBuffer(target BufferTarget, buffer *Buffer)

func (*Context) BufferData

func (gl *Context) BufferData(target BufferTarget, data interface{}, usage Usage)

func (*Context) Clear

func (gl *Context) Clear(mask ClearBufferMask)

func (*Context) ClearColor

func (gl *Context) ClearColor(r float64, g float64, b float64, a float64)

func (*Context) CompileShader

func (gl *Context) CompileShader(shader *Shader)

func (*Context) CreateBuffer

func (gl *Context) CreateBuffer(target BufferTarget) *Buffer

func (*Context) CreateProgram

func (gl *Context) CreateProgram() *Program

func (*Context) CreateShader

func (gl *Context) CreateShader(sType Shaders) *Shader

func (*Context) DrawElements

func (gl *Context) DrawElements(mode BeginMode, count uint, dtype DataType, offset uint)

func (*Context) Enable

func (gl *Context) Enable(cap EnableCap)

func (*Context) EnableVertexAttribArray

func (gl *Context) EnableVertexAttribArray(loc *Location)

func (*Context) GetAttribLocation

func (gl *Context) GetAttribLocation(prog *Program, attr string) *Location

func (*Context) LinkProgram

func (gl *Context) LinkProgram(prog *Program)

func (*Context) ShaderSource

func (gl *Context) ShaderSource(shader *Shader, source string)

func (*Context) UseProgram

func (gl *Context) UseProgram(prog *Program)

func (*Context) VertexAttribPointer

func (gl *Context) VertexAttribPointer(loc *Location, size uint, dtype DataType, normalized bool, stride uint, offset uint)

func (*Context) Viewport

func (gl *Context) Viewport(x uint, y uint, width uint, height uint)

type DataType

type DataType uint
const (
	BYTE           DataType = 0x1400
	UNSIGNED_BYTE  DataType = 0x1401
	SHORT          DataType = 0x1402
	UNSIGNED_SHORT DataType = 0x1403
	INT            DataType = 0x1404
	UNSIGNED_INT   DataType = 0x1405
	FLOAT          DataType = 0x1406
)

type EnableCap

type EnableCap uint
const (
	CULL_FACE                EnableCap = 0x0B44
	BLEND                    EnableCap = 0x0BE2
	DITHER                   EnableCap = 0x0BD0
	STENCIL_TEST             EnableCap = 0x0B90
	DEPTH_TEST               EnableCap = 0x0B71
	SCISSOR_TEST             EnableCap = 0x0C11
	POLYGON_OFFSET_FILL      EnableCap = 0x8037
	SAMPLE_ALPHA_TO_COVERAGE EnableCap = 0x809E
	SAMPLE_COVERAGE          EnableCap = 0x80A0
)

EnableCap TEXTURE_2D

type Location

type Location struct {
	js.Value
}

type Program

type Program struct {
	js.Value
}

type Shader

type Shader struct {
	js.Value
}

type Shaders

type Shaders uint
const (
	FRAGMENT_SHADER                  Shaders = 0x8B30
	VERTEX_SHADER                    Shaders = 0x8B31
	MAX_VERTEX_ATTRIBS               Shaders = 0x8869
	MAX_VERTEX_UNIFORM_VECTORS       Shaders = 0x8DFB
	MAX_VARYING_VECTORS              Shaders = 0x8DFC
	MAX_COMBINED_TEXTURE_IMAGE_UNITS Shaders = 0x8B4D
	MAX_VERTEX_TEXTURE_IMAGE_UNITS   Shaders = 0x8B4C
	MAX_TEXTURE_IMAGE_UNITS          Shaders = 0x8872
	MAX_FRAGMENT_UNIFORM_VECTORS     Shaders = 0x8DFD
	SHADER_TYPE                      Shaders = 0x8B4F
	DELETE_STATUS                    Shaders = 0x8B80
	LINK_STATUS                      Shaders = 0x8B82
	VALIDATE_STATUS                  Shaders = 0x8B83
	ATTACHED_SHADERS                 Shaders = 0x8B85
	ACTIVE_UNIFORMS                  Shaders = 0x8B86
	ACTIVE_ATTRIBUTES                Shaders = 0x8B89
	SHADING_LANGUAGE_VERSION         Shaders = 0x8B8C
	CURRENT_PROGRAM                  Shaders = 0x8B8D
)

type Usage

type Usage uint
const (
	STREAM_DRAW  Usage = 0x88E0
	STATIC_DRAW  Usage = 0x88E4
	DYNAMIC_DRAW Usage = 0x88E8
)

Jump to

Keyboard shortcuts

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