gl

package
v2.0.0-...-96ae00f Latest Latest
Warning

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

Go to latest
Published: Mar 8, 2024 License: BSD-3-Clause Imports: 17 Imported by: 0

Documentation

Overview

Package gl provides a full Fyne render implementation using system OpenGL libraries.

Index

Constants

View Source
const (
	GlFalse = gl.FALSE
	GlTrue  = gl.TRUE

	Texture2D        = gl.TEXTURE_2D
	TextureMinFilter = gl.TEXTURE_MIN_FILTER
	TextureMagFilter = gl.TEXTURE_MAG_FILTER

	Triangles = gl.TRIANGLES

	GlRgba              = gl.RGBA
	GlUnsigedBytes      = gl.UNSIGNED_BYTE
	LinearMipMapNearest = gl.LINEAR_MIPMAP_NEAREST
)
View Source
const (
	LineStrIp   = gl.LINE_STRIP
	LineLoop    = gl.LINE_LOOP
	Quads       = gl.QUADS
	Lines       = gl.LINES
	Points      = gl.POINTS
	Fog         = gl.FOG
	FogMode     = gl.FOG_MODE
	FogDensity  = gl.FOG_DENSITY
	FogHint     = gl.FOG_HINT
	FogDontCare = gl.DONT_CARE
	Exp         = gl.EXP
	Exp2        = gl.EXP2
	FogStart    = gl.FOG_START
	FogEnd      = gl.FOG_END
	FogColor    = gl.FOG_COLOR
	CullFace    = gl.CULL_FACE
	Lequal      = gl.LEQUAL
	Linear      = gl.LINEAR
)

Variables

This section is empty.

Functions

func GetTextureByIndex

func GetTextureByIndex(index int) uint32

Types

type Canvas3D

type Canvas3D interface {
	InitOnce(p *Painter3D)
	Init(p *Painter3D)
	After(p *Painter3D)
	NeedShader() bool
}

type Canvas3DBeforePainter

type Canvas3DBeforePainter interface {
	BeforeDraw(p context.Painter, pos fyne.Position, Frame fyne.Size)
}

type Canvas3DPainter

type Canvas3DPainter interface {
	Draw(p *Painter3D, pos fyne.Position, Frame fyne.Size)
}

type Canvas3dObj

type Canvas3dObj struct {
	Painter     *Painter3D
	Objs        []Canvas3D
	RenderFuncs []func(ctx context.Painter)
	// contains filtered or unexported fields
}

func NewCustomObj

func NewCustomObj() *Canvas3dObj

func (*Canvas3dObj) After

func (c *Canvas3dObj) After()

func (*Canvas3dObj) BeforeDraw

func (c *Canvas3dObj) BeforeDraw(pos fyne.Position, frame fyne.Size)

func (*Canvas3dObj) ChangeShader

func (c *Canvas3dObj) ChangeShader(vertStr, fragStr string)

func (*Canvas3dObj) Draw

func (c *Canvas3dObj) Draw(pos fyne.Position, frame fyne.Size)

func (*Canvas3dObj) GetShader

func (c *Canvas3dObj) GetShader() (vertStr, fragStr string)

func (*Canvas3dObj) Init

func (c *Canvas3dObj) Init()

func (*Canvas3dObj) InitOnce

func (c *Canvas3dObj) InitOnce()

func (*Canvas3dObj) SplitByNeedShader

func (c *Canvas3dObj) SplitByNeedShader() (needs []Canvas3D, notNeeds []Canvas3D)

type Canvas3dObjs

type Canvas3dObjs struct {
	// contains filtered or unexported fields
}

func NewCustomObjs

func NewCustomObjs(n int) *Canvas3dObjs

func (*Canvas3dObjs) DragEnd

func (c *Canvas3dObjs) DragEnd()

func (*Canvas3dObjs) Dragged

func (c *Canvas3dObjs) Dragged(ev *fyne.DragEvent)

func (*Canvas3dObjs) GetCanvas3dObj

func (c *Canvas3dObjs) GetCanvas3dObj(index int) *Canvas3dObj

func (*Canvas3dObjs) Hide

