Documentation ¶
Index ¶
- type Shader
- func (s *Shader) BindTextures()
- func (s *Shader) GetAttribLocation(name string) uint32
- func (s *Shader) Handle() uint32
- func (s *Shader) SetUniformFloat(name string, value float32)
- func (s *Shader) SetUniformInt(name string, value int32)
- func (s *Shader) SetUniformMat4(name string, value mgl32.Mat4)
- func (s *Shader) SetUniformTexture(name string, tex *Texture)
- func (s *Shader) SetUniformTextureHandle(name string, tex uint32)
- func (s *Shader) SetUniformVec2f(name string, value itype.Vec2f)
- func (s *Shader) SetUniformVec2i(name string, value itype.Vec2i)
- func (s *Shader) SetUniformVec3f(name string, value itype.Vec3f)
- func (s *Shader) SetUniformVec3i(name string, value itype.Vec3i)
- func (s *Shader) SetUniformVec4f(name string, value itype.Vec4f)
- func (s *Shader) SetUniformVec4i(name string, value itype.Vec4i)
- func (s *Shader) UniformLocation(name string) int32
- func (s *Shader) UseProgram()
- type Texture
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Shader ¶
type Shader struct {
// contains filtered or unexported fields
}
Shader contains a shader program, with a vertex and a fragment (pixel) shader.
func NewShader ¶
NewShader compiles and links a Vertex and a Fragment (Pixel) shader into one program. The source code does not need to be terminated with \x00.
func (*Shader) BindTextures ¶
func (s *Shader) BindTextures()
BindTextures calls glActiveTexture and glBindTexture, updating the texture unit slots.
func (*Shader) GetAttribLocation ¶
func (*Shader) SetUniformFloat ¶
func (*Shader) SetUniformInt ¶
func (*Shader) SetUniformTexture ¶
func (*Shader) SetUniformTextureHandle ¶
SetUniformTextureHandle sets a uniform as a sampler2D from an external OpenGL texture. tex is the OpenGL texture handle (the one you get with glGenTextures())
func (*Shader) UniformLocation ¶
UniformLocation returns the location id of the given uniform. it returns -1 if the uniform is not found.
type Texture ¶
type Texture struct {
// contains filtered or unexported fields
}
Texture holds handle to OpenGL Texture on the graphics card memory.
func NewTextureFromHandle ¶
NewTextureFromHandle creates a new *Texture from an existing OpenGL handle.
func NewTextureRGBA ¶
NewTextureRGBA creates a new Texture with image.
func (*Texture) GenerateMipMap ¶
func (t *Texture) GenerateMipMap()
GenerateMipMap generates mipmap for the texture.
func (*Texture) InvalidateMipMap ¶
func (t *Texture) InvalidateMipMap()
InvalidateMipMap invalidates mipmap for the texture.
func (*Texture) SetSmooth ¶
SetSmooth sets the min/mag filters to LINEAR(smooth) or NEAREST(not smooth)
func (*Texture) UpdateRGBA ¶
UpdateRGBA updates the content of the texture with image. It deletes existing mipmap, you need to generate it again.