opengl中的标志效果
我正在尝试按照此在线教程来创建一些波浪 http://nehe.gamedev.net/tutorial/flag_effect_(waaving_texture)/16002/ 。
我想让波浪变得更大,但我不确定我是否以正确的方式进行处理,教程中当前四边形网格的大小为 45,所以我已增加到 450,但大小并没有似乎没有增加那么多。
有人可以指出我需要修改哪些内容才能使四边形变大的正确方向吗?
I'm trying to follow this online tutorial to create some waves
http://nehe.gamedev.net/tutorial/flag_effect_(waving_texture)/16002/.
I want to make the wave much bigger, but I'm not sure if I'm going about it the right way, the current mesh of quads is sized 45 in the tutorial, so i have increased to 450, however the size doesn't seem to increase that much.
Can someone point me in the right direction as to what needs to be modified to make the quads bigger.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
如果你只是想让四边形变大,那么你需要修改顶点位置代码。在您发布的 NeHe 教程中,将此部分更改
为
:说明:
x/5.0f 给出的值为 0、0.2、0.4、0.6、0.8、1.0、......、9.0。
如果您只采用这些值,您现在将拥有一个偏离中心的四边形网格。现在取 x/5.0f - 4.5f 得到值 -4.5 -4.3, -4.1, ...... 4.1, 4.3, 4.5
如果你想让四边形更大,你需要增加点之间的间距(即,将 x/5.0f 更改为 x/2.0f 之类的内容(这就是我给出的示例中发生的情况))。然后你想要重新居中(即更改-4.5f)。
If you just want to make the quads bigger, then you need to modify the vertex position code. In the NeHe tutorial you posted change this part:
To this:
Explanation:
x/5.0f gives you values 0, 0.2, 0.4, 0.6, 0.8, 1.0, ......, 9.0.
If you were to take just those values, you would now have an off center grid of quads. Now taking x/5.0f - 4.5f gives you values -4.5 -4.3, -4.1, ...... 4.1, 4.3, 4.5
If you wanted to make the quads bigger, you need to increase the spacing between the points (i.e. change the x/5.0f to something like x/2.0f (which is what happens in the example I gave)). And then you want to recenter (i.e. change the -4.5f).