views:

201

answers:

1

I'm trying to port one of my OpenGL/Glut programs over to Android 1.6. I used GLut extensively due to my classes teaching glut. Is there an alternative to glutTimerFunc or replacement for using glutTimerFunc?

Also, any ideas where I can replace glutMainLoop? From looking at a few examples, onDrawFrame what I should be looking at?

A: 

Extend the GLSurfaceView and onDrawFrame is definitly the place to do your drawing in (it replaces the main loop). Also regarding the glutTimerFunc... the onDrawFrame is only called as often as the refresh rate of the display allows (eg 60fps on a g1 etc).

Soulreaper
And you can get System time to calculate the time step between frames. Just call `System.getCurrentMillis()`. There is a Spinning Cube example that is a great place to get started with OpenGL on Android. Unfortunately it's buried in the ApiDemos which are a bit jumbled. Here's a link: http://developer.android.com/intl/fr/resources/samples/ApiDemos/src/com/example/android/apis/graphics/index.html
CaseyB