gl

package
v0.0.0-...-6459203 Latest Latest
Warning

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

Go to latest
Published: Nov 30, 2020 License: MIT Imports: 12 Imported by: 0

Documentation

Overview

Used this resource https://andreasrohner.at/posts/Web%20Development/JavaScript/Simple-orbital-camera-controls-for-THREE-js/

Index

Constants

View Source
const (
	TEXTURE0 = gl.TEXTURE0
	TEXTURE1 = gl.TEXTURE1
	TEXTURE2 = gl.TEXTURE2
	TEXTURE3 = gl.TEXTURE3
	TEXTURE4 = gl.TEXTURE4
	TEXTURE5 = gl.TEXTURE5
	TEXTURE6 = gl.TEXTURE6
	TEXTURE7 = gl.TEXTURE7
)
View Source
const (
	POINTS         = gl.POINTS
	LINES          = gl.LINES
	LINE_LOOP      = gl.LINE_LOOP
	LINE_STRIP     = gl.LINE_STRIP
	TRIANGLES      = gl.TRIANGLES
	TRIANGLE_STRIP = gl.TRIANGLE_STRIP
	TRIANGLE_FAN   = gl.TRIANGLE_FAN
)
View Source
const (
	DEPTH_BUFFER_BIT   = gl.DEPTH_BUFFER_BIT
	STENCIL_BUFFER_BIT = gl.STENCIL_BUFFER_BIT
	COLOR_BUFFER_BIT   = gl.COLOR_BUFFER_BIT
)
View Source
const (
	DEPTH_TEST = gl.DEPTH_TEST
	LEQUAL     = gl.LEQUAL
	LESS       = gl.LESS

	BLEND                    = gl.BLEND
	ONE_MINUS_SRC_ALPHA      = gl.ONE_MINUS_SRC_ALPHA
	ONE_MINUS_CONSTANT_COLOR = gl.ONE_MINUS_CONSTANT_COLOR
	ONE_MINUS_DST_ALPHA      = gl.ONE_MINUS_DST_ALPHA
	ONE_MINUS_DST_COLOR      = gl.ONE_MINUS_DST_COLOR
	ONE_MINUS_SRC_COLOR      = gl.ONE_MINUS_SRC_COLOR

	SRC_ALPHA = gl.SRC_ALPHA
)
View Source
const (
	FRONT_AND_BACK = gl.FRONT_AND_BACK
	LINE           = gl.LINE
)
View Source
const (
	FRAMEBUFFER = gl.FRAMEBUFFER
)

Variables

This section is empty.

Functions

func BindFramebuffer

func BindFramebuffer(fType, index uint32)

func BlendFunc

func BlendFunc(sFact, dFact uint32)

func Clear

func Clear(mask uint32)

func ClearColor

func ClearColor(r, g, b, a float32)

func DepthFunc

func DepthFunc(v uint32)

func Disable

func Disable(v uint32)

func Enable

func Enable(v uint32)

func NewCube

func NewCube(p VertParams) (uint32, []int32, []float32)

func NewSphere

func NewSphere(p VertParams) (uint32, []int32, []float32)

func PolygonMode

func PolygonMode(v1, v2 uint32)

Types

type Cubemap

type Cubemap struct {
	Right  string
	Left   string
	Top    string
	Bottom string
	Front  string
	Back   string
	// contains filtered or unexported fields
}

func (*Cubemap) Bind

func (cm *Cubemap) Bind(num uint32)

func (*Cubemap) Load

func (cm *Cubemap) Load() error

type Framebuffer

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

I don't understand framebuffers and usage as much as I would like to So ideally I want to revisit this for when usage needs more customization.

func NewFramebuffer

func NewFramebuffer(width, height int32) *Framebuffer

func (*Framebuffer) Bind

func (f *Framebuffer) Bind()

func (*Framebuffer) BindTexture

func (f *Framebuffer) BindTexture(v uint32)

type OrbitalCamera

type OrbitalCamera struct {
	Position mgl.Vec3

	ScaleFactor float32
	Sensativity float32
	// contains filtered or unexported fields
}

func NewOrbitalCamera

func NewOrbitalCamera(w *Window, radius float32, center mgl.Vec3) *OrbitalCamera

func (*OrbitalCamera) LookAt

func (c *OrbitalCamera) LookAt() mgl.Mat4

type Shader

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

func CompileShader

func CompileShader(vertexCode string, fragmentCode string) (*Shader, error)

func (*Shader) SetBool

func (s *Shader) SetBool(name string, value bool) *Shader

func (*Shader) SetFloat

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

func (*Shader) SetInt

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

func (*Shader) SetMat4

func (s *Shader) SetMat4(name string, value mgl.Mat4) *Shader

func (*Shader) SetVec2

func (s *Shader) SetVec2(name string, value mgl.Vec2) *Shader

func (*Shader) SetVec3

func (s *Shader) SetVec3(name string, value mgl.Vec3) *Shader

func (*Shader) Use

func (s *Shader) Use() *Shader

type Texture

type Texture struct {
	Width          int32
	Height         int32
	InternalFormat int32
	ImageFormat    uint32
	WrapS          int32
	WrapT          int32
	FilterMin      int32
	FilterMax      int32
	// contains filtered or unexported fields
}

func NewTexture

func NewTexture() *Texture

func TextureFromFile

func TextureFromFile(file string) (*Texture, error)

func (*Texture) Bind

func (t *Texture) Bind(num uint32)

func (*Texture) Generate

func (t *Texture) Generate(width, height int32, data []byte)

type VAO

type VAO struct {
	VAO           uint32
	VBO           uint32
	VertexAmount  int32
	PrimitiveType uint32
}

func NewVAO

func NewVAO(primitiveType uint32, offsets []int32, verts []float32) *VAO

func (*VAO) Draw

func (v *VAO) Draw()

type VertParams

type VertParams common.VertParams

type Window

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

func NewWindow

func NewWindow(width, height int32, title string) (*Window, error)

func (*Window) GetDT

func (w *Window) GetDT() float32

First time called with just return 0.0

func (*Window) GetTime

func (w *Window) GetTime() float32

func (*Window) PollEvents

func (w *Window) PollEvents()

func (*Window) Run

func (w *Window) Run(frameFunc func())

func (*Window) SwapBuffers

func (w *Window) SwapBuffers()

func (*Window) Terminate

func (w *Window) Terminate()

Jump to

Keyboard shortcuts

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