opengl: Refactoring

This commit is contained in:
Hajime Hoshi 2018-11-05 00:44:27 +09:00
parent 4090258904
commit f7fa4ed8f9
4 changed files with 3 additions and 15 deletions

View File

@ -74,7 +74,7 @@ type Context struct {
context
}
var theContext *Context
var theContext = &Context{}
func GetContext() *Context {
return theContext

View File

@ -78,10 +78,6 @@ type context struct {
init bool
}
func init() {
theContext = &Context{}
}
func (c *Context) reset() error {
if err := mainthread.Run(func() error {
if c.init {

View File

@ -119,10 +119,6 @@ type context struct {
lastProgramID programID
}
func init() {
theContext = &Context{}
}
func (c *Context) ensureGL() {
if c.gl != (js.Value{}) {
return

View File

@ -76,15 +76,11 @@ type context struct {
}
func Init() {
c := &Context{}
c.gl, c.worker = mgl.NewContext()
theContext = c
theContext.gl, theContext.worker = mgl.NewContext()
}
func InitWithContext(context mgl.Context) {
c := &Context{}
c.gl = context
theContext = c
theContext.gl = context
}
func (c *Context) DoWork(chError <-chan error, chDone <-chan struct{}) error {