着色器管理

发布于 2024-12-28 12:57:31 字数 163 浏览 2 评论 0原文

我正在学习 GLSL,以便在我的 IOS 和 IOS 中管理它。 Android C++ 引擎。 我获得了大量有关语法和 GLSL 编程的文档,但我需要一些有关如何在完整场景中管理它的教程(如何仅在场景的特定对象上应用着色器?如何组合对象上的多种效果?

)您有一些链接或书籍参考可以发送给我吗?

I am learning about GLSL in order to manage it in my IOS & android C++ engine.
I get a lot of documentation about syntax and GLSL programming but I need some tutorials about how to manage it in a complete scene (How to apply a shader only on a specific object of the scene ? How combine several effects on an object ? )

Do you have some links or book reference to send me ?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

浅暮の光 2025-01-04 12:57:31

如何仅将着色器应用于场景的特定对象?

这与将纹理应用到特定对象的方式相同。您可以使用您想要使用的程序调用glUseProgram。任何后续渲染命令都将使用该程序,直到遇到另一个 glUseProgram 调用。

如何将多种效果组合到一个对象上?

一般来说,这意味着您编写一个新的着色器。着色器并不是真正可以与 API 结合使用的东西。您可以将其中的一些内容复制到其他着色器中。您可以使用OpenGL 着色器对象范例的独特功能根据程序的功能来更改程序功能链接到哪个。

但在一般情况下,如果您想组合多个“效果”,则必须编写一个包含这些效果的新着色器。

How to apply a shader only on a specific object of the scene ?

It's the same way you apply a texture to a specific object. You call glUseProgram with the program you want to use. Any subsequent rendering commands will use that program, until another glUseProgram call is encountered.

How combine several effects on an object ?

In general, this means that you write a new shader. Shaders are not really things you can combine with the API. You can copy bits of them into other shaders. You can use the unique features of the OpenGL shader object paradigm to change program functionality based on which programs are linked to which.

But in the general case, if you want to combine several "effects", you have to write a new shader that has those effects in it.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文