gles20

package
v0.0.0-...-23544e4 Latest Latest
Warning

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

Go to latest
Published: Nov 28, 2019 License: MIT Imports: 17 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ApplyLightPos

func ApplyLightPos(location int, r *Renderer)

func ApplyModel

func ApplyModel(location int, r *Renderer)

func ApplyModelView

func ApplyModelView(location int, r *Renderer)

func ApplyModelViewProjection

func ApplyModelViewProjection(location int, r *Renderer)

func ApplyerMaterialColor

func ApplyerMaterialColor(location int, m *material.Instance)

func ApplyerMaterialTexture0

func ApplyerMaterialTexture0(location int, m *material.Instance)

Types

type Applyer

type Applyer func(location int, r *Renderer)

type Buffer

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

func NewBuffer

func NewBuffer() *Buffer

func (*Buffer) ReadFloat32

func (b *Buffer) ReadFloat32() (v float32, err error)

func (*Buffer) ReadFloat64

func (b *Buffer) ReadFloat64() (v float64, err error)

func (*Buffer) ReadUint16

func (b *Buffer) ReadUint16() (v uint16, err error)

func (*Buffer) ReadUint32

func (b *Buffer) ReadUint32() (v uint32, err error)

func (*Buffer) ReadUint64

func (b *Buffer) ReadUint64() (v uint64, err error)

func (*Buffer) String

func (b *Buffer) String() string

func (*Buffer) WriteFloat32

func (b *Buffer) WriteFloat32(v float32)

func (*Buffer) WriteFloat64

func (b *Buffer) WriteFloat64(v float64)

func (*Buffer) WriteUint16

func (b *Buffer) WriteUint16(v uint16)

func (*Buffer) WriteUint32

func (b *Buffer) WriteUint32(v uint32)

func (*Buffer) WriteUint64

func (b *Buffer) WriteUint64(v uint64)

type IBO

type IBO struct {
	Hint     int
	Format   int
	Mode     int
	Count    int
	Data     []byte
	GLBuffer gles20.Buffer
}

func (*IBO) Bind

func (b *IBO) Bind()

func (*IBO) Draw

func (b *IBO) Draw()

type LightUniform

type LightUniform struct {
	Uniform
	Apply Applyer
}

type Material

type Material struct {
	Program *Program
}

func NewMaterial

func NewMaterial(m *material.Material) *Material

func (*Material) Apply

func (m *Material) Apply(mi *material.Instance)

type MaterialApplyer

type MaterialApplyer func(location int, m *material.Instance)

type MaterialUniform

type MaterialUniform struct {
	Uniform
	Apply MaterialApplyer
}

type Mesh

type Mesh struct {
	Mesh *mesh.Mesh
	IBO  *IBO `json:"ibo"`
	VBO  *VBO `json:"vbo"`
}

func NewMesh

func NewMesh(m *mesh.Mesh) *Mesh

func (*Mesh) Draw

func (m *Mesh) Draw(attrs []int32)

func (*Mesh) Unbind

func (m *Mesh) Unbind()

type MeshUniform

type MeshUniform struct {
	Uniform
	Apply Applyer
}

type Program

type Program struct {
	Fragment         *Shader
	Vertex           *Shader
	Attribs          []int32
	MaterialUniforms []*MaterialUniform
	MeshUniforms     []*MeshUniform
	LightUniforms    []*LightUniform
	GLProgram        gles20.Program
}

func (*Program) Append

func (p *Program) Append(u *Uniform)

func (*Program) Compile

func (p *Program) Compile() (err error)

func (*Program) Use

func (p *Program) Use()

type Renderer

type Renderer struct {
	Model          *glm.Mat4x4
	ActiveCamera   *camera.Camera
	ActiveMaterial *Material
}

func (*Renderer) ApplyTexture

func (r *Renderer) ApplyTexture(t *texture.Texture, index int)

func (*Renderer) BindMaterial

func (r *Renderer) BindMaterial(m *material.Material)

func (*Renderer) BindMesh

func (r *Renderer) BindMesh(mesh *mesh.Mesh)

func (*Renderer) DrawMesh

func (r *Renderer) DrawMesh(mesh *mesh.Mesh)

func (*Renderer) SetCamera

func (r *Renderer) SetCamera(c *camera.Camera)

func (*Renderer) SetModel

func (r *Renderer) SetModel(m *glm.Mat4x4)

func (*Renderer) SetViewport

func (r *Renderer) SetViewport(v *glm.RectI)

func (*Renderer) UnbindMaterial

func (r *Renderer) UnbindMaterial(m *material.Material)

func (*Renderer) UnbindMesh

func (r *Renderer) UnbindMesh(mesh *mesh.Mesh)

func (*Renderer) UseMaterial

func (r *Renderer) UseMaterial(mi *material.Instance)

type Shader

type Shader struct {
	Type     int
	Source   string
	GLShader gles20.Shader
}

func (*Shader) Compile

func (s *Shader) Compile() error

type Texture

type Texture struct {
	Texture   *texture.Texture
	Min       int
	Mag       int
	GLTexture gles20.Texture
}

func (*Texture) Apply

func (t *Texture) Apply(i int)

func (*Texture) Bind

func (t *Texture) Bind()

type Uniform

type Uniform struct {
	Name     string
	Location int
	Type     int
}

type VBO

type VBO struct {
	Hint       int
	Mode       int
	Attributes []*VBOAttribute
	Data       []byte        `json:"-"`
	GLBuffer   gles20.Buffer `json:"-"`
}

func (*VBO) ApplyAttributes

func (b *VBO) ApplyAttributes(attrs []int32)

TODO: Apply only registered in the program.

func (*VBO) Bind

func (b *VBO) Bind()

func (*VBO) Draw

func (b *VBO) Draw()

type VBOAttribute

type VBOAttribute struct {
	Size       int  `json:"size"`
	Format     int  `json:"format"`
	Stride     int  `json:"stride"`
	Offset     int  `json:"offset"`
	Normalized bool `json:"normalized"`
}

func (*VBOAttribute) Enable

func (a *VBOAttribute) Enable(location uint32)

Jump to

Keyboard shortcuts

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