func (c *Canvas3dObjs) Hide()

func (*Canvas3dObjs) MinSize

func (c *Canvas3dObjs) MinSize() fyne.Size

func (*Canvas3dObjs) Move

func (c *Canvas3dObjs) Move(position fyne.Position)

func (*Canvas3dObjs) Position

func (c *Canvas3dObjs) Position() fyne.Position

func (*Canvas3dObjs) RangeCanvas3dObj

func (c *Canvas3dObjs) RangeCanvas3dObj(fn func(obj *Canvas3dObj) (stop bool))

func (*Canvas3dObjs) Refresh

func (c *Canvas3dObjs) Refresh()

func (*Canvas3dObjs) Resize

func (c *Canvas3dObjs) Resize(size fyne.Size)

func (*Canvas3dObjs) Scrolled

func (c *Canvas3dObjs) Scrolled(ev *fyne.ScrollEvent)

func (*Canvas3dObjs) Show

func (c *Canvas3dObjs) Show()

func (*Canvas3dObjs) Size

func (c *Canvas3dObjs) Size() fyne.Size

func (*Canvas3dObjs) Visible

func (c *Canvas3dObjs) Visible() bool

type Painter

type Painter interface {
	// Init tell a new painter to initialise, usually called after a context is available
	Init()
	// Capture requests that the specified canvas be drawn to an in-memory image
	Capture(fyne.Canvas) image.Image
	// Clear tells our painter to prepare a fresh paint
	Clear()
	// Free is used to indicate that a certain canvas object is no longer needed
	Free(fyne.CanvasObject)
	// Paint a single fyne.CanvasObject but not its children.
	Paint(fyne.CanvasObject, fyne.Position, fyne.Size)
	// SetFrameBufferScale tells us when we have more than 1 framebuffer pixel for each output pixel
	SetFrameBufferScale(float32)
	// SetOutputSize is used to change the resolution of our output viewport
	SetOutputSize(int, int)
	// StartClipping tells us that the following paint actions should be clipped to the specified area.
	StartClipping(fyne.Position, fyne.Size)
	// StopClipping stops clipping paint actions.
	StopClipping()
}

Painter defines the functionality of our OpenGL based renderer

func NewPainter

func NewPainter(c fyne.Canvas, ctx driver.WithContext) Painter

NewPainter creates a new GL based renderer for the provided canvas. If it is a master painter it will also initialise OpenGL

type Painter3D

type Painter3D struct {
	context.Context
	// contains filtered or unexported fields
}

func NewPainter3D

func NewPainter3D(ctx context.Context) *Painter3D

func (*Painter3D) BindTexture

func (p *Painter3D) BindTexture(texture context.Texture)

func (*Painter3D) DefineVertexArray

func (p *Painter3D) DefineVertexArray(name string, size, stride, offset int)

func (*Painter3D) DrawTriangles

func (p *Painter3D) DrawTriangles(count int)

func (*Painter3D) DrawTrianglesByElement

func (p *Painter3D) DrawTrianglesByElement(index []uint32)

func (*Painter3D) GetContext

func (p *Painter3D) GetContext() context.Context

func (*Painter3D) HasInit

func (p *Painter3D) HasInit() bool

func (*Painter3D) Uniform1f

func (p *Painter3D) Uniform1f(name string, v float32)

func (*Painter3D) Uniform1i

func (p *Painter3D) Uniform1i(name string, v0 int32)

func (*Painter3D) Uniform2f

func (p *Painter3D) Uniform2f(name string, v0, v1 float32)

func (*Painter3D) Uniform3f

func (p *Painter3D) Uniform3f(name string, v0, v1, v2 float32)

func (*Painter3D) Uniform4f

func (p *Painter3D) Uniform4f(name string, v0, v1, v2, v3 float32)

func (*Painter3D) UniformMatrix4fv

func (p *Painter3D) UniformMatrix4fv(name string, mat4 mgl32.Mat4)

func (*Painter3D) UniformVec3

func (p *Painter3D) UniformVec3(name string, vec3 mgl32.Vec3)

Jump to

Keyboard shortcuts

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