views:

102

answers:

1

So, I've been trying to figure out why the square is moving up and down the iPhone simulator when I Build and Run the template that Apple provides for OpenGL ES. I don't understand why for example they have ES1Render.m, and ES2Render.m instead of just one ESRender.m. Also, where is the equivalent of the glutDisplayFunc, and glutTimerFunc? Thanks in advance.

+2  A: 

They are trying to the show the two versions of OpenGL ES. One uses shaders (v2) and the other (v1) uses older OpenGL technology. In the ES2 renderer I believe they are doing all the movement in the shader code. If you want something that looks like older OpenGL code try setting it to use the version 1 renderer. Then you can use stuff like the older demos on http://nehe.gamedev.net/. You just need to fill in the "render" function with your drawing code.

EAGLView has a timer which sets the frame rate, but there is a method which allows you to set it to be whatever you like.

Nathan S.
Ok, I'll be sure to try that out. Thanks!
thyrgle
@thyrgle - Also note that GLUT is not available in its full form in OpenGL ES, so you may need to find alternate ways of implementing any code that relies on that toolkit.
Brad Larson
Oh yeah I feel really stupid now... should have thought about that... I'm to use to desktop OpenGL/GLUT programming.
thyrgle