oglabstr

package module
v0.0.0-...-110eb80 Latest Latest
Warning

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

Go to latest
Published: Apr 26, 2018 License: MIT Imports: 14 Imported by: 0

README

oglabstr - OpenGL abstractions

Small lib I made for myself that abstracts some OpenGL primitives into easy to use structs.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateWindow

func CreateWindow(width, height int, title string) *glfw.Window

func GetSizeOfType

func GetSizeOfType(glType uint32) int32

Types

type Camera

type Camera struct {
	Position         mgl32.Vec3
	Front, Up, Right mgl32.Vec3
	WorldUp          mgl32.Vec3

	Yaw, Pitch float32

	MovementSpeed float32
	Sensitivity   float32
	Zoom          float32

	//For perspective projection
	Near, Far float32
}

func NewCamera

func NewCamera(position mgl32.Vec3) *Camera

func (*Camera) GetViewMat

func (c *Camera) GetViewMat() mgl32.Mat4

func (*Camera) KeyboardUpdate

func (c *Camera) KeyboardUpdate(direction Direction, deltaTime float32)

func (*Camera) MouseUpdate

func (c *Camera) MouseUpdate(xoffset, yoffset float32)

func (*Camera) ScrollUpdate

func (c *Camera) ScrollUpdate(yoffset float32)

type Direction

type Direction byte
const (
	Forward Direction = iota
	Backward
	Right
	Left
	Up
	Down
)

type IndexBuffer

type IndexBuffer struct {
	Count int32
	// contains filtered or unexported fields
}

func NewIndexBuffer

func NewIndexBuffer(data []uint32) *IndexBuffer

func (*IndexBuffer) Bind

func (ib *IndexBuffer) Bind()

func (*IndexBuffer) Delete

func (ib *IndexBuffer) Delete()

func (*IndexBuffer) Unbind

func (ib *IndexBuffer) Unbind()

type Material

type Material struct {
	Name string

	Diffuse, Specular *Texture
	Shininess         float32
	// contains filtered or unexported fields
}

func NewMaterial

func NewMaterial(name string, diffuse, specular *Texture, shininess float32) *Material

func (*Material) Bind

func (m *Material) Bind(shader *Shader)

type Shader

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

func NewShaderProgram

func NewShaderProgram(vertexShaderPath, fragmentShaderPath string) (*Shader, error)

func (*Shader) Bind

func (s *Shader) Bind()

func (*Shader) SetFloat

func (s *Shader) SetFloat(name string, v0 float32)

func (*Shader) SetFloat3

func (s *Shader) SetFloat3(name string, v0, v1, v2 float32)

func (*Shader) SetInt

func (s *Shader) SetInt(name string, value int32)

func (*Shader) SetMat3

func (s *Shader) SetMat3(name string, mat mgl32.Mat3, transpose bool)

func (*Shader) SetMat4

func (s *Shader) SetMat4(name string, mat mgl32.Mat4, transpose bool)

func (*Shader) SetVec3

func (s *Shader) SetVec3(name string, vec3 mgl32.Vec3)

func (*Shader) SetVec4

func (s *Shader) SetVec4(name string, vec4 mgl32.Vec4)

func (*Shader) Unbind

func (s *Shader) Unbind()

type Texture

type Texture struct {
	Width, Height, Bpp int32
	Slot               uint32
	// contains filtered or unexported fields
}

func NewTexture

func NewTexture(path string, slot uint32) *Texture

func (*Texture) Bind

func (t *Texture) Bind()

func (*Texture) Unbind

func (t *Texture) Unbind()

type VertexArray

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

func NewVertexArray

func NewVertexArray() *VertexArray

func (*VertexArray) AddBuffer

func (va *VertexArray) AddBuffer(vb *VertexBuffer, layout *VertexBufferLayout)

func (*VertexArray) Bind

func (va *VertexArray) Bind()

func (*VertexArray) Unbind

func (va *VertexArray) Unbind()

type VertexBuffer

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

func NewVertexBuffer

func NewVertexBuffer(data interface{}, size int) *VertexBuffer

func (*VertexBuffer) Bind

func (ib *VertexBuffer) Bind()

func (*VertexBuffer) Delete

func (ib *VertexBuffer) Delete()

func (*VertexBuffer) Unbind

func (ib *VertexBuffer) Unbind()

type VertexBufferElement

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

type VertexBufferLayout

type VertexBufferLayout struct {
	Elements []VertexBufferElement
	Stride   int32
}

func NewVertexBufferLayout

func NewVertexBufferLayout() *VertexBufferLayout

func (*VertexBufferLayout) Pushf32

func (vbl *VertexBufferLayout) Pushf32(count int32)

func (*VertexBufferLayout) Pushub

func (vbl *VertexBufferLayout) Pushub(count int32)

func (*VertexBufferLayout) Pushui32

func (vbl *VertexBufferLayout) Pushui32(count int32)

Jump to

Keyboard shortcuts

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