native

package
v0.0.0-...-5c0810f Latest Latest
Warning

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

Go to latest
Published: Mar 14, 2021 License: BSD-3-Clause Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Run

func Run(app env.Application, title string, framesPerSecond float64, deferrer <-chan func())

Run initializes the environment to run the given application within.

Types

type OpenGl

type OpenGl struct {
}

OpenGl wraps the native GL API into a common interface.

func NewOpenGl

func NewOpenGl() *OpenGl

NewOpenGl initializes the Gl bindings and returns an OpenGl instance.

func (*OpenGl) ActiveTexture

func (native *OpenGl) ActiveTexture(texture uint32)

ActiveTexture implements the opengl.OpenGl interface.

func (*OpenGl) AttachShader

func (native *OpenGl) AttachShader(program uint32, shader uint32)

AttachShader implements the opengl.OpenGl interface.

func (*OpenGl) BindAttribLocation

func (native *OpenGl) BindAttribLocation(program uint32, index uint32, name string)

BindAttribLocation implements the opengl.OpenGl interface.

func (*OpenGl) BindBuffer

func (native *OpenGl) BindBuffer(target uint32, buffer uint32)

BindBuffer implements the opengl.OpenGl interface.

func (*OpenGl) BindTexture

func (native *OpenGl) BindTexture(target uint32, texture uint32)

BindTexture implements the opengl.OpenGl interface.

func (*OpenGl) BindVertexArray

func (native *OpenGl) BindVertexArray(array uint32)

BindVertexArray implements the opengl.OpenGl interface.

func (*OpenGl) BlendFunc

func (native *OpenGl) BlendFunc(sfactor uint32, dfactor uint32)

BlendFunc implements the OpenGl interface.

func (*OpenGl) BufferData

func (native *OpenGl) BufferData(target uint32, size int, data interface{}, usage uint32)

BufferData implements the opengl.OpenGl interface.

func (*OpenGl) Clear

func (native *OpenGl) Clear(mask uint32)

Clear implements the opengl.OpenGl interface.

func (*OpenGl) ClearColor

func (native *OpenGl) ClearColor(red float32, green float32, blue float32, alpha float32)

ClearColor implements the opengl.OpenGl interface.

func (*OpenGl) CompileShader

func (native *OpenGl) CompileShader(shader uint32)

CompileShader implements the opengl.OpenGl interface.

func (*OpenGl) CreateProgram

func (native *OpenGl) CreateProgram() uint32

CreateProgram implements the opengl.OpenGl interface.

func (*OpenGl) CreateShader

func (native *OpenGl) CreateShader(shaderType uint32) uint32

CreateShader implements the opengl.OpenGl interface.

func (*OpenGl) DeleteBuffers

func (native *OpenGl) DeleteBuffers(buffers []uint32)

DeleteBuffers implements the opengl.OpenGl interface.

func (*OpenGl) DeleteProgram

func (native *OpenGl) DeleteProgram(program uint32)

DeleteProgram implements the opengl.OpenGl interface.

func (*OpenGl) DeleteShader

func (native *OpenGl) DeleteShader(shader uint32)

DeleteShader implements the opengl.OpenGl interface.

func (*OpenGl) DeleteTextures

func (native *OpenGl) DeleteTextures(textures []uint32)

DeleteTextures implements the opengl.OpenGl interface.

func (*OpenGl) DeleteVertexArrays

func (native *OpenGl) DeleteVertexArrays(arrays []uint32)

DeleteVertexArrays implements the opengl.OpenGl interface.

func (*OpenGl) Disable

func (native *OpenGl) Disable(cap uint32)

Disable implements the opengl.OpenGl interface.

func (*OpenGl) DrawArrays

func (native *OpenGl) DrawArrays(mode uint32, first int32, count int32)

DrawArrays implements the opengl.OpenGl interface.

func (*OpenGl) Enable

func (native *OpenGl) Enable(cap uint32)

Enable implements the opengl.OpenGl interface.

func (*OpenGl) EnableVertexAttribArray

func (native *OpenGl) EnableVertexAttribArray(index uint32)

EnableVertexAttribArray implements the opengl.OpenGl interface.

func (*OpenGl) GenBuffers

func (native *OpenGl) GenBuffers(n int32) []uint32

GenBuffers implements the opengl.OpenGl interface.

func (*OpenGl) GenTextures

func (native *OpenGl) GenTextures(n int32) []uint32

GenTextures implements the opengl.OpenGl interface.

func (*OpenGl) GenVertexArrays

func (native *OpenGl) GenVertexArrays(n int32) []uint32

GenVertexArrays implements the opengl.OpenGl interface.

func (*OpenGl) GenerateMipmap

func (native *OpenGl) GenerateMipmap(target uint32)

GenerateMipmap implements the opengl.OpenGl interface.

func (*OpenGl) GetAttribLocation

