glplus

package module
v0.0.3 Latest Latest
Warning

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

Go to latest
Published: Jun 26, 2021 License: Apache-2.0 Imports: 27 Imported by: 3

README

glplus

gl utilities for golang

Documentation

Index

Constants

View Source
const (

	// left to right
	LAY_ROW = 0x002
	// top to bottom
	LAY_COLUMN = 0x003

	// free layout
	LAY_LAYOUT = 0x000
	// flex model
	LAY_FLEX = 0x002

	// single-line
	LAY_NOWRAP = 0x000
	// multi-line, wrap left to right
	LAY_WRAP = 0x004

	// justify-content (start, end, center, space-between)
	// at start of row/column
	LAY_START = 0x008
	// at center of row/column
	LAY_MIDDLE = 0x000
	// at end of row/column
	LAY_END = 0x010
	// insert spacing to stretch across whole row/column
	LAY_JUSTIFY = 0x018
)

Container flags to pass to lay_set_container()

View Source
const (

	// anchor to left item or left side of parent
	LAY_LEFT = 0x020
	// anchor to top item or top side of parent
	LAY_TOP = 0x040
	// anchor to right item or right side of parent
	LAY_RIGHT = 0x080
	// anchor to bottom item or bottom side of parent
	LAY_BOTTOM = 0x100
	// anchor to both left and right item or parent borders
	LAY_HFILL = 0x0a0
	// anchor to both top and bottom item or parent borders
	LAY_VFILL = 0x140
	// center horizontally, with left margin as offset
	LAY_HCENTER = 0x000
	// center vertically, with top margin as offset
	LAY_VCENTER = 0x000
	// center in both directions, with left/top margin as offset
	LAY_CENTER = 0x000
	// anchor to all four directions
	LAY_FILL = 0x1e0
	// When in a wrapping container, put this element on a new line. Wrapping
	// layout code auto-inserts LAY_BREAK flags as needed. See GitHub issues for
	// TODO related to this.
	//
	// Drawing routines can read this via item pointers as needed after
	// performing layout calculations.
	LAY_BREAK = 0x200
)

child layout flags to pass to lay_set_behave()

View Source
const (
	// these bits, starting at bit 16, can be safely assigned by the
	// application, e.g. as item types, other event types, drop targets, etc.
	// this is not yet exposed via API functions, you'll need to get/set these
	// by directly accessing item pointers.
	//
	// (In reality we have more free bits than this, TODO)
	//
	// TODO fix int/unsigned size mismatch (clang issues warning for this),
	// should be all bits as 1 instead of INT_MAX
	LAY_USERMASK = 0x7fff0000

	// a special mask passed to lay_find_item() (currently does not exist, was
	// not ported from oui)
	LAY_ANY = 0x7fffffff
)
View Source
const (

	// bit 0-2
	LAY_ITEM_BOX_MODEL_MASK = 0x000007
	// bit 0-4
	LAY_ITEM_BOX_MASK = 0x00001F
	// bit 5-9
	LAY_ITEM_LAYOUT_MASK = 0x0003E0
	// item has been inserted (bit 10)
	LAY_ITEM_INSERTED = 0x400
	// horizontal size has been explicitly set (bit 11)
	LAY_ITEM_HFIXED = 0x800
	// vertical size has been explicitly set (bit 12)
	LAY_ITEM_VFIXED = 0x1000
	// bit 11-12
	LAY_ITEM_FIXED_MASK = LAY_ITEM_HFIXED | LAY_ITEM_VFIXED

	// which flag bits will be compared
	LAY_ITEM_COMPARE_MASK = LAY_ITEM_BOX_MODEL_MASK | (LAY_ITEM_LAYOUT_MASK & ^LAY_BREAK) | LAY_USERMASK
)

Variables

This section is empty.

Functions

func FreeSerif

func FreeSerif() (*os.File, error)

FreeSerif ...

func GetShaderInfoLog

func GetShaderInfoLog(shader *Shader) string

GetShaderInfoLog ...

func LAY_ASSERT

func LAY_ASSERT(cond bool)

func ShaderSource

func ShaderSource(shader *Shader, src string)

ShaderSource ...

Types

type BoundBuilder

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

BoundBuilder ...

type Bounds

type Bounds struct {
	X, Y, Z r1.Interval
}

Bounds ...

func ComputeBounds

func ComputeBounds(vertices []mgl32.Vec3) Bounds

ComputeBounds ...

func (Bounds) Center

func (b Bounds) Center() mgl32.Vec3

Center ...

func (Bounds) Length

func (b Bounds) Length() float32

Length ...

func (Bounds) Union

func (b Bounds) Union(o Bounds) Bounds

Union ...

type Buffer

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

Buffer ...

type Button

type Button struct {
	Size image.Point
}

Button ...

func NewButton

func NewButton(size image.Point) (btn *Button, err error)

NewButton ...

func (*Button) Delete

func (b *Button) Delete()

Delete ...

func (*Button) Draw

func (b *Button) Draw(color [4]float32, bg [4]float32, animTime float32, mat mgl32.Mat3) (err error)

Draw ...

type ButtonProgram

type ButtonProgram struct {
	ReleasingReferenceCount
	// contains filtered or unexported fields
}

ButtonProgram ...

func (*ButtonProgram) Delete

func (b *ButtonProgram) Delete()

Delete ...

type Char

type Char struct {
	Index int
	X     int
	Y     int
}

Char ...

type Context

