开发者

How does the OpenGL ES template work for the iPhone?

开发者 https://www.devze.com 2022-12-27 22:35 出处:网络
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 t

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 o开发者_如何学编程f just one ESRender.m. Also, where is the equivalent of the glutDisplayFunc, and glutTimerFunc? Thanks in advance.


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号