diff --git a/examples/glut/main.go b/examples/glut/main.go index fb5b6ec0d..d82296a26 100644 --- a/examples/glut/main.go +++ b/examples/glut/main.go @@ -6,11 +6,16 @@ package main // #include // // void display(void); +// void idle(void); // // static void setDisplayFunc(void) { // glutDisplayFunc(display); // } // +// static void setIdleFunc(void) { +// glutIdleFunc(idle); +// } +// import "C" import ( "image/color" @@ -34,6 +39,12 @@ func (game *DemoGame) Draw(g *graphics.GraphicsContext, offscreen *graphics.Text //export display func display() { device.Update() + C.glutSwapBuffers() +} + +//export idle +func idle() { + C.glutPostRedisplay() } func main() { @@ -62,6 +73,7 @@ func main() { C.glutCreateWindow(title) C.setDisplayFunc() + C.setIdleFunc() game := &DemoGame{} device = graphics.NewDevice(screenWidth, screenHeight, screenScale,