type Context struct {
	ARRAY_BUFFER                                 int
	ARRAY_BUFFER_BINDING                         int
	ATTACHED_SHADERS                             int
	BACK                                         int
	BLEND                                        int
	BLEND_COLOR                                  int
	BLEND_DST_ALPHA                              int
	BLEND_DST_RGB                                int
	BLEND_EQUATION                               int
	BLEND_EQUATION_ALPHA                         int
	BLEND_EQUATION_RGB                           int
	BLEND_SRC_ALPHA                              int
	BLEND_SRC_RGB                                int
	BLUE_BITS                                    int
	BOOL                                         int
	BOOL_VEC2                                    int
	BOOL_VEC3                                    int
	BOOL_VEC4                                    int
	BROWSER_DEFAULT_WEBGL                        int
	BUFFER_SIZE                                  int
	BUFFER_USAGE                                 int
	BYTE                                         int
	CCW                                          int
	CLAMP_TO_EDGE                                int
	CLAMP_TO_BORDER                              int
	COLOR_ATTACHMENT0                            int
	COLOR_BUFFER_BIT                             int
	COLOR_CLEAR_VALUE                            int
	COLOR_WRITEMASK                              int
	COMPILE_STATUS                               uint32
	COMPRESSED_TEXTURE_FORMATS                   int
	CONSTANT_ALPHA                               int
	CONSTANT_COLOR                               int
	CONTEXT_LOST_WEBGL                           int
	CULL_FACE                                    int
	CULL_FACE_MODE                               int
	CURRENT_PROGRAM                              int
	CURRENT_VERTEX_ATTRIB                        int
	CW                                           int
	DECR                                         int
	DECR_WRAP                                    int
	DELETE_STATUS                                int
	DEPTH_ATTACHMENT                             int
	DEPTH_BITS                                   int
	DEPTH_BUFFER_BIT                             int
	DEPTH_CLEAR_VALUE                            int
	DEPTH_COMPONENT                              int
	DEPTH_COMPONENT16                            int
	DEPTH_FUNC                                   int
	DEPTH_RANGE                                  int
	DEPTH_STENCIL                                int
	DEPTH_STENCIL_ATTACHMENT                     int
	DEPTH_TEST                                   int
	DEPTH_WRITEMASK                              int
	DITHER                                       int
	DONT_CARE                                    int
	DST_ALPHA                                    int
	DST_COLOR                                    int
	DYNAMIC_DRAW                                 int
	ELEMENT_ARRAY_BUFFER                         int
	ELEMENT_ARRAY_BUFFER_BINDING                 int
	EQUAL                                        int
	FASTEST                                      int
	FLOAT                                        int
	FLOAT_MAT2                                   int
	FLOAT_MAT3                                   int
	FLOAT_MAT4                                   int
	FLOAT_VEC2                                   int
	FLOAT_VEC3                                   int
	FLOAT_VEC4                                   int
	FRAGMENT_SHADER                              int
	FRAMEBUFFER                                  int
	FRAMEBUFFER_ATTACHMENT_OBJECT_NAME           int
	FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE           int
	FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE int
	FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL         int
	FRAMEBUFFER_BINDING                          int
	FRAMEBUFFER_COMPLETE                         int
	FRAMEBUFFER_INCOMPLETE_ATTACHMENT            int
	FRAMEBUFFER_INCOMPLETE_DIMENSIONS            int
	FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT    int
	FRAMEBUFFER_INCOMPLETE_DRAW_BUFFER           int
	FRAMEBUFFER_INCOMPLETE_READ_BUFFER           int
	FRAMEBUFFER_UNSUPPORTED                      int
	FRONT                                        int
	FRONT_AND_BACK                               int
	FRONT_FACE                                   int
	FUNC_ADD                                     int
	FUNC_REVERSE_SUBTRACT                        int
	FUNC_SUBTRACT                                int
	GENERATE_MIPMAP_HINT                         int
	GEQUAL                                       int
	GREATER                                      int
	GREEN_BITS                                   int
	HIGH_FLOAT                                   int
	HIGH_INT                                     int
	INCR                                         int
	INCR_WRAP                                    int
	INFO_LOG_LENGTH                              uint32
	INT                                          int
	INT_VEC2                                     int
	INT_VEC3                                     int
	INT_VEC4                                     int
	INVALID_ENUM                                 int
	INVALID_FRAMEBUFFER_OPERATION                int
	INVALID_OPERATION                            int
	INVALID_VALUE                                int
	INVERT                                       int
	KEEP                                         int
	LEQUAL                                       int
	LESS                                         int
	LINEAR                                       int
	LINEAR_MIPMAP_LINEAR                         int
	LINEAR_MIPMAP_NEAREST                        int
	LINES                                        int
	LINE_LOOP                                    int
	LINE_STRIP                                   int
	LINE_WIDTH                                   int
	LINK_STATUS                                  int
	LOW_FLOAT                                    int
	LOW_INT                                      int
	LUMINANCE                                    int
	LUMINANCE_ALPHA                              int
	MAX_COMBINED_TEXTURE_IMAGE_UNITS             int
	MAX_CUBE_MAP_TEXTURE_SIZE                    int
	MAX_FRAGMENT_UNIFORM_VECTORS                 int
	MAX_RENDERBUFFER_SIZE                        int
	MAX_TEXTURE_IMAGE_UNITS                      int
	MAX_TEXTURE_SIZE                             int
	MAX_VARYING_VECTORS                          int
	MAX_VERTEX_ATTRIBS                           int
	MAX_VERTEX_TEXTURE_IMAGE_UNITS               int
	MAX_VERTEX_UNIFORM_VECTORS                   int
	MAX_VIEWPORT_DIMS                            int
	MEDIUM_FLOAT                                 int
	MEDIUM_INT                                   int
	MIRRORED_REPEAT                              int
	MULTISAMPLE                                  int
	NEAREST                                      int
	NEAREST_MIPMAP_LINEAR                        int
	NEAREST_MIPMAP_NEAREST                       int
	NEVER                                        int
	NICEST                                       int
	NONE                                         int
	NOTEQUAL                                     int
	NO_ERROR                                     int
	NUM_COMPRESSED_TEXTURE_FORMATS               int
	ONE                                          int
	ONE_MINUS_CONSTANT_ALPHA                     int
	ONE_MINUS_CONSTANT_COLOR                     int
	ONE_MINUS_DST_ALPHA                          int
	ONE_MINUS_DST_COLOR                          int
	ONE_MINUS_SRC_ALPHA                          int
	ONE_MINUS_SRC_COLOR                          int
	OUT_OF_MEMORY                                int
	PACK_ALIGNMENT                               int
	POINTS                                       int
	POLYGON_OFFSET_FACTOR                        int
	POLYGON_OFFSET_FILL                          int
	POLYGON_OFFSET_UNITS                         int
	RED_BITS                                     int
	RENDERBUFFER                                 int
	RENDERBUFFER_ALPHA_SIZE                      int
	RENDERBUFFER_BINDING                         int
	RENDERBUFFER_BLUE_SIZE                       int
	RENDERBUFFER_DEPTH_SIZE                      int
	RENDERBUFFER_GREEN_SIZE                      int
	RENDERBUFFER_HEIGHT                          int
	RENDERBUFFER_INTERNAL_FORMAT                 int
	RENDERBUFFER_RED_SIZE                        int
	RENDERBUFFER_STENCIL_SIZE                    int
	RENDERBUFFER_WIDTH                           int
	RENDERER                                     int
	REPEAT                                       int
	REPLACE                                      int
	RGB                                          int
	RGB5_A1                                      int
	RGB565                                       int
	RGBA                                         int
	RGBA32F                                      int
	RGBA4                                        int
	SAMPLER_2D                                   int
	SAMPLER_CUBE                                 int
	SAMPLES                                      int
	SAMPLE_ALPHA_TO_COVERAGE                     int
	SAMPLE_BUFFERS                               int
	SAMPLE_COVERAGE                              int
	SAMPLE_COVERAGE_INVERT                       int
	SAMPLE_COVERAGE_VALUE                        int
	SCISSOR_BOX                                  int
	SCISSOR_TEST                                 int
	SHADER_COMPILER                              int
	SHADER_SOURCE_LENGTH                         int
	SHADER_TYPE                                  int
	SHADING_LANGUAGE_VERSION                     int
	SHORT                                        int
	SRC_ALPHA                                    int
	SRC_ALPHA_SATURATE                           int
	SRC_COLOR                                    int
	STATIC_DRAW                                  int
	STENCIL_ATTACHMENT                           int
	STENCIL_BACK_FAIL                            int
	STENCIL_BACK_FUNC                            int
	STENCIL_BACK_PASS_DEPTH_FAIL                 int
	STENCIL_BACK_PASS_DEPTH_PASS                 int
	STENCIL_BACK_REF                             int
	STENCIL_BACK_VALUE_MASK                      int
	STENCIL_BACK_WRITEMASK                       int
	STENCIL_BITS                                 int
	STENCIL_BUFFER_BIT                           int
	STENCIL_CLEAR_VALUE                          int
	STENCIL_FAIL                                 int
	STENCIL_FUNC                                 int
	STENCIL_INDEX                                int
	STENCIL_INDEX8                               int
	STENCIL_PASS_DEPTH_FAIL                      int
	STENCIL_PASS_DEPTH_PASS                      int
	STENCIL_REF                                  int
	STENCIL_TEST                                 int
	STENCIL_VALUE_MASK                           int
	STENCIL_WRITEMASK                            int
	STREAM_DRAW                                  int
	SUBPIXEL_BITS                                int
	TEXTURE                                      int
	TEXTURE0                                     int
	TEXTURE1                                     int
	TEXTURE2                                     int
	TEXTURE3                                     int
	TEXTURE4                                     int
	TEXTURE5                                     int
	TEXTURE6                                     int
	TEXTURE7                                     int
	TEXTURE8                                     int
	TEXTURE9                                     int
	TEXTURE10                                    int
	TEXTURE11                                    int
	TEXTURE12                                    int
	TEXTURE13                                    int
	TEXTURE14                                    int
	TEXTURE15                                    int
	TEXTURE16                                    int
	TEXTURE17                                    int
	TEXTURE18                                    int
	TEXTURE19                                    int
	TEXTURE20                                    int
	TEXTURE21                                    int
	TEXTURE22                                    int
	TEXTURE23                                    int
	TEXTURE24                                    int
	TEXTURE25                                    int
	TEXTURE26                                    int
	TEXTURE27                                    int
	TEXTURE28                                    int
	TEXTURE29                                    int
	TEXTURE30                                    int
	TEXTURE31                                    int
	TEXTURE_2D                                   int
	TEXTURE_BINDING_2D                           int
	TEXTURE_BINDING_CUBE_MAP                     int
	TEXTURE_CUBE_MAP                             int
	TEXTURE_CUBE_MAP_NEGATIVE_X                  int
	TEXTURE_CUBE_MAP_NEGATIVE_Y                  int
	TEXTURE_CUBE_MAP_NEGATIVE_Z                  int
	TEXTURE_CUBE_MAP_POSITIVE_X                  int
	TEXTURE_CUBE_MAP_POSITIVE_Y                  int
	TEXTURE_CUBE_MAP_POSITIVE_Z                  int
	TEXTURE_MAG_FILTER                           int
	TEXTURE_MIN_FILTER                           int
	TEXTURE_WRAP_S                               int
	TEXTURE_WRAP_T                               int
	TRIANGLES                                    int
	TRIANGLE_FAN                                 int
	TRIANGLE_STRIP                               int
	UNPACK_ALIGNMENT                             int
	UNPACK_COLORSPACE_CONVERSION_WEBGL           int
	UNPACK_FLIP_Y_WEBGL                          int
	UNPACK_PREMULTIPLY_ALPHA_WEBGL               int
	UNSIGNED_BYTE                                int
	UNSIGNED_INT                                 int
	UNSIGNED_SHORT                               int
	UNSIGNED_SHORT_4_4_4_4                       int
	UNSIGNED_SHORT_5_5_5_1                       int
	UNSIGNED_SHORT_5_6_5                         int
	VALIDATE_STATUS                              int
	VENDOR                                       int
	VERSION                                      int
	VERTEX_ATTRIB_ARRAY_BUFFER_BINDING           int
	VERTEX_ATTRIB_ARRAY_ENABLED                  int
	VERTEX_ATTRIB_ARRAY_NORMALIZED               int
	VERTEX_ATTRIB_ARRAY_POINTER                  int
	VERTEX_ATTRIB_ARRAY_SIZE                     int
	VERTEX_ATTRIB_ARRAY_STRIDE                   int
	VERTEX_ATTRIB_ARRAY_TYPE                     int
	VERTEX_SHADER                                int
	VIEWPORT                                     int
	ZERO                                         int
	TRUE                                         int
	R8                                           int
	RED                                          int
	R32F                                         int
}
var Gl *Context

