简体   繁体   English

OpenGL ES模板如何用于iPhone?

[英]How does the OpenGL ES template work for the iPhone?

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. 因此,当我构建并运行Apple为OpenGL ES提供的模板时,我一直试图弄清楚正方形在iPhone模拟器上为何上下移动。 I don't understand why for example they have ES1Render.m, and ES2Render.m instead of just one ESRender.m. 我不明白为什么他们要有ES1Render.m和ES2Render.m而不是只有一个ESRender.m。 Also, where is the equivalent of the glutDisplayFunc, and glutTimerFunc? 另外,glutDisplayFunc和glutTimerFunc的等效项在哪里? Thanks in advance. 提前致谢。

They are trying to the show the two versions of OpenGL ES. 他们正在尝试展示OpenGL ES的两个版本。 One uses shaders (v2) and the other (v1) uses older OpenGL technology. 一个使用着色器(v2),另一个(v1)使用较旧的OpenGL技术。 In the ES2 renderer I believe they are doing all the movement in the shader code. 我相信在ES2渲染器中,他们正在完成着色器代码中的所有移动。 If you want something that looks like older OpenGL code try setting it to use the version 1 renderer. 如果您想要看起来像旧版OpenGL代码的东西,请尝试将其设置为使用版本1渲染器。 Then you can use stuff like the older demos on http://nehe.gamedev.net/ . 然后,您可以在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. EAGLView有一个计时器来设置帧频,但是有一种方法可以让您将其设置为自己喜欢的值。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM