Documentation ¶
Index ¶
- Variables
- func ConvertRect(rect, bounds image.Rectangle) (x, y, width, height int)
- func ParseVersionString(ver string) (major, minor, release int, vendor string)
- func PreLoadShader(s *gfx.Shader, done chan *gfx.Shader) (doLoad bool, err error)
- func UnconvertRect(bounds image.Rectangle, x, y, width, height int) (rect image.Rectangle)
- type CommonState
- type Extensions
- type IndexStr
- type LocationCache
- type MVPCache
Constants ¶
This section is empty.
Variables ¶
var ( // CoordSys is a coordinate system matrix converting from a right-handed Z // up coordinate system to a right-handed Y up coordinate system. CoordSys = lmath.CoordSysZUpRight.ConvertMat4(lmath.CoordSysYUpRight) )
var DefaultBlendState = gfx.BlendState{ gfx.Color{R: 0, G: 0, B: 0, A: 0}, gfx.BOne, gfx.BZero, gfx.BOne, gfx.BZero, gfx.BAdd, gfx.BAdd, }
var DefaultCommonState = &CommonState{ DefaultState, image.Rect(0, 0, 0, 0), gfx.Color{R: 0.0, G: 0.0, B: 0.0, A: 0.0}, 1.0, 0, false, false, false, false, 0, }
var DefaultState = &gfx.State{ gfx.NoAlpha, DefaultBlendState, true, true, true, true, true, false, false, true, gfx.Less, false, gfx.NoFaceCulling, DefaultStencilState, DefaultStencilState, }
Functions ¶
func ConvertRect ¶
func ParseVersionString ¶
ParseVersionString parses a OpenGL version string and returns it's components.
The string returned may be 'major.minor' or 'major.minor.release' and may be followed by a space and any vendor specific information. For more information see:
func PreLoadShader ¶
PreLoadShader implements the precusor to gfx.Canvas.LoadShader; it returns a boolean value whether or not loading of the given shader should continue, and a (warning) error, if any.
Types ¶
type CommonState ¶
type CommonState struct { *gfx.State Scissor image.Rectangle ClearColor gfx.Color ClearDepth float64 ClearStencil int Blend bool ScissorTest bool Multisample bool SampleAlphaToCoverage bool ShaderProgram uint32 }
CommonState represents a set of common OpenGL state properties not covered by gfx.State.
type Extensions ¶
type Extensions map[string]struct{}
Extensions represents a set of OpenGL extensions. If an extension is present it is in the map.
func ParseExtensions ¶
func ParseExtensions(s string) Extensions
ParseExtensions parses the space-seperated list of OpenGL extensions and returned them.
func (Extensions) Present ¶
func (e Extensions) Present(s string) bool
Present tells if the given extension string is present or not.
func (Extensions) Slice ¶
func (e Extensions) Slice() []string
Slice returns the extensions as a slice of strings.
type IndexStr ¶
type IndexStr struct {
// contains filtered or unexported fields
}
IndexStr generates index strings with the given prefix, for example:
Texture0 Texture1 Texture2
func NewIndexStr ¶
NewIndexStr returns a new index string generator with the given prefix.
type LocationCache ¶
type LocationCache struct {
GetAttribLocation, GetUniformLocation func(name string) int
// contains filtered or unexported fields
}
LocationCache caches GLSL uniform and attribute locations.
func (*LocationCache) FindAttrib ¶
func (l *LocationCache) FindAttrib(name string) int
FindAttrib finds the named attribute location in the cache, if it's not in the cache it is queried from l.GetAttribLocation directly and cached for later.
func (*LocationCache) FindUniform ¶
func (l *LocationCache) FindUniform(name string) int
FindUniform finds the named uniform location in the cache, if it's not in the cache it is queried from l.GetUniformLocation directly and cached for later.
type MVPCache ¶
type MVPCache struct {
// The cached pre-calculated matrices to feed directly into shaders.
Model, View, Projection, MVP gfx.Mat4
// contains filtered or unexported fields
}
MVPCache caches a gfx.Object's Model, View, Projection and MVP matrices.
Each one is precalculated such that they can be fed directly into shaders without a recalculation each frame.