Gl may become engo.Gl (Gl = glplus.NewContext())

func NewContext

func NewContext() *Context

NewContext ...

func (*Context) ActiveTexture

func (c *Context) ActiveTexture(texture int)

func (*Context) AttachShader

func (c *Context) AttachShader(program *Program, shader *Shader)

func (*Context) BindAttribLocation

func (c *Context) BindAttribLocation(program *Program, index int, name string)

func (*Context) BindBuffer

func (c *Context) BindBuffer(target int, buffer *Buffer)

func (*Context) BindFrameBuffer

func (c *Context) BindFrameBuffer(target int, vao *FrameBuffer)

func (*Context) BindRenderBuffer

func (c *Context) BindRenderBuffer(target int, vao *RenderBuffer)

func (*Context) BindTexture

func (c *Context) BindTexture(target int, texture *Texture)

func (*Context) BindVertexArray

func (c *Context) BindVertexArray(vao *VertexArray)

func (*Context) BlendEquation

func (c *Context) BlendEquation(mode int)

func (*Context) BlendFunc

func (c *Context) BlendFunc(src, dst int)

func (*Context) BufferData

func (c *Context) BufferData(target int, data interface{}, usage int)

func (*Context) CheckFramebufferStatus

func (c *Context) CheckFramebufferStatus(target int) int

