native

package
v1.10.1 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Run

func Run(initializer func(opengl.Window) error, title string, framesPerSecond float64) error

Run creates a native OpenGL window, initializes it with the given function and then runs the event loop until the window shall be closed.

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) BindFramebuffer added in v1.8.0

func (native *OpenGL) BindFramebuffer(target uint32, buffer uint32)

BindFramebuffer implements the opengl.OpenGL interface.

func (*OpenGL) BindRenderbuffer added in v1.8.0

func (native *OpenGL) BindRenderbuffer(target uint32, buffer uint32)

BindRenderbuffer implements the opengl.OpenGL interface.

func (*OpenGL) BindSampler

func (native *OpenGL) BindSampler(unit uint32, sampler uint32)

BindSampler 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) BlendEquation

func (native *OpenGL) BlendEquation(mode uint32)

BlendEquation implements the opengl.OpenGL interface.

func (*OpenGL) BlendEquationSeparate

func (native *OpenGL) BlendEquationSeparate(modeRGB uint32, modeAlpha uint32)

BlendEquationSeparate implements the opengl.OpenGL interface.

func (*OpenGL) BlendFunc

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

BlendFunc implements the opengl.OpenGL interface.

func (*OpenGL) BlendFuncSeparate

func (native *OpenGL) BlendFuncSeparate(srcRGB uint32, dstRGB uint32, srcAlpha uint32, dstAlpha uint32)

BlendFuncSeparate implements the opengl.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) CheckFramebufferStatus added in v1.8.0

func (native *OpenGL) CheckFramebufferStatus(target uint32) uint32

CheckFramebufferStatus 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) DeleteFramebuffers added in v1.8.0

func (native *OpenGL) DeleteFramebuffers(buffers []uint32)

DeleteFramebuffers 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(capability 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) DrawBuffers added in v1.8.0

func (native *OpenGL) DrawBuffers(buffers []uint32)

DrawBuffers implements the opengl.OpenGL interface.

func (*OpenGL) DrawElements

func (native *OpenGL) DrawElements(mode uint32, count int32, elementType uint32, indices uintptr)

DrawElements implements the opengl.OpenGL interface.

func (*OpenGL) Enable

func (native *OpenGL) Enable(capability uint32)

Enable implements the opengl.OpenGL interface.

func (*OpenGL) EnableVertexAttribArray

func (native *OpenGL) EnableVertexAttribArray(index uint32)

EnableVertexAttribArray implements the opengl.OpenGL interface.

func (*OpenGL) FramebufferRenderbuffer added in v1.8.0

func (native *OpenGL) FramebufferRenderbuffer(target uint32, attachment uint32, renderbuffertarget uint32, renderbuffer uint32)

FramebufferRenderbuffer implements the opengl.OpenGL interface.

func (*OpenGL) FramebufferTexture added in v1.8.0

func (native *OpenGL) FramebufferTexture(target uint32, attachment uint32, texture uint32, level int32)

FramebufferTexture implements the opengl.OpenGL interface.

func (*OpenGL) GenBuffers

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

GenBuffers implements the opengl.OpenGL interface.

func (*OpenGL) GenFramebuffers added in v1.8.0

func (native *OpenGL) GenFramebuffers(n int32) []uint32

GenFramebuffers implements the opengl.OpenGL interface.

func (*OpenGL) GenRenderbuffers added in v1.8.0

func (native *OpenGL) GenRenderbuffers(n int32) []uint32

GenRenderbuffers 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) GetIntegerv

func (native *OpenGL) GetIntegerv(name uint32, data *int32)

GetIntegerv 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) IsEnabled

func (native *OpenGL) IsEnabled(capability uint32) bool

IsEnabled implements the OpenGL interface.

func (*OpenGL) LinkProgram

func (native *OpenGL) LinkProgram(program uint32)

LinkProgram implements the opengl.OpenGL interface.

func (*OpenGL) PixelStorei

func (native *OpenGL) PixelStorei(name uint32, param int32)

PixelStorei implements the OpenGL interface.

func (*OpenGL) PolygonMode

func (native *OpenGL) PolygonMode(face uint32, mode uint32)

PolygonMode 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) RenderbufferStorage added in v1.8.0

func (native *OpenGL) RenderbufferStorage(target uint32, internalFormat uint32, width int32, height int32)

RenderbufferStorage implements the opengl.OpenGL interface.

func (*OpenGL) Scissor

func (native *OpenGL) Scissor(x, y int32, width, height int32)

Scissor 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 {
	opengl.WindowEventDispatcher
	// contains filtered or unexported fields
}

OpenGLWindow represents a native OpenGL surface.

func NewOpenGLWindow

func NewOpenGLWindow(title string, framesPerSecond float64) (*OpenGLWindow, error)

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

func (OpenGLWindow) ClipboardString added in v0.2.0

func (window OpenGLWindow) ClipboardString() (string, error)

ClipboardString returns the current value of the clipboard, if it is compatible with UTF-8.

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 returns the OpenGL API.

func (OpenGLWindow) RestoreState added in v1.6.0

func (window OpenGLWindow) RestoreState(state opengl.WindowState)

RestoreState puts the window into the same state when StateSnapshot() was called.

func (OpenGLWindow) SetClipboardString added in v0.2.0

func (window OpenGLWindow) SetClipboardString(value string)

SetClipboardString sets the current value of the clipboard as UTF-8 string.

func (*OpenGLWindow) SetCloseRequest

func (window *OpenGLWindow) SetCloseRequest(shouldClose bool)

SetCloseRequest sets the should-close property of the window.

func (*OpenGLWindow) SetCursorVisible

func (window *OpenGLWindow) SetCursorVisible(visible bool)

SetCursorVisible toggles the visibility of the cursor.

func (*OpenGLWindow) SetFullScreen

func (window *OpenGLWindow) SetFullScreen(on bool)

SetFullScreen toggles the windowed mode.

func (*OpenGLWindow) SetProjectModified added in v1.6.0

func (window *OpenGLWindow) SetProjectModified(modified bool)

SetProjectModified sets an indicator in the window frame that the project has not been saved.

func (*OpenGLWindow) SetTitleSuffix added in v1.7.0

func (window *OpenGLWindow) SetTitleSuffix(value string)

SetTitleSuffix appends a text to the current window title.

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 returns the dimension of the frame buffer of this window.

func (OpenGLWindow) StateSnapshot added in v1.6.0

func (window OpenGLWindow) StateSnapshot() opengl.WindowState

StateSnapshot returns the current state of the window.

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