Documentation
¶
Overview ¶
Package gl provides a unified OpenGL/WebGL graphics backend
Index ¶
- type GraphicsBackend
- func (g *GraphicsBackend) Clear(c color.Color)
- func (g *GraphicsBackend) Close()
- func (g *GraphicsBackend) CompileShader(code string) graphics.ShaderHandle
- func (g *GraphicsBackend) CreateMSDFAtlas(atlasImg image.Image, distanceRange float64) (graphics.MSDFAtlas, error)
- func (g *GraphicsBackend) CreateRenderQueue() graphics.RenderQueue
- func (g *GraphicsBackend) CreateTexture(img image.Image) graphics.Texture
- func (g *GraphicsBackend) GetCurrentClipRect() *[4]int
- func (g *GraphicsBackend) GetPrimitiveBuffer() *pipelines.PrimitiveBuffer
- func (g *GraphicsBackend) GetScreenSize() (int, int)
- func (g *GraphicsBackend) PollEvents() bool
- func (g *GraphicsBackend) PopClipRect()
- func (g *GraphicsBackend) PrepareFrame()
- func (g *GraphicsBackend) PushClipRect(x, y, width, height int)
- func (g *GraphicsBackend) Render()
- func (g *GraphicsBackend) Resize(width, height int)
- func (g *GraphicsBackend) SetOnBeforeAddToQueue(fn func())
- func (g *GraphicsBackend) SetScreenSize(width, height int)
- func (g *GraphicsBackend) SetVSync(enabled bool)
- func (g *GraphicsBackend) SwapBuffers()
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type GraphicsBackend ¶
type GraphicsBackend struct {
*window.Window
*renderer.Renderer
*renderer.RenderQueue
*renderer.Surface
// contains filtered or unexported fields
}
GraphicsBackend provides the OpenGL graphics backend
func NewGraphicsBackend ¶
func NewGraphicsBackend(width, height int) (*GraphicsBackend, error)
NewGraphicsBackend creates a new OpenGL graphics backend
func (*GraphicsBackend) Clear ¶
func (g *GraphicsBackend) Clear(c color.Color)
Clear clears the screen with a color
func (*GraphicsBackend) CompileShader ¶
func (g *GraphicsBackend) CompileShader(code string) graphics.ShaderHandle
CompileShader compiles a shader
func (*GraphicsBackend) CreateMSDFAtlas ¶
func (g *GraphicsBackend) CreateMSDFAtlas(atlasImg image.Image, distanceRange float64) (graphics.MSDFAtlas, error)
CreateMSDFAtlas creates a new MSDF font atlas from an image
func (*GraphicsBackend) CreateRenderQueue ¶
func (g *GraphicsBackend) CreateRenderQueue() graphics.RenderQueue
CreateRenderQueue creates a new render queue
func (*GraphicsBackend) CreateTexture ¶
func (g *GraphicsBackend) CreateTexture(img image.Image) graphics.Texture
CreateTexture creates a new texture from an image
func (*GraphicsBackend) GetCurrentClipRect ¶
func (g *GraphicsBackend) GetCurrentClipRect() *[4]int
GetCurrentClipRect returns the current clip rectangle
func (*GraphicsBackend) GetPrimitiveBuffer ¶
func (g *GraphicsBackend) GetPrimitiveBuffer() *pipelines.PrimitiveBuffer
GetPrimitiveBuffer returns the primitive buffer
func (*GraphicsBackend) GetScreenSize ¶
func (g *GraphicsBackend) GetScreenSize() (int, int)
GetScreenSize returns the screen size
func (*GraphicsBackend) PollEvents ¶
func (g *GraphicsBackend) PollEvents() bool
PollEvents polls for window events
func (*GraphicsBackend) PopClipRect ¶
func (g *GraphicsBackend) PopClipRect()
PopClipRect pops a clip rectangle
func (*GraphicsBackend) PrepareFrame ¶
func (g *GraphicsBackend) PrepareFrame()
PrepareFrame prepares for a new frame
func (*GraphicsBackend) PushClipRect ¶
func (g *GraphicsBackend) PushClipRect(x, y, width, height int)
PushClipRect pushes a clip rectangle
func (*GraphicsBackend) Render ¶
func (g *GraphicsBackend) Render()
Render renders all queued objects
func (*GraphicsBackend) Resize ¶
func (g *GraphicsBackend) Resize(width, height int)
Resize resizes the graphics backend
func (*GraphicsBackend) SetOnBeforeAddToQueue ¶
func (g *GraphicsBackend) SetOnBeforeAddToQueue(fn func())
SetOnBeforeAddToQueue sets a callback before adding to queue
func (*GraphicsBackend) SetScreenSize ¶
func (g *GraphicsBackend) SetScreenSize(width, height int)
SetScreenSize sets the screen size and locks it so window resizes don't change it
func (*GraphicsBackend) SetVSync ¶
func (g *GraphicsBackend) SetVSync(enabled bool)
SetVSync enables or disables vsync
func (*GraphicsBackend) SwapBuffers ¶
func (g *GraphicsBackend) SwapBuffers()
SwapBuffers swaps the front and back buffers
Directories
¶
| Path | Synopsis |
|---|---|
|
internal
|
|
|
canvas
Package canvas provides a canvas element wrapper for WebGL rendering
|
Package canvas provides a canvas element wrapper for WebGL rendering |
|
glapi
Package glapi provides a unified GL abstraction layer for OpenGL and WebGL
|
Package glapi provides a unified GL abstraction layer for OpenGL and WebGL |
|
pipelines
Package pipelines provides rendering pipelines
|
Package pipelines provides rendering pipelines |
|
renderer
Package renderer provides the core rendering components
|
Package renderer provides the core rendering components |