func (*Context) Clear

func (c *Context) Clear(flags int)

func (*Context) ClearColor

func (c *Context) ClearColor(r, g, b, a float32)

func (*Context) CompileShader

func (c *Context) CompileShader(shader *Shader)

func (*Context) CreateBuffer

func (c *Context) CreateBuffer() *Buffer

func (*Context) CreateFrameBuffer

func (c *Context) CreateFrameBuffer() *FrameBuffer

func (*Context) CreateProgram

func (c *Context) CreateProgram() *Program

func (*Context) CreateRenderBuffer

func (c *Context) CreateRenderBuffer() *RenderBuffer

func (*Context) CreateShader

func (c *Context) CreateShader(typ int) *Shader

func (*Context) CreateTexture

func (c *Context) CreateTexture() *Texture

func (*Context) CreateVertexArray

func (c *Context) CreateVertexArray() *VertexArray

func (*Context) DeleteBuffer

func (c *Context) DeleteBuffer(buffer *Buffer)

func (*Context) DeleteFrameBuffer

func (c *Context) DeleteFrameBuffer(vao *FrameBuffer)

func (*Context) DeleteProgram

func (c *Context) DeleteProgram(program *Program)

func (*Context) DeleteRenderBuffer

func (c *Context) DeleteRenderBuffer(vao *RenderBuffer)

func (*Context) DeleteShader

func (c *Context) DeleteShader(shader *Shader)

func (*Context) DeleteTexture

func (c *Context) DeleteTexture(texture *Texture)

func (*Context) DeleteVertexArray

func (c *Context) DeleteVertexArray(vao *VertexArray)

func (*Context) Disable

func (c *Context) Disable(flag int)

func (*Context) DisableVertexAttribArray

func (c *Context) DisableVertexAttribArray(index int)

func (*Context) DrawArrays

func (c *Context) DrawArrays(mode, first, count int)

func (*Context) DrawBuffer

func (c *Context) DrawBuffer(buf int)

func (*Context) DrawElements

func (c *Context) DrawElements(mode, count, typ, offset int)

func (*Context) Enable

func (c *Context) Enable(flag int)

func (*Context) EnableVertexAttribArray

func (c *Context) EnableVertexAttribArray(index int)

func (*Context) Flush

