render

package
v0.0.0-...-e8e0880 Latest Latest
Warning

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

Go to latest
Published: Jul 20, 2022 License: MIT Imports: 7 Imported by: 0

Documentation

Index

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

func NewShader(vert, frag string) (s *Shader, err error)

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 (s *Shader) GetAttribLocation(name string) uint32

func (*Shader) Handle

func (s *Shader) Handle() uint32

Handle returns the OpenGL handle of the program.

func (*Shader) SetUniformFloat

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

func (*Shader) SetUniformInt

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

func (*Shader) SetUniformMat4

func (s *Shader) SetUniformMat4(name string, value mgl32.Mat4)

func (*Shader) SetUniformTexture

func (s *Shader) SetUniformTexture(name string, tex *Texture)

func (*Shader) SetUniformTextureHandle

func (s *Shader) SetUniformTextureHandle(name string, tex uint32)

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

func (s *Shader) SetUniformVec2f(name string, value itype.Vec2f)

func (*Shader) SetUniformVec2i

func (s *Shader) SetUniformVec2i(name string, value itype.Vec2i)

func (*Shader) SetUniformVec3f

func (s *Shader) SetUniformVec3f(name string, value itype.Vec3f)

func (*Shader) SetUniformVec3i

func (s *Shader) SetUniformVec3i(name string, value itype.Vec3i)

func (*Shader) SetUniformVec4f

func (s *Shader) SetUniformVec4f(name string, value itype.Vec4f)

func (*Shader) SetUniformVec4i

func (s *Shader) SetUniformVec4i(name string, value itype.Vec4i)

func (*Shader) UniformLocation

func (s *Shader) UniformLocation(name string) int32

UniformLocation returns the location id of the given uniform. it returns -1 if the uniform is not found.

func (*Shader) UseProgram

func (s *Shader) UseProgram()

UseProgram calls glUseProgram.

type Texture

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

Texture holds handle to OpenGL Texture on the graphics card memory.

func NewTexture

func NewTexture() *Texture

NewTexture creates a new, empty Texture.

func NewTextureFromHandle

func NewTextureFromHandle(handle uint32) *Texture

NewTextureFromHandle creates a new *Texture from an existing OpenGL handle.

func NewTextureRGBA

func NewTextureRGBA(image *image.RGBA) *Texture

NewTextureRGBA creates a new Texture with image.

func (*Texture) Free

func (t *Texture) Free()

Free deletes the texture.

func (*Texture) GenerateMipMap

func (t *Texture) GenerateMipMap()

GenerateMipMap generates mipmap for the texture.

func (*Texture) Handle

func (t *Texture) Handle() uint32

Handle returns the OpenGL handle of the texture.

func (*Texture) InvalidateMipMap

func (t *Texture) InvalidateMipMap()

InvalidateMipMap invalidates mipmap for the texture.

func (*Texture) SetSmooth

func (t *Texture) SetSmooth(smooth bool)

SetSmooth sets the min/mag filters to LINEAR(smooth) or NEAREST(not smooth)

func (*Texture) UpdateRGBA

func (t *Texture) UpdateRGBA(image *image.RGBA)

UpdateRGBA updates the content of the texture with image. It deletes existing mipmap, you need to generate it again.

Jump to

Keyboard shortcuts

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