OpenGL support for TGE runtime - TGE
Based on :
In order to use this package on Linux desktop distros, you may need OpenGL library as an external dependency:
sudo apt-get install libgl1-mesa-dev
See example at OpenGL example
Just import package and OpenGL API is available in all methods of your App except OnCreate():
package main
import (
tge "github.com/thommil/tge"
gl "github.com/thommil/tge-gl"
)
type MyApp struct {
}
func (app *MyApp) OnStart(runtime tge.Runtime) error {
runtime.Subscribe(tge.ResizeEvent{}.Channel(), app.OnResize)
gl.ClearColor(0.15, 0.04, 0.15, 1)
return nil
}
func (app *MyApp) OnResize(event tge.Event) bool {
gl.Viewport(0, 0, int(event.(tge.ResizeEvent).Width), int(event.(tge.ResizeEvent).Height))
return false
}
...