func (c *Context) Flush()

func (*Context) FramebufferRenderbuffer

func (c *Context) FramebufferRenderbuffer(target, attachment, renderbuffertarget int, renderbuffer *RenderBuffer)

func (*Context) FramebufferTexture2D

func (c *Context) FramebufferTexture2D(target, attachment, textarget int, texture *Texture, level int)

func (*Context) GetAttribLocation

func (c *Context) GetAttribLocation(program *Program, name string) int

func (*Context) GetError

func (c *Context) GetError() int

func (*Context) GetProgramInfoLog

func (c *Context) GetProgramInfoLog(program *Program) string

func (*Context) GetProgramParameterb

func (c *Context) GetProgramParameterb(program *Program, pname int) bool

func (*Context) GetProgramParameteri

func (c *Context) GetProgramParameteri(program *Program, pname int) int

func (*Context) GetShaderInfoLog

func (c *Context) GetShaderInfoLog(shader *Shader) string

func (*Context) GetShaderiv

func (c *Context) GetShaderiv(shader *Shader, pname uint32) bool

func (*Context) GetUniformLocation

func (c *Context) GetUniformLocation(program *Program, name string) *UniformLocation

func (*Context) LinkProgram

func (c *Context) LinkProgram(program *Program)

func (*Context) Ptr

func (c *Context) Ptr(data interface{}) unsafe.Pointer

func (*Context) ReadBuffer

func (c *Context) ReadBuffer(src int)

func (*Context) ReadPixels

func (c *Context) ReadPixels(x, y, width, height, format, typ int, pixels unsafe.Pointer)

func (*Context) RenderbufferStorage

func (c *Context) RenderbufferStorage(target, internalFormat, width, height int)

func (*Context) ShaderSource

func (c *Context) ShaderSource(shader *Shader, source string)

func (*Context) TexImage2D

func (c *Context) TexImage2D(target, level, internalFormat, width, height, format, kind int, data interface{})

func (*Context) TexParameteri

func (c *Context) TexParameteri(target int, pname int, param int)

func (*Context) Uniform1f

func (c *Context) Uniform1f(location *UniformLocation, x float32)

func (*Context) Uniform1i

func (c *Context) Uniform1i(location *UniformLocation, x int)

Assigns a integer value to a uniform variable for the current program object.

func (*Context) Uniform2f

func (c *Context) Uniform2f(location *UniformLocation, x, y float32)

func (*Context) Uniform3f

func (c *Context) Uniform3f(location *UniformLocation, x, y, z float32)

func (*Context) Uniform4f

func (c *Context) Uniform4f(location *UniformLocation, x, y, z, w float32)

func (*Context) UniformMatrix3fv

func (c *Context) UniformMatrix3fv(location *UniformLocation, transpose bool, value []float32)

func (*Context) UniformMatrix4fv

func (c *Context) UniformMatrix4fv(location *UniformLocation, transpose bool, value []float32)

func (*Context) UseProgram

func (c *Context) UseProgram(program *Program)

func (*Context) ValidateProgram

func (c *Context) ValidateProgram(program *Program)

func (*Context) Version

func (c *Context) Version() string

func (*Context) VertexAttribPointer

func (c *Context) VertexAttribPointer(index, size, typ int, normal bool, stride int, offset int)

func (*Context) Viewport

func (c *Context) Viewport(x, y, width, height int)

type Font

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

Font ...

func NewFont

func NewFont(reader io.Reader) (font *Font, err error)

NewFont ...

func (*Font) BindTexture

func (f *Font) BindTexture(unit int)

BindTexture ...

func (*Font) DeleteFont

func (f *Font) DeleteFont()

DeleteFont ...

func (*Font) GetUVForChar

func (f *Font) GetUVForChar(c rune) mgl32.Vec4

GetUVForChar ...

func (*Font) NewString

func (f *Font) NewString(s string) *String

NewString ...

func (*Font) UnbindTexture

func (f *Font) UnbindTexture(unit int)

UnbindTexture ...

type FrameBuffer

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

FrameBuffer ...

type GPProgram

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

GPProgram ...

func LoadShaderProgram

func LoadShaderProgram(vertShader string, fragShader string, attribs []string) (*GPProgram, error)

LoadShaderProgram ... loads shader objects and then attaches them to a program

func (*GPProgram) DeleteProgram

func (p *GPProgram) DeleteProgram()

DeleteProgram ...

func (*GPProgram) GetAttribLocation

func (p *GPProgram) GetAttribLocation(s string) int

GetAttribLocation ...

func (*GPProgram) GetAttribs

func (p *GPProgram) GetAttribs() (attribs map[string]int)

GetAttribs ...

func (*GPProgram) GetProgramInfoLog

func (p *GPProgram) GetProgramInfoLog() string

GetProgramInfoLog ...

func (*GPProgram) GetUniformLocation

func (p *GPProgram) GetUniformLocation(s string) *UniformLocation

GetUniformLocation ...

func (*GPProgram) Material

func (p *GPProgram) Material(m *Material)

Material ...

func (*GPProgram) ProgramUniform1f

func (p *GPProgram) ProgramUniform1f(uniform string, value float32)

ProgramUniform1f ...

func (*GPProgram) ProgramUniform1i

func (p *GPProgram) ProgramUniform1i(uniform string, value int)

ProgramUniform1i ...

func (*GPProgram) ProgramUniform2f

func (p *GPProgram) ProgramUniform2f(uniform string, v0 float32, v1 float32)

ProgramUniform2f ...

