Documentation ¶
Index ¶
- Constants
- func AddRenderGroup(g *RenderGroup) int
- func DeinitMasterLoop()
- func GenerateImageFromFont(text string, font *truetype.Font, fontSize float64) (*image.RGBA, error)
- func GetNormalMatrix(id int) mgl32.Mat4
- func GetTextureByID(id string) (uint32, error)
- func GetViewPortSize() mgl32.Vec2
- func InitMasterLoop()
- func NewProgram(vertexShaderSource, fragmentShaderSource string) (uint32, error)
- func ReadFont(fontFile string) (*truetype.Font, error)
- func RegisterTextureFromFile(id string, file string) (uint32, error)
- func RegisterTextureFromImage(id string, img *image.RGBA) (uint32, error)
- func RemoveRenderGroup(id int)
- func Render()
- func SetClearColor(r, g, b, a float32)
- func SetViewPortSize(x, y int)
- type RenderGroup
- func (g *RenderGroup) Deinit()
- func (g *RenderGroup) GetShaderProgram() uint32
- func (g *RenderGroup) Render()
- func (g *RenderGroup) SetBlendingMode(enabled bool, blendFunc1, blendFunc2 uint32)
- func (g *RenderGroup) SetDepthTestMode(enabled bool, depthFunc uint32)
- func (g *RenderGroup) SetShaderFile(shaderFile string)
- type RenderGroupImplementation
Constants ¶
const ( NormalMatrixOrthoOrigo = iota NormalMatrixOrthoScreenCords = iota )
Normal matrix IDs
Variables ¶
This section is empty.
Functions ¶
func AddRenderGroup ¶
func AddRenderGroup(g *RenderGroup) int
AddRenderGroup assigns an id to the manager and returns it. This is NOT threadsafe and should not be ran while the graphics loop is running for now
func GenerateImageFromFont ¶
GenerateImageFromFont generates an image from string, font and size.
func GetNormalMatrix ¶
GetNormalMatrix returns a precalculated normalMatrix
func GetTextureByID ¶
GetTextureByID returns an opengl texture id identified by a string id.
func GetViewPortSize ¶
GetViewPortSize returns the size of the rendering area
func InitMasterLoop ¶
func InitMasterLoop()
InitMasterLoop must be called before starting the graphics system using Start().
func NewProgram ¶
NewProgram compiles a shader program som vertex and fragment sources Deprecated: will be removed at some points
func RegisterTextureFromFile ¶
RegisterTextureFromFile first checks the cache for the specified texture id, then it reads it from the file.
func RegisterTextureFromImage ¶
RegisterTextureFromImage first checks the cache for the specified texture id, then it creates one from the image.
func RemoveRenderGroup ¶
func RemoveRenderGroup(id int)
RemoveRenderGroup removes the specified id. This is NOT threadsafe and should not be ran while the graphics loop is running for now
func SetViewPortSize ¶
func SetViewPortSize(x, y int)
SetViewPortSize sets the size of the rendering area.
Types ¶
type RenderGroup ¶
type RenderGroup struct {
// contains filtered or unexported fields
}
RenderGroup implements basic shading handling
func GetRenderGroup ¶
func GetRenderGroup(id int) *RenderGroup
GetRenderGroup returns the specified manager
func NewRenderGroup ¶
func NewRenderGroup(id string, impl RenderGroupImplementation) *RenderGroup
NewRenderGroup creates a RenderGroup.
func (*RenderGroup) GetShaderProgram ¶
func (g *RenderGroup) GetShaderProgram() uint32
GetShaderProgram returns the shader pgm
func (*RenderGroup) Render ¶
func (g *RenderGroup) Render()
Render activates the shader program and calls the renderer
func (*RenderGroup) SetBlendingMode ¶
func (g *RenderGroup) SetBlendingMode(enabled bool, blendFunc1, blendFunc2 uint32)
SetBlendingMode sets the blending mode used when rendering this group
func (*RenderGroup) SetDepthTestMode ¶
func (g *RenderGroup) SetDepthTestMode(enabled bool, depthFunc uint32)
SetDepthTestMode sets the depth test details used when rendering this group
func (*RenderGroup) SetShaderFile ¶
func (g *RenderGroup) SetShaderFile(shaderFile string)
SetShaderFile sets the shader file according to file ending. possible endings: .frag or .vert The programs are not compiled until the first time they are run. The reason it does not compile the programs is to stay away from the graphics thread's business
type RenderGroupImplementation ¶
type RenderGroupImplementation interface { // Deinit deallocates any resources Deinit() InitShader() Render() }
RenderGroupImplementation is an actual implementation of a render group