纹理重复和循环OpenGL(Texture to repeat and loop OpenGL)

编程入门 行业动态 更新时间:2024-10-24 11:12:39
纹理重复和循环OpenGL(Texture to repeat and loop OpenGL)

我有一个简单的场景我正在创建,它设置在一个星球上,我希望地球正在旋转的外观。

目前我的纹理映射了一个带有星形纹理的四边形,然后在DrawScene中我将四边形转换为X量,将四边形缓慢地转换为一边。 效果看起来非常适合我正在寻找的细节水平。 问题是我不能用重复纹理的无限长四边形来产生这种效果,当我到达四边形的末端然后我将只有背景颜色时会出现这一点。

有没有办法动画Quad,以便重复的纹理可能会在静止的四边形上移动? 或者一种简单的方法来实现我正在寻找的效果。

I have a simple scene I am creating, it is set on a planet and I want the appearance that the planet is spinning.

Currently I have texture mapped a quad with a star texture, then in DrawScene I translate the quad by X amount which translates the quad slowly to one side. The effect looks quite good for the level of detail I am looking for. The problem is that I cannot have an infinitely long quad with the repeated texture to give this effect, there comes a point when I will reach the end of my quad and then I will just have the background colour.

Is there a way to animate the Quad so that the repeated texture moves on the stationary quad perhaps? Or a simple way to achieve the effect I am looking for.

最满意答案

你可以为你的星辰生成一个纹理的立方体或球体,并让行星在其内部移动,这将产生相同的效果,但能够无限地继续。

spieleprogrammierung.net上有一个关于OpenGL 3.3及更高版本的优秀教程,但是你需要翻译页面(使用chrome,它会为你做),所以你可以用自己的语言阅读。

如果您需要更多信息,请与我们联系:)

You could generate a textured cube or sphere for your star-scape and have the planet move around inside that, which would give the same effect but be able to continue infinitely.

There is an excellent tutorial at spieleprogrammierung.net for OpenGL 3.3 and above, however you will need to translate the page (use chrome and it will do it for you) so you can read it in your own language.

Let me know if you need more information:)

更多推荐

本文发布于:2023-08-03 14:34:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1390207.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:纹理   OpenGL   Texture   repeat   loop

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!