Thommil / tge-gl

OpenGL 3 plugin for TGE runtime
BSD 2-Clause "Simplified" License
5 stars 0 forks source link

TGE-GL - OpenGL plugin for TGE

Godoc Go Report Card

OpenGL support for TGE runtime - TGE

Based on :

Targets

Dependencies

Mobile

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

Limitations

Not implemented

Implementation

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
}

...