Documentation ¶
Index ¶
- Constants
- func InitOpenGL()
- func MakeLightVao(vertices []float32, program uint32, vbo uint32) uint32
- func MakeObjectVao(vertices []float32, program uint32) (uint32, uint32)
- func MakeTexture(path string) uint32
- func Show(keepOpen *bool)
- type Camera
- type Clipboard
- type GLFW
- func (platform *GLFW) ClipboardText() (string, error)
- func (platform *GLFW) DisplaySize() [2]float32
- func (platform *GLFW) Dispose()
- func (platform *GLFW) FramebufferSize() [2]float32
- func (platform *GLFW) NewFrame()
- func (platform *GLFW) PostRender()
- func (platform *GLFW) ProcessEvents()
- func (platform *GLFW) SetClipboardText(text string)
- func (platform *GLFW) ShouldStop() bool
- type GLFWClientAPI
- type OpenGL3
- type Platform
- type Renderer
- type Shader
- func (s *Shader) SetFloat(name string, value float32)
- func (s *Shader) SetInt(name string, value int32)
- func (s *Shader) SetMat2(name string, value mgl.Mat2)
- func (s *Shader) SetMat3(name string, value mgl.Mat3)
- func (s *Shader) SetMat4(name string, value mgl.Mat4)
- func (s *Shader) SetVec2(name string, value mgl.Vec2)
- func (s *Shader) SetVec3(name string, value mgl.Vec3)
- func (s *Shader) SetVec4(name string, value mgl.Vec4)
- func (s *Shader) Use()
- type StringError
Constants ¶
const ( MillisPerSecond = 1000 SleepDuration = time.Millisecond * 5 )
Variables ¶
This section is empty.
Functions ¶
func InitOpenGL ¶
func InitOpenGL()
InitOpenGL initializes OpenGL and returns an initialized program.
func MakeTexture ¶
Types ¶
type Camera ¶
type Camera struct { CameraPos mgl.Vec3 CameraFront mgl.Vec3 CameraUp mgl.Vec3 Yaw float64 Pitch float64 LastX float64 LastY float64 Fov float64 Sensitivity float64 FirstMouse bool }
func (*Camera) MouseCallback ¶
type GLFW ¶
GLFW implements a platform based on github.com/go-gl/glfw (v3.2).
func (*GLFW) ClipboardText ¶
ClipboardText returns the current Clipboard text, if available.
func (*GLFW) DisplaySize ¶
DisplaySize returns the dimension of the display.
func (*GLFW) FramebufferSize ¶
FramebufferSize returns the dimension of the framebuffer.
func (*GLFW) NewFrame ¶
func (platform *GLFW) NewFrame()
NewFrame marks the begin of a render pass. It forwards all current state to imgui IO.
func (*GLFW) ProcessEvents ¶
func (platform *GLFW) ProcessEvents()
ProcessEvents handles all pending Window events.
func (*GLFW) SetClipboardText ¶
SetClipboardText sets the text as the current Clipboard text.
func (*GLFW) ShouldStop ¶
ShouldStop returns true if the Window is to be closed.
type GLFWClientAPI ¶
type GLFWClientAPI string
GLFWClientAPI identifies the render system that shall be initialized.
type OpenGL3 ¶
type OpenGL3 struct {
// contains filtered or unexported fields
}
OpenGL3 implements a renderer based on github.com/go-gl/gl (v3.2-core).
func NewOpenGL3 ¶
NewOpenGL3 attempts to initialize a renderer. An OpenGL context has to be established before calling this function.
type Platform ¶
type Platform interface { // ShouldStop is regularly called as the abort condition for the program loop. ShouldStop() bool // ProcessEvents is called once per render loop to dispatch any pending events. ProcessEvents() // DisplaySize returns the dimension of the display. DisplaySize() [2]float32 // FramebufferSize returns the dimension of the framebuffer. FramebufferSize() [2]float32 // NewFrame marks the begin of a render pass. It must update the imgui IO state according to user input (mouse, keyboard, ...) NewFrame() // PostRender marks the completion of one render pass. Typically this causes the display buffer to be swapped. PostRender() // ClipboardText returns the current text of the Clipboard, if available. ClipboardText() (string, error) // SetClipboardText sets the text as the current text of the Clipboard. SetClipboardText(text string) }
Platform covers mouse/keyboard/gamepad inputs, cursor shape, timing, windowing.
type Renderer ¶
type Renderer interface { // PreRender causes the display buffer to be prepared for new output. PreRender(clearColor [3]float32) // Render draws the provided imgui draw data. Render(displaySize [2]float32, framebufferSize [2]float32, drawData imgui.DrawData) }
Renderer covers rendering imgui draw data.
type Shader ¶
type Shader struct {
Id uint32
}
func ShaderFactory ¶
type StringError ¶
type StringError string
StringError describes a basic error with static information.