Skip to content

Thommil/tge-gl

Repository files navigation

TGE-GL - OpenGL plugin for TGE

Godoc Go Report Card

OpenGL support for TGE runtime - TGE

Based on :

  • go-gl - Copyright (c) 2014 Eric Woroshow
  • gomobile - Copyright (c) 2009 The Go Authors. All rights reserved.

Targets

  • OpenGL 3.3 core on Desktop
  • WebGL2 on Browsers
  • OpenGLES 3 on Mobile

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

  • glUniformMatrix2x3fv
  • glUniformMatrix3x2fv
  • glUniformMatrix2x4fv
  • glUniformMatrix4x2fv
  • glUniformMatrix3x4fv
  • glUniformMatrix4x3fv
  • glBlitFramebuffer
  • PolygonMode on Mobile/Browser

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
}

...

About

OpenGL 3 plugin for TGE runtime

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages