Documentation ¶
Index ¶
- func BindTexture(id TextureID)
- func BindVertexArray(id BufferID)
- func BufferData[T any](target uint32, data []T, usage uint32)
- func Cos32(x float32) float32
- func Cos32Deg(x float32) float32
- func GetVersion() string
- func Mod32(a, b float32) float32
- func SetupFPSWindow(title string, width, height int32) (window *sdl.Window, cleanup func())
- func Sin32(x float32) float32
- func Sin32Deg(x float32) float32
- func TriangleNormal(p1, p2, p3 mgl32.Vec3) mgl32.Vec3
- func UseProgram(id ProgramID)
- type BufferID
- type BufferLayout
- type BufferLoader
- type Camera
- type EmbeddedShader
- type MovementDirs
- type Object
- type ProgramID
- type Shader
- type ShaderID
- type ShaderWithPaths
- type TextureID
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func BindTexture ¶
func BindTexture(id TextureID)
binds a texture to gl.TEXTURE_2D from its texture id
func BindVertexArray ¶
func BindVertexArray(id BufferID)
func BufferData ¶
used for initialising the target with the go array at data a more go-esque wrapper for the gl.BufferData function
func GetVersion ¶
func GetVersion() string
func SetupFPSWindow ¶
sets up a window with openGL and sdl this window behaves like an fps game where the mouse is in relative mode
func UseProgram ¶
func UseProgram(id ProgramID)
Types ¶
type BufferID ¶
type BufferID uint32
func GenBindBuffer ¶
used for generating and binding general buffers e.g. VertexBufferObject or NormalArrayObject
func GenBindVertexArray ¶
func GenBindVertexArray() BufferID
used for generating and binding vertex buffers
type BufferLayout ¶
type BufferLayout[T any] struct { // contains filtered or unexported fields }
func NewBufferLayout ¶
func NewBufferLayout[T any](segments []int32, data []T) BufferLayout[T]
type BufferLoader ¶
type BufferLoader struct {
// contains filtered or unexported fields
}
func NewBufferLoader ¶
func NewBufferLoader() *BufferLoader
func (*BufferLoader) BuildFloatBuffer ¶
func (b *BufferLoader) BuildFloatBuffer(id BufferID, layout BufferLayout[float32])
type Camera ¶
type Camera struct { Pos mgl32.Vec3 Up mgl32.Vec3 Right mgl32.Vec3 Forward mgl32.Vec3 WorldUp mgl32.Vec3 Yaw float32 Pitch float32 MovementSpeed float32 MouseSensitivity float32 Zoom float32 }
func (*Camera) GetViewMatrix ¶
func (*Camera) UpdateCamera ¶
func (c *Camera) UpdateCamera(dir MovementDirs, deltaTime, mouseDx, mouseDy float32)
type EmbeddedShader ¶ added in v1.1.0
type EmbeddedShader struct {
// contains filtered or unexported fields
}
func NewEmbeddedShader ¶ added in v1.1.0
func NewEmbeddedShader(vertShader string, fragShader string) *EmbeddedShader
func (*EmbeddedShader) CheckShadersForChanges ¶ added in v1.1.0
func (s *EmbeddedShader) CheckShadersForChanges()
func (*EmbeddedShader) SetFloat ¶ added in v1.1.0
func (s *EmbeddedShader) SetFloat(name string, value float32)
func (*EmbeddedShader) SetMatrix4 ¶ added in v1.1.0
func (s *EmbeddedShader) SetMatrix4(name string, value mgl32.Mat4)
func (*EmbeddedShader) SetVec3 ¶ added in v1.1.0
func (s *EmbeddedShader) SetVec3(name string, value mgl32.Vec3)
func (*EmbeddedShader) Use ¶ added in v1.1.0
func (s *EmbeddedShader) Use()
type MovementDirs ¶
func NewMoveDirs ¶
func NewMoveDirs(f, b, r, l, u, d bool) MovementDirs
type Object ¶
type Object struct { Type string Verticies []float32 //in XYZ UV VertexStride int // 5 if using XYZ UV // contains filtered or unexported fields }
func Pentahedron ¶
func (*Object) CalcNormals ¶ added in v1.1.1
func (Object) DrawMultiple ¶
func (*Object) FillBuffers ¶ added in v1.1.1
func (o *Object) FillBuffers()
type ProgramID ¶
type ProgramID uint32
func CreateProgram ¶
func CreateProgramFromShaders ¶ added in v1.1.0
type ShaderWithPaths ¶ added in v1.1.0
type ShaderWithPaths struct {
// contains filtered or unexported fields
}
func NewShaderFromFilePaths ¶ added in v1.1.0
func NewShaderFromFilePaths(vertPath string, fragPath string) *ShaderWithPaths
func (*ShaderWithPaths) CheckShadersForChanges ¶ added in v1.1.0
func (s *ShaderWithPaths) CheckShadersForChanges()
func (*ShaderWithPaths) SetFloat ¶ added in v1.1.0
func (s *ShaderWithPaths) SetFloat(name string, value float32)
func (*ShaderWithPaths) SetMatrix4 ¶ added in v1.1.0
func (s *ShaderWithPaths) SetMatrix4(name string, value mgl32.Mat4)
func (*ShaderWithPaths) SetVec3 ¶ added in v1.1.0
func (s *ShaderWithPaths) SetVec3(name string, value mgl32.Vec3)
func (*ShaderWithPaths) Use ¶ added in v1.1.0
func (s *ShaderWithPaths) Use()
type TextureID ¶
type TextureID uint32
func GenBindTexture ¶
func GenBindTexture() TextureID
generates a new nexture ID and binds it to gl.TEXTURE_2D
func LoadTexture ¶
func LoadTextureFromImage ¶ added in v1.1.0
Click to show internal directories.
Click to hide internal directories.