Documentation
¶
Overview ¶
Package gome provides a minimal and simple library for setting up a graphical application using OpenGL. All functions should be called on the main OS thread. Init locks the goroutine to the main OS thread, so calling that early in main ensures that any subsequent calls in main are on the right thread.
The main loop of the application then looks like this:
if err := gome.Init(); err != nil {
// handle error
}
defer gome.Terminate()
initGL()
render()
gome.Tick()
gome.Window.Show()
for gome.Tick() {
update()
render()
}
if err := gome.GetError(); err != nil {
// handle error
}
A time.Ticker can be used to limit framerate.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ( ErrGLFW3Initialize = errors.New("could not initialise GLFW3") ErrGLEWInitialize = errors.New("could not initialise GLEW") )
var ShouldClose = false
ShouldClose reflects whether the main loop should end. Setting ShouldClose to true causes gome.Tick to return false, which should end the main loop.
var Window *glfw3.Window
Window is the main window of the application. This is created automatically by Init and has dimensions 800x600 by default. It is hidden by default, so the application should call gome.Window.Show() after any initialisation code.
Functions ¶
func Init ¶
func Init() error
Init initialises GLFW3 and OpenGL and creates the main window (see Window). After this has returned OpenGL functions as well as gome.Tick can be used. It also locks the current OS thread (see runtime.LockOSThread).
Types ¶
This section is empty.