func (*GPProgram) ProgramUniform3fv

func (p *GPProgram) ProgramUniform3fv(uniform string, value [3]float32)

ProgramUniform3fv ...

func (*GPProgram) ProgramUniform4fv

func (p *GPProgram) ProgramUniform4fv(uniform string, value [4]float32)

ProgramUniform4fv ...

func (*GPProgram) ProgramUniformMatrix3fv

func (p *GPProgram) ProgramUniformMatrix3fv(uniform string, matrix [9]float32)

ProgramUniformMatrix3fv ...

func (*GPProgram) ProgramUniformMatrix4fv

func (p *GPProgram) ProgramUniformMatrix4fv(uniform string, matrix [16]float32)

ProgramUniformMatrix4fv ...

func (*GPProgram) UnuseProgram

func (p *GPProgram) UnuseProgram()

UnuseProgram ...

func (*GPProgram) UseProgram

func (p *GPProgram) UseProgram()

UseProgram ...

func (*GPProgram) ValidateProgram

func (p *GPProgram) ValidateProgram() error

ValidateProgram ...

type GPTexture

type GPTexture struct {
	Size image.Point
	// contains filtered or unexported fields
}

GPTexture ...

func GenTexture

func GenTexture(size image.Point) (texture *GPTexture)

GenTexture ...

func LoadTexture

func LoadTexture(file string, linear, repeat bool) (texture *GPTexture, img image.Image, err error)

LoadTexture ...

func NewRGBATexture

func NewRGBATexture(rgba *image.RGBA, linear, repeat bool) (texture *GPTexture, err error)

NewRGBATexture ...

func (*GPTexture) BindTexture

func (t *GPTexture) BindTexture(unit int)

BindTexture ...

func (*GPTexture) DeleteTexture

func (t *GPTexture) DeleteTexture()

DeleteTexture ...

func (*GPTexture) Handle

func (t *GPTexture) Handle() *Texture

Handle ...

func (*GPTexture) UnbindTexture

func (t *GPTexture) UnbindTexture(unit int)

UnbindTexture ...

type Lay_context

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

func (*Lay_context) Lay_append

func (ctx *Lay_context) Lay_append(earlier Lay_id, later Lay_id)

lay_append inserts an item as a sibling after another item. This allows inserting an item into the middle of an existing list of items within a parent. It's also more efficient than repeatedly using lay_insert(ctx, parent, new_child) in a loop to create a list of items in a parent, because it does not need to traverse the parent's children each time. So if you're creating a long list of children inside of a parent, you might prefer to use this after using lay_insert to insert the first child.

func (*Lay_context) Lay_clear_item_break

func (ctx *Lay_context) Lay_clear_item_break(item Lay_id)

func (*Lay_context) Lay_first_child

func (ctx *Lay_context) Lay_first_child(id Lay_id) Lay_id

Get the id of first child of an item, if any. Returns LAY_INVALID_ID if there is no child.

func (*Lay_context) Lay_get_item

func (ctx *Lay_context) Lay_get_item(id Lay_id) *Lay_item_t

Get the pointer to an item in the buffer by its id. Don't keep this around -- it will become invalid as soon as any reallocation occurs. Just store the id instead (it's smaller, anyway, and the lookup cost will be nothing.)

func (*Lay_context) Lay_get_margins

func (ctx *Lay_context) Lay_get_margins(item Lay_id) Lay_vec4

Get the margins that were set by lay_set_margins. The _ltrb version writes the output values to the specified addresses instead of returning the values in a Lay_vec4. l: left, t: top, r: right, b: bottom

func (*Lay_context) Lay_get_margins_ltrb

func (ctx *Lay_context) Lay_get_margins_ltrb(item Lay_id) Lay_vec4

func (*Lay_context) Lay_get_rect

func (ctx *Lay_context) Lay_get_rect(id Lay_id) Lay_vec4

Returns the calculated rectangle of an item. This is only valid after calling lay_run_context and before any other reallocation occurs. Otherwise, the result will be undefined. The vector components are: 0: x starting position, 1: y starting position 2: width, 3: height

func (*Lay_context) Lay_get_rect_xywh

func (ctx *Lay_context) Lay_get_rect_xywh(id Lay_id) Lay_vec4

The same as lay_get_rect, but writes the x,y positions and width,height values to the specified addresses instead of returning them in a Lay_vec4.

func (*Lay_context) Lay_get_size

func (ctx *Lay_context) Lay_get_size(item Lay_id) Lay_vec2

Gets the size that was set with lay_set_size or lay_set_size_xy. The _xy version writes the output values to the specified addresses instead of returning the values in a Lay_vec2.

func (*Lay_context) Lay_get_size_xy

func (ctx *Lay_context) Lay_get_size_xy(item Lay_id) Lay_vec2

func (*Lay_context) Lay_insert

func (ctx *Lay_context) Lay_insert(parent Lay_id, child Lay_id)

Inserts an item into another item, forming a parent - child relationship. An item can contain any number of child items. Items inserted into a parent are put at the end of the ordering, after any existing siblings.

func (*Lay_context) Lay_item

func (ctx *Lay_context) Lay_item() Lay_id

Create a new item, which can just be thought of as a rectangle. Returns the id (handle) used to identify the item.

func (*Lay_context) Lay_items_capacity

func (ctx *Lay_context) Lay_items_capacity() Lay_id

Returns the number of items the context can hold without performing a reallocation.

func (*Lay_context) Lay_items_count

func (ctx *Lay_context) Lay_items_count() Lay_id

Returns the number of items that have been created in a context.

