gl

package
v0.0.0-...-6459203 Latest Latest
Warning

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

Go to latest
Published: Nov 30, 2020 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	FRAMEBUFFER       = 0x8D40
	RENDERBUFFER      = 0x8D41
	DEPTH_COMPONENT16 = 0x81A5
	//DEPTH24_STENCIL8         = 0x88F0 WEBGL2.0only
	DEPTH_ATTACHMENT = 0x8D00
	//DEPTH_STENCIL_ATTACHMENT = 0x821A
	COLOR_ATTACHMENT0 = 0x8CE0
)
View Source
const (
	COMPILE_STATUS  = 0x8B81
	VERTEX_SHADER   = 0x8B31
	FRAGMENT_SHADER = 0x8B30
)
View Source
const (
	TEXTURE0 = 0x84C0
	TEXTURE1 = 0x84C1
	TEXTURE2 = 0x84C2
	TEXTURE3 = 0x84C3
	TEXTURE4 = 0x84C4
	TEXTURE5 = 0x84C5
	TEXTURE6 = 0x84C6
	TEXTURE7 = 0x84C7

	RGB  = 0x1907
	RGBA = 0x1908

	UNSIGNED_BYTE   = 0x1401
	REPEAT          = 0x2901
	CLAMP_TO_EDGE   = 0x812F
	MIRRORED_REPEAT = 0x8370

	NEAREST = 0x2600
	LINEAR  = 0x2601

	TEXTURE_2D = 0x0DE1

	TEXTURE_MAG_FILTER = 0x2800
	TEXTURE_MIN_FILTER = 0x2801
	TEXTURE_WRAP_S     = 0x2802
	TEXTURE_WRAP_T     = 0x2803
	TEXTURE_WRAP_R     = 0x8072
)
View Source
const (
	TEXTURE_CUBE_MAP            = 0x8513
	TEXTURE_CUBE_MAP_POSITIVE_X = 0x8515
)
View Source
const (
	ARRAY_BUFFER = 0x8892
	STATIC_DRAW  = 0x88E4

	POINTS         = 0x0000
	LINES          = 0x0001
	LINE_LOOP      = 0x0002
	LINE_STRIP     = 0x0003
	TRIANGLES      = 0x0004
	TRIANGLE_STRIP = 0x0005
	TRIANGLE_FAN   = 0x0006

	FLOAT = 0x1406
)
View Source
const (
	DEPTH_BUFFER_BIT   = 0x00000100
	STENCIL_BUFFER_BIT = 0x00000400
	COLOR_BUFFER_BIT   = 0x00004000
)
View Source
const (
	DEPTH_TEST = 0x0B71
	LEQUAL     = 0x0203
	LESS       = 0x0201

	BLEND                    = 0x0BE2
	ONE_MINUS_SRC_ALPHA      = 0x0303
	ONE_MINUS_CONSTANT_COLOR = 0x8002
	ONE_MINUS_DST_ALPHA      = 0x0305
	ONE_MINUS_DST_COLOR      = 0x0307
	ONE_MINUS_SRC_COLOR      = 0x0301

	SRC_ALPHA = 0x0302
)

Variables

This section is empty.

Functions

func BindFramebuffer

func BindFramebuffer(fType, index uint32)

This function is broken... since webgl requires the framebuffer to be an object rather than an index. We can cheat it for now.

func BlendFunc

func BlendFunc(sFact, dFact uint32)

func Clear

func Clear(mask uint32)

func ClearColor

func ClearColor(r, g, b, a float32)

func DepthFunc

func DepthFunc(v uint32)

func Enable

func Enable(v uint32)

func NewCube

func NewCube(p VertParams) (uint32, []int32, []float32)

func NewSphere

func NewSphere(p VertParams) (uint32, []int32, []float32)

Types

type Cubemap

type Cubemap struct {
	Right  string
	Left   string
	Top    string
	Bottom string
	Front  string
	Back   string
	// contains filtered or unexported fields
}

func (*Cubemap) Bind

func (cm *Cubemap) Bind(num uint32)

func (*Cubemap) Load

func (cm *Cubemap) Load() error

type Framebuffer

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

Perhaps it makes sense to have texture textureColorbuffer as a texture. I don't understand framebuffers and usage as much as I would like to So ideally I want to revisit this for when usage needs more customization.

func NewFramebuffer

func NewFramebuffer(width, height int32) *Framebuffer

func (*Framebuffer) Bind

func (f *Framebuffer) Bind()

func (*Framebuffer) BindTexture

func (f *Framebuffer) BindTexture(v uint32)

type OrbitalCamera

type OrbitalCamera struct {
	Position mgl.Vec3

	ScaleFactor float32
	Sensativity float32
	// contains filtered or unexported fields
}

func NewOrbitalCamera

func NewOrbitalCamera(w *Window, radius float32, center mgl.Vec3) *OrbitalCamera

func (*OrbitalCamera) LookAt

func (c *OrbitalCamera) LookAt() mgl.Mat4

type Shader

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

func CompileShader

func CompileShader(vertexCode, fragCode string) (*Shader, error)

func (*Shader) SetBool

func (s *Shader) SetBool(name string, value bool) *Shader

func (*Shader) SetFloat

func (s *Shader) SetFloat(name string, value float32) *Shader

func (*Shader) SetInt

func (s *Shader) SetInt(name string, value int32) *Shader

func (*Shader) SetMat4

func (s *Shader) SetMat4(name string, value mgl.Mat4) *Shader

func (*Shader) SetVec2

func (s *Shader) SetVec2(name string, value mgl.Vec2) *Shader

func (*Shader) SetVec3

func (s *Shader) SetVec3(name string, value mgl.Vec3) *Shader

func (*Shader) Use

func (s *Shader) Use() *Shader

type Texture

type Texture struct {
	Width          int32
	Height         int32
	InternalFormat int32
	ImageFormat    uint32
	WrapS          int32
	WrapT          int32
	FilterMin      int32
	FilterMax      int32
	// contains filtered or unexported fields
}

func NewTexture

func NewTexture() *Texture

func TextureFromFile

func TextureFromFile(file string) (*Texture, error)

func (*Texture) Bind

func (t *Texture) Bind(num uint32)

func (*Texture) Generate

func (t *Texture) Generate(width, height int32, data []byte)

type VAO

type VAO struct {
	VAO           uint32
	VBO           uint32
	VertexAmount  int32
	PrimitiveType uint32
}

func NewVAO

func NewVAO(primitiveType uint32, offsets []int32, verts []float32) *VAO

func (*VAO) Draw

func (v *VAO) Draw()

type VertParams

type VertParams common.VertParams

type Window

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

func NewWindow

func NewWindow(width, height int32, title string) (*Window, error)

func (*Window) GetDT

func (w *Window) GetDT() float32

func (*Window) GetTime

func (w *Window) GetTime() float32

func (*Window) PollEvents

func (w *Window) PollEvents()

func (*Window) Run

func (w *Window) Run(frameFunc func())

func (*Window) SwapBuffers

func (w *Window) SwapBuffers()

func (*Window) Terminate

func (w *Window) Terminate()

Jump to

Keyboard shortcuts

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