gosgl: github.com/phaikawl/gosgl Index | Files | Directories

package gosgl

import "github.com/phaikawl/gosgl"

Package gosgl is package gosgl

Index

Package Files

gosgl.go

Variables

var (
    Black = color.RGBA{0, 0, 0, 255}
)

func Init Uses

func Init()

func ShaderFromFile Uses

func ShaderFromFile(stype gl.GLenum, filename string) (shader glh.Shader)

func Vector Uses

func Vector(p Point) mathgl.Vec2d

type BezierCurve Uses

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

func NewBezierCurve Uses

func NewBezierCurve(p1, c1, c2, p2 Point) (bc *BezierCurve)

func (*BezierCurve) Draw Uses

func (c *BezierCurve) Draw(canv *Canvas)

func (*BezierCurve) Points Uses

func (c *BezierCurve) Points() (l []Point)

func (*BezierCurve) ToQuadratics Uses

func (c *BezierCurve) ToQuadratics() []QuadraticCurve

ToQuadratics approximates a cubic bezier curve with quadratics. Algorithm by Adrian Colomitchi at http://www.caffeineowl.com/graphics/2d/vectorial/cubic2quad01.html

type Canvas Uses

type Canvas struct {
    W, H int
    // contains filtered or unexported fields
}

func NewCanvas Uses

func NewCanvas(w, h int) *Canvas

type Config Uses

type Config interface {
    Apply()
}

type GLPoint Uses

type GLPoint struct {
    X, Y float32
}

type GlColorConfig Uses

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

func (*GlColorConfig) Apply Uses

func (conf *GlColorConfig) Apply()

func (*GlColorConfig) Program Uses

func (pi *GlColorConfig) Program() gl.Program

func (*GlColorConfig) Reset Uses

func (conf *GlColorConfig) Reset()

func (*GlColorConfig) SetColor Uses

func (conf *GlColorConfig) SetColor(color color.Color)

func (*GlColorConfig) SetProgram Uses

func (pi *GlColorConfig) SetProgram(p gl.Program)

type GlDrawer Uses

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

GlDrawer represents an OpenGl program and shader, like an opengl draw mode

func NewGlDrawer Uses

func NewGlDrawer(vshader, fshader string) *GlDrawer

func (*GlDrawer) Activate Uses

func (dr *GlDrawer) Activate()

func (*GlDrawer) AddConfig Uses

func (dr *GlDrawer) AddConfig(conf drawConfig)

type OpenGL Uses

type OpenGL struct {
    QuadraticDrawer *GlDrawer
    TriangleDrawer  *GlDrawer
    FillDrawer      *GlDrawer

    QuadraticDrawConfig *QuadraticDrawConfig
    GlColorConfig       *GlColorConfig
    // contains filtered or unexported fields
}

Describe opengl state object

func OpenGLInit Uses

func OpenGLInit() *OpenGL

func (*OpenGL) Activate Uses

func (g *OpenGL) Activate(dr *GlDrawer)

type Paint Uses

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

func NewPaint Uses

func NewPaint() *Paint

func (*Paint) SetFill Uses

func (p *Paint) SetFill(color color.Color) *Paint

type Path Uses

type Path struct {
    Segs *list.List
    // contains filtered or unexported fields
}

func NewPath Uses

func NewPath() *Path

func (*Path) BezierTo Uses

func (p *Path) BezierTo(p2, c1, c2 Point) *Path

func (*Path) DrawFill Uses

func (p *Path) DrawFill(canv *Canvas, paint *Paint)

func (*Path) EndPoint Uses

func (p *Path) EndPoint() Point

func (*Path) NewEnd Uses

func (p *Path) NewEnd(pt Point)

func (*Path) QuadraticTo Uses

func (p *Path) QuadraticTo(p2, c Point) *Path

func (*Path) StartAt Uses

func (p *Path) StartAt(pt Point) *Path

type PathSegment Uses

type PathSegment interface {
    Draw(*Canvas)
    Points() []Point //May be unnecessary
}

type Point Uses

type Point struct {
    X   float64
    Y   float64
}

func GetPt Uses

func GetPt(pt *list.Element) Point

func Pt Uses

func Pt(x, y float64) Point

func ToPoint Uses

func ToPoint(v mathgl.Vec2d) Point

func (Point) Add Uses

func (pt Point) Add(pt2 Point) Point

func (Point) Mathgl Uses

func (p Point) Mathgl() mathgl.Vec2d

func (Point) Mul Uses

func (pt Point) Mul(ratio float64) Point

func (Point) Sub Uses

func (pt Point) Sub(pt2 Point) Point

type QuadraticCurve Uses

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

func NewQuadraticCurve Uses

func NewQuadraticCurve(p1, c, p2 Point) *QuadraticCurve

func (*QuadraticCurve) Draw Uses

func (c *QuadraticCurve) Draw(canv *Canvas)

func (*QuadraticCurve) Points Uses

func (c *QuadraticCurve) Points() []Point

func (*QuadraticCurve) SetPoints Uses

func (c *QuadraticCurve) SetPoints(pts [3]Point)

type QuadraticDrawConfig Uses

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

func (*QuadraticDrawConfig) Apply Uses

func (conf *QuadraticDrawConfig) Apply()

func (*QuadraticDrawConfig) Program Uses

func (pi *QuadraticDrawConfig) Program() gl.Program

func (*QuadraticDrawConfig) SetExcludeTransluFrags Uses

func (conf *QuadraticDrawConfig) SetExcludeTransluFrags(v bool)

func (*QuadraticDrawConfig) SetProgram Uses

func (pi *QuadraticDrawConfig) SetProgram(p gl.Program)

type Rectangle Uses

type Rectangle struct {
    Min Point
    Max Point
}

func (Rectangle) Dx Uses

func (r Rectangle) Dx() float64

func (Rectangle) Dy Uses

func (r Rectangle) Dy() float64

Directories

PathSynopsis
testapp

Package gosgl imports 9 packages (graph) and is imported by 3 packages. Updated 2016-07-16. Refresh now. Tools for package owners.