func (*Lay_context) Lay_last_child

func (ctx *Lay_context) Lay_last_child(parent Lay_id) Lay_id

func (*Lay_context) Lay_next_sibling

func (ctx *Lay_context) Lay_next_sibling(id Lay_id) Lay_id

Get the id of the next sibling of an item, if any. Returns LAY_INVALID_ID if there is no next sibling.

func (*Lay_context) Lay_push

func (ctx *Lay_context) Lay_push(parent Lay_id, new_child Lay_id)

Like lay_insert, but puts the new item as the first child in a parent instead of as the last.

func (*Lay_context) Lay_run_context

func (ctx *Lay_context) Lay_run_context()

Performs the layout calculations, starting at the root item (id 0). After calling this, you can use lay_get_rect() to query for an item's calculated rectangle. If you use procedures such as lay_append() or lay_insert() after calling this, your calculated data may become invalid if a reallocation occurs.

You should prefer to recreate your items starting from the root instead of doing fine-grained updates to the existing context.

However, it's safe to use lay_set_size on an item, and then re-run lay_run_context. This might be useful if you are doing a resizing animation on items in a layout without any contents changing.

func (*Lay_context) Lay_run_item

func (ctx *Lay_context) Lay_run_item(item Lay_id)

Like lay_run_context(), this procedure will run layout calculations -- however, it lets you specify which item you want to start from. lay_run_context() always starts with item 0, the first item, as the root. Running the layout calculations from a specific item is useful if you want need to iteratively re-run parts of your layout hierarchy, or if you are only interested in updating certain subsets of it. Be careful when using this -- it's easy to generated bad output if the parent items haven't yet had their output rectangles calculated, or if they've been invalidated (e.g. due to re-allocation).

func (*Lay_context) Lay_set_behave

func (ctx *Lay_context) Lay_set_behave(item Lay_id, flags int32)

Set the flags on an item which determines how it behaves as a child inside of a parent item. For example, setting LAY_VFILL will make an item try to fill up all available vertical space inside of its parent.

func (*Lay_context) Lay_set_contain

func (ctx *Lay_context) Lay_set_contain(item Lay_id, flags int32)

Set the flags on an item which determines how it behaves as a parent. For example, setting LAY_COLUMN will make an item behave as if it were a column -- it will lay out its children vertically.

func (*Lay_context) Lay_set_margins

func (ctx *Lay_context) Lay_set_margins(item Lay_id, ltrb Lay_vec4)

Set the margins on an item. The components of the vector are: 0: left, 1: top, 2: right, 3: bottom.

func (*Lay_context) Lay_set_margins_ltrb

func (ctx *Lay_context) Lay_set_margins_ltrb(item Lay_id, l, t, r, b Lay_scalar)

Same as lay_set_margins, but the components are passed as separate arguments (left, top, right, bottom).

func (*Lay_context) Lay_set_size

func (ctx *Lay_context) Lay_set_size(item Lay_id, size Lay_vec2)

Sets the size of an item. The _xy version passes the width and height as separate arguments, but functions the same.

func (*Lay_context) Lay_set_size_xy

func (ctx *Lay_context) Lay_set_size_xy(item Lay_id, width, height Lay_scalar)

type Lay_id

type Lay_id uint32
const LAY_INVALID_ID Lay_id = math.MaxUint32

type Lay_item_t

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

type Lay_scalar

type Lay_scalar int16

type Lay_vec2

type Lay_vec2 [2]Lay_scalar

type Lay_vec4

type Lay_vec4 [4]Lay_scalar

func Lay_vec4_xyzw

func Lay_vec4_xyzw(x, y, z, w Lay_scalar) Lay_vec4

type Material

type Material struct {
	Diffuse   []float32 `yaml:",flow"`
	Shininess float32   `yaml:"shininess"` // rename
	Specular  []float32 `yaml:",flow"`
	Ambient   []float32 `yaml:",flow"`
}

Material ...

func MakeDefaultMaterial

func MakeDefaultMaterial() *Material

MakeDefaultMaterial ...

type Obj

type Obj struct {
	Bounds       Bounds
	ObjVertices  []float32
	Name         string
	TexImg       *image.RGBA
	SubObjects   []SubObject
	SubMaterials []SubMaterial
	Marker       Bounds
}

Obj ...

func LoadObj

func LoadObj(input io.Reader, opts *ObjOptions) (objs []*Obj, err error)

LoadObj ... 'colors' relate to usemtl

func (*Obj) NormalizedMat

func (m *Obj) NormalizedMat() (mres mgl32.Mat4)

NormalizedMat ...

type ObjOptions

type ObjOptions struct {
	TexImg *image.RGBA
	Colors map[string]float32
	Single bool
}

ObjOptions ...

type ObjRender

type ObjRender struct {
	Obj *Obj
	// contains filtered or unexported fields
}

ObjRender ...

func NewObjVBO

func NewObjVBO(obj *Obj, hasColorTable bool) (m *ObjRender)

NewObjVBO ...

func (*ObjRender) Delete

func (m *ObjRender) Delete()

Delete ...

func (*ObjRender) Draw

func (m *ObjRender) Draw(material *Material, camera, projection, model mgl32.Mat4, light mgl32.Vec3, uvAngle float64, tex *GPTexture)

Draw ...

func (*ObjRender) NormalizedMat

func (m *ObjRender) NormalizedMat() (mres mgl32.Mat4)

NormalizedMat ...

type ObjsRender

type ObjsRender struct {
	Objs []*ObjRender
}

