diff --git a/examples/glut/main.go b/examples/glut/main.go index 5fd6ba7dc..f1a8293e6 100644 --- a/examples/glut/main.go +++ b/examples/glut/main.go @@ -76,21 +76,19 @@ func main() { game := &DemoGame{} device = graphics.NewDevice(screenWidth, screenHeight, screenScale, func(g *graphics.GraphicsContext, offscreen *graphics.Texture) { - <-ch + ticket := <-ch game.Draw(g, offscreen) - ch<- true + ch<- ticket }) go func() { const frameTime = time.Second / 60 - lastTime := time.Now() + tick := time.Tick(frameTime) for { - <-ch + <-tick + ticket := <-ch game.Update() - ch<- true - now := time.Now() - time.Sleep(frameTime - now.Sub(lastTime)) - lastTime = now + ch<- ticket } }() ch<- true diff --git a/graphics/texture.go b/graphics/texture.go index c0462c463..996e63cd4 100644 --- a/graphics/texture.go +++ b/graphics/texture.go @@ -92,7 +92,3 @@ func NewTextureFromRGBA(image *image.RGBA) *Texture { func (texture *Texture) IsAvailable() bool { return texture.id != 0 } - -func init() { - // TODO: Initialize OpenGL here? -}