func (native *OpenGl) GetAttribLocation(program uint32, name string) int32

GetAttribLocation implements the opengl.OpenGl interface.

func (*OpenGl) GetError

func (native *OpenGl) GetError() uint32

GetError implements the opengl.OpenGl interface.

func (*OpenGl) GetProgramInfoLog

func (native *OpenGl) GetProgramInfoLog(program uint32) string

GetProgramInfoLog implements the opengl.OpenGl interface.

func (*OpenGl) GetProgramParameter

func (native *OpenGl) GetProgramParameter(program uint32, param uint32) int32

GetProgramParameter implements the opengl.OpenGl interface.

func (*OpenGl) GetShaderInfoLog

func (native *OpenGl) GetShaderInfoLog(shader uint32) string

GetShaderInfoLog implements the opengl.OpenGl interface.

func (*OpenGl) GetShaderParameter

func (native *OpenGl) GetShaderParameter(shader uint32, param uint32) int32

GetShaderParameter implements the opengl.OpenGl interface.

func (*OpenGl) GetUniformLocation

func (native *OpenGl) GetUniformLocation(program uint32, name string) int32

GetUniformLocation implements the opengl.OpenGl interface.

func (*OpenGl) LinkProgram

func (native *OpenGl) LinkProgram(program uint32)

LinkProgram implements the opengl.OpenGl interface.

func (*OpenGl) ReadPixels

func (native *OpenGl) ReadPixels(x int32, y int32, width int32, height int32, format uint32, pixelType uint32, pixels interface{})

ReadPixels implements the opengl.OpenGl interface.

func (*OpenGl) ShaderSource

func (native *OpenGl) ShaderSource(shader uint32, source string)

ShaderSource implements the opengl.OpenGl interface.

func (*OpenGl) TexImage2D

func (native *OpenGl) TexImage2D(target uint32, level int32, internalFormat uint32, width int32, height int32,
	border int32, format uint32, xtype uint32, pixels interface{})

TexImage2D implements the opengl.OpenGl interface.

func (*OpenGl) TexParameteri

func (native *OpenGl) TexParameteri(target uint32, pname uint32, param int32)

TexParameteri implements the opengl.OpenGl interface.

func (*OpenGl) Uniform1i

func (native *OpenGl) Uniform1i(location int32, value int32)

Uniform1i implements the opengl.OpenGl interface.

func (*OpenGl) Uniform4fv

func (native *OpenGl) Uniform4fv(location int32, value *[4]float32)

Uniform4fv implements the opengl.OpenGl interface.

func (*OpenGl) UniformMatrix4fv

func (native *OpenGl) UniformMatrix4fv(location int32, transpose bool, value *[16]float32)

UniformMatrix4fv implements the opengl.OpenGl interface.

func (*OpenGl) UseProgram

func (native *OpenGl) UseProgram(program uint32)

UseProgram implements the opengl.OpenGl interface.

func (*OpenGl) VertexAttribOffset

func (native *OpenGl) VertexAttribOffset(index uint32, size int32, attribType uint32, normalized bool, stride int32, offset int)

VertexAttribOffset implements the opengl.OpenGl interface.

func (*OpenGl) Viewport

func (native *OpenGl) Viewport(x int32, y int32, width int32, height int32)

Viewport implements the opengl.OpenGl interface.

type OpenGlWindow

type OpenGlWindow struct {
	env.AbstractOpenGlWindow
	// contains filtered or unexported fields
}

OpenGlWindow represents a native OpenGL surface.

func NewOpenGlWindow

func NewOpenGlWindow(title string, framesPerSecond float64) (window *OpenGlWindow, err error)

NewOpenGlWindow tries to initialize the OpenGL environment and returns a new window instance.

func (*OpenGlWindow) Close

func (window *OpenGlWindow) Close()

Close closes the window and releases its resources.

func (*OpenGlWindow) OpenGl

func (window *OpenGlWindow) OpenGl() opengl.OpenGl

OpenGl implements the OpenGlWindow interface.

func (*OpenGlWindow) SetCursorVisible

func (window *OpenGlWindow) SetCursorVisible(visible bool)

SetCursorVisible implements the OpenGlWindow interface

func (*OpenGlWindow) SetFullScreen

func (window *OpenGlWindow) SetFullScreen(on bool)

SetFullScreen implements the OpenGlWindow interface.

func (*OpenGlWindow) ShouldClose

func (window *OpenGlWindow) ShouldClose() bool

ShouldClose returns true if the user requested the window to close.

func (*OpenGlWindow) Size

func (window *OpenGlWindow) Size() (width int, height int)

Size implements the OpenGlWindow interface.

func (*OpenGlWindow) Update

func (window *OpenGlWindow) Update()

Update must be called from within the main thread as often as possible.

Jump to

Keyboard shortcuts

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