ObjsRender ...

func NewObjsVBO

func NewObjsVBO(objs []*Obj, hasColorTable bool) (m *ObjsRender)

NewObjsVBO ...

func (*ObjsRender) Bounds

func (m *ObjsRender) Bounds() (b Bounds)

Bounds ...

func (*ObjsRender) Delete

func (m *ObjsRender) Delete()

Delete ...

func (*ObjsRender) Draw

func (m *ObjsRender) Draw(material *Material, camera, projection, model mgl32.Mat4, light mgl32.Vec3, uvAngle float64, tex *GPTexture)

Draw ...

func (*ObjsRender) NormalizedMat

func (m *ObjsRender) NormalizedMat() (mres mgl32.Mat4)

NormalizedMat ...

type OpenGL3

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

OpenGL3 implements a renderer based on github.com/go-gl/gl (v3.2-core).

func NewOpenGL3

func NewOpenGL3(io imgui.IO) (*OpenGL3, error)

NewOpenGL3 attempts to initialize a renderer. An OpenGL context has to be established before calling this function.

func (*OpenGL3) Dispose

func (renderer *OpenGL3) Dispose()

Dispose cleans up the resources.

func (*OpenGL3) PreRender

func (renderer *OpenGL3) PreRender(clearColor [4]float32)

PreRender clears the framebuffer.

func (*OpenGL3) Render

func (renderer *OpenGL3) Render(displaySize [2]float32, framebufferSize [2]float32, drawData imgui.DrawData)

Render translates the ImGui draw data to OpenGL3 commands.

type Program

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

Program ...

type ProgramCache

type ProgramCache struct {
	ReleasingReferenceCount
	// contains filtered or unexported fields
}

ProgramCache ...

func (*ProgramCache) Delete

func (b *ProgramCache) Delete()

Delete ...

type ReferenceCountable

type ReferenceCountable interface {
	Decr() bool
	Incr()
}

ReferenceCountable ...

type ReleasingReferenceCount

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

ReleasingReferenceCount ...

func NewReferenceCount

func NewReferenceCount() ReleasingReferenceCount

NewReferenceCount ...

func (ReleasingReferenceCount) Decr

func (rrc ReleasingReferenceCount) Decr() bool

Decr ...

func (ReleasingReferenceCount) Incr

func (rrc ReleasingReferenceCount) Incr()

Incr ...

type RenderBuffer

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

RenderBuffer ...

type RenderTarget

type RenderTarget struct {
	Tex *GPTexture
	// contains filtered or unexported fields
}

RenderTarget ...

func NewRenderTarget

func NewRenderTarget(hasDepth bool) (r *RenderTarget)

NewRenderTarget ...

func (*RenderTarget) Bind

func (r *RenderTarget) Bind(tex *GPTexture)

Bind ...

func (*RenderTarget) Delete

func (r *RenderTarget) Delete()

Delete ...

func (*RenderTarget) EnsureSize

func (r *RenderTarget) EnsureSize(size image.Point)

EnsureSize ...

func (*RenderTarget) ReadBuffer

func (r *RenderTarget) ReadBuffer(w, h int) (newImage *image.RGBA)

ReadBuffer ...

func (*RenderTarget) Unbind

func (r *RenderTarget) Unbind(tex *GPTexture)

Unbind ...

type Shader

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

Shader ...

type String

type String struct {
	Chars []Char
	Size  image.Point
	// contains filtered or unexported fields
}

String ...

func (*String) DeleteString

func (s *String) DeleteString()

DeleteString ...

func (*String) Draw

func (s *String) Draw(f *Font, color [4]float32, bg [4]float32, mat mgl32.Mat3, scale float32, offsetX float32, offsetY float32) (err error)

Draw ...

type SubMaterial

type SubMaterial struct {
	Name         string
	FaceEndIndex int
}

SubMaterial ...

type SubObject

type SubObject struct {
	Name         string
	FaceEndIndex int
}

SubObject ...

type Texture

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

Texture one day my become gl. from "engo.io/gl"

type UniformLocation

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

UniformLocation ...

type VBO

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

VBO ...

func NewVBO

func NewVBO(prog *GPProgram, options VBOOptions, verts []float32, indices []uint32) (vbo *VBO)

NewVBO ...

func NewVBOCube

func NewVBOCube(prog *GPProgram, x float32, y float32, z float32, u float32, v float32, w float32) (vbo *VBO)

NewVBOCube ...

func NewVBOCubeNormal

func NewVBOCubeNormal(prog *GPProgram, x float32, y float32, z float32, u float32, v float32, w float32) (vbo *VBO)

NewVBOCubeNormal ...

func NewVBOQuad

func NewVBOQuad(prog *GPProgram, x float32, y float32, w float32, h float32) (vbo *VBO)

NewVBOQuad ...

func (*VBO) Bind

func (v *VBO) Bind(prog *GPProgram)

Bind ...

func (*VBO) DeleteVBO

func (v *VBO) DeleteVBO()

DeleteVBO ...

func (*VBO) Draw

func (v *VBO) Draw()

Draw ...

func (*VBO) Unbind

func (v *VBO) Unbind(prog *GPProgram)

Unbind ...

type VBOOptions

type VBOOptions struct {
	Vertex  int
	Normals int
	UV      int
	IsStrip bool
	Quads   int
}

VBOOptions ...

func DefaultVBOOptions

func DefaultVBOOptions() VBOOptions

DefaultVBOOptions ...

type VertexArray

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

VertexArray ...

Jump to

Keyboard shortcuts

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