gl

package
v0.0.0-...-f65bbdb Latest Latest
Warning

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

Go to latest
Published: Feb 10, 2026 License: MIT Imports: 8 Imported by: 0

Documentation

Overview

Package gl provides a unified OpenGL/WebGL graphics backend

Index

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

func (g *GraphicsBackend) Close()

Close cleans up resources

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

Jump to

Keyboard shortcuts

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