Documentation
¶
Index ¶
- Variables
- func GLDebugOutput() <-chan GLDebugMessage
- func Includes(filenames ...string) ([]string, error)
- func ListUniforms(program uint32) map[string]Uniform
- type CompileError
- type Environment
- type GLDebugMessage
- type LinkError
- type OnScreenEngine
- type OpenGLVersion
- type RenderState
- type Shader
- type Source
- type SourceBuf
- type SourceFile
- type Stage
- type SubEnvironment
- type Uniform
Constants ¶
This section is empty.
Variables ¶
var ErrWindowClosed = errors.New("window closed")
Functions ¶
func GLDebugOutput ¶
func GLDebugOutput() <-chan GLDebugMessage
func Includes ¶
Includes recursively resolves dependencies in the specified file.
The argument file is returned included in the returned list of files.
func ListUniforms ¶
Types ¶
type CompileError ¶
type CompileError struct {
// contains filtered or unexported fields
}
func (CompileError) Error ¶
func (err CompileError) Error() string
func (CompileError) PrettyPrint ¶
func (err CompileError) PrettyPrint(out io.Writer)
type Environment ¶
type Environment interface {
// Sources should return the shader sources mapped by their pipeline stage.
// Multiple shader sources are combined per stage.
Sources() (map[Stage][]Source, error)
// Setup may be used to initialize any OpenGL state before the first frame
// is rendered.
Setup(state RenderState) error
// SubEnvironments returns a set of environments which render output is
// required in this environment.
//
// The implementing environment is not required to retain any state of the
// environments returned.
SubEnvironments() (map[string]SubEnvironment, error)
// PreRender updates the program's uniform values for each next frame.
//
// sinceStart is the animation time elapsed since the first frame was
// rendered.
PreRender(state RenderState)
// Close should shut down the environment by freeing all associated
// (OpenGL) resources.
Close() error
}
type GLDebugMessage ¶
type GLDebugMessage struct {
ID uint32
Source uint32
Type uint32
Severity uint32
Message string
Stack string
}
func (GLDebugMessage) SeverityString ¶
func (dm GLDebugMessage) SeverityString() string
func (GLDebugMessage) String ¶
func (dm GLDebugMessage) String() string
type OnScreenEngine ¶
type OnScreenEngine struct {
// contains filtered or unexported fields
}
OnScreenEngine is an animation engine for rendering to an OS window.
Internally, it renders to a framebuffer so we can obtain a texture containing a rendered frame that can be used as the previous frame in shaders. This texture is then immediately outputted to the window by drawing a fullscreen quad.
func NewOnScreenEngine ¶
func NewOnScreenEngine(glVersion OpenGLVersion) (*OnScreenEngine, error)
func (*OnScreenEngine) Close ¶
func (eng *OnScreenEngine) Close() error
func (*OnScreenEngine) SetEnvironment ¶
func (eng *OnScreenEngine) SetEnvironment(env Environment)
type OpenGLVersion ¶
type OpenGLVersion int
const ( OpenGL20 OpenGLVersion = 20 OpenGL21 OpenGLVersion = 21 OpenGL30 OpenGLVersion = 30 OpenGL31 OpenGLVersion = 31 OpenGL32 OpenGLVersion = 32 OpenGL33 OpenGLVersion = 33 )
func OpenGLVersionFromGLSLVersion ¶
func OpenGLVersionFromGLSLVersion(s string) (OpenGLVersion, error)
func ParseOpenGLVersion ¶
func ParseOpenGLVersion(s string) (OpenGLVersion, error)
func (OpenGLVersion) String ¶
func (v OpenGLVersion) String() string
type RenderState ¶
type RenderState struct {
Time time.Duration
Interval time.Duration
FramesProcessed uint64
CanvasWidth uint
CanvasHeight uint
Uniforms map[string]Uniform
PreviousFrameTexID func() uint32
// SubBuffers contains the render output for each environment returned by
// SubEnvironments as a textureID.
SubBuffers map[string]uint32
}
type Shader ¶
type Shader struct {
// contains filtered or unexported fields
}
func (*Shader) SetEnvironment ¶
func (sh *Shader) SetEnvironment(env Environment)
type Source ¶
type Source interface {
// Contents reads the contents of the source file.
Contents() ([]byte, error)
// Dir returns the parent directory the file is located in.
Dir() string
}
Source represents a single source file.
type SourceBuf ¶
type SourceBuf string
SourceBuf is an implementation of the Source interface that keeps its contents in memory.
type SourceFile ¶
type SourceFile struct {
Filename string
}
SourceFile is an implementation of the Source interface for real files.
func SourceFiles ¶
func SourceFiles(filenames ...string) []SourceFile
func (SourceFile) Contents ¶
func (s SourceFile) Contents() ([]byte, error)
Contents implemetns the Source interface.
type SubEnvironment ¶
type SubEnvironment struct {
Environment
Width, Height uint
}