opengl

package
v0.0.0-...-1fa7888 Latest Latest
Warning

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

Go to latest
Published: Oct 21, 2020 License: AGPL-3.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const Fragment = `
in vec4 blend;
out vec4 color;

void main() {
	color = blend;
}`
View Source
const FragmentFallback = `` /* 14406-byte string literal not displayed */
View Source
const Vertex = `` /* 446-byte string literal not displayed */
View Source
const VertexFallback = `` /* 624-byte string literal not displayed */

Variables

This section is empty.

Functions

func NewAnimation

func NewAnimation(frames gpu.Frames) (index, count uint32)

func NewMesh

func NewMesh(v gpu.Vertices) (index, count uint32)

NewMesh implements gpu.Driver.NewMesh

func Open

func Open() (gpu.Context, error)

Open returns an OpenGL gpu.Context

func Render

func Render(model *gpu.Model)

func Sync

func Sync() error

func Upload

func Upload() error

Upload uploads all queued data to the GPU ready for rendering.

Types

type Buffer

type Buffer struct {

	//Data to buffer.
	Vertices, Normals, UVs []float32
	VertexPointers         []uint32
	Colors                 []uint8

	//There are 3 4x4 matrices.
	Transforms []gpu.Transform

	//Textures.
	ColorMaps []uint64

	//Rendering queue.
	DrawArrayCommands   []DrawArraysIndirectCommand
	DrawElementCommands []DrawElementsIndirectCommand
	// contains filtered or unexported fields
}

func BufferFor

func BufferFor(m gpu.Mode) *Buffer

BufferFor returns the buffer for this Mode.

type CompiledShader

type CompiledShader uint32

type Context

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

Context is an OpenGL driver interface to the GPU implementing the gpu.GPU interface.

func (Context) NewAnimation

func (Context) NewAnimation(frames gpu.Frames) (index, count uint32)

func (Context) NewMaterial

func (Context) NewMaterial(texture gpu.Texture) (albedo, physical, normal, emission uint64)

NewMaterial implements gpu.Driver.NewMaterial

func (Context) NewMesh

func (Context) NewMesh(vertices gpu.Vertices) (index, count uint32)

NewMesh implements gpu.Driver.NewMesh

func (Context) Render

func (Context) Render(model *gpu.Model, models []gpu.Model, transform *gpu.Transform)

func (Context) Sync

func (Context) Sync() error

func (Context) Upload

func (Context) Upload() error

type DrawArraysIndirectCommand

type DrawArraysIndirectCommand = C.DrawArraysIndirectCommand

type DrawElementsIndirectCommand

type DrawElementsIndirectCommand = C.DrawElementsIndirectCommand

type FragmentShader

type FragmentShader string

func (FragmentShader) Compile

func (s FragmentShader) Compile() (CompiledShader, error)

type Program

type Program struct {
	Shaders []Shader
	// contains filtered or unexported fields
}
var DefaultProgram Program

func NewProgram

func NewProgram() Program

func (Program) Build

func (p Program) Build() error

func (Program) Use

func (p Program) Use()

type Shader

type Shader interface {
	Compile() (CompiledShader, error)
}

type VertexShader

type VertexShader string

func (VertexShader) Compile

func (s VertexShader) Compile() (CompiledShader, error)

Jump to

Keyboard shortcuts

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