在哪里可以找到有关 OpenGL 着色器函数texture2DRect() 的文档?

发布于 2024-11-24 07:55:13 字数 192 浏览 0 评论 0 原文

我通常是一个自给自足的 Google 员工,但我找不到任何有关 OpenGL 着色器函数 texture2DRect() 的文档。以前有人遇到过这个吗?

它被用在一些用于在 openframeworks 中编写着色器的示例代码中,所以我知道它存在,并且它有效,只是找不到任何关于它的官方文档。在哪里可以了解有关此功能的更多信息?

I'm normally a self-sufficient Googler, but I can't find any documentation on the OpenGL shader function texture2DRect(). Has anyone come across this before?

It's being used in some sample code for writing shaders in openframeworks, so I know it exists, and it works, just can't find any official docs on it. Where can I learn more about this function?

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

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

发布评论

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

评论(2

苍景流年 2024-12-01 07:55:13

该函数用于对 2D 纹理矩形(NPOT 纹理目标)进行采样,并在 GL_ARB_texture_rectangle 扩展。:

Add to section 8.7 "Texture Lookup Functions"

Syntax:

    vec4 texture2DRect(sampler2DRect sampler, vec2 coord)
    vec4 texture2DRectProj(sampler2DRect sampler, vec3 coord)
    vec4 texture2DRectProj(sampler2DRect sampler, vec4 coord)

Description:

    "Use the texture coordinate coord to do a texture lookup in the
    rectangle texture currently bound to sampler.  For the projective
    ("Proj") version, the texture coordinate (coord.s, coord.t) is
    divided by the last component of coord.  The third component of
    coord is ignored for the vec4 coord variant.

    No "bias" parameter or "Lod" suffixed functions for rectangle
    textures are supported because mipmaps are not allowed for
    rectangular textures."

That function is used to sample a 2D Texture Rectangle (A NPOT texture target), and it's specified in "Additions to version 1.10.59 of the OpenGL Shading Language specification" of the GL_ARB_texture_rectangle extension.:

Add to section 8.7 "Texture Lookup Functions"

Syntax:

    vec4 texture2DRect(sampler2DRect sampler, vec2 coord)
    vec4 texture2DRectProj(sampler2DRect sampler, vec3 coord)
    vec4 texture2DRectProj(sampler2DRect sampler, vec4 coord)

Description:

    "Use the texture coordinate coord to do a texture lookup in the
    rectangle texture currently bound to sampler.  For the projective
    ("Proj") version, the texture coordinate (coord.s, coord.t) is
    divided by the last component of coord.  The third component of
    coord is ignored for the vec4 coord variant.

    No "bias" parameter or "Lod" suffixed functions for rectangle
    textures are supported because mipmaps are not allowed for
    rectangular textures."
南七夏 2024-12-01 07:55:13

texture2DRect() 是一个 OpenGL 着色语言函数,我相信它是由 ARB_texture_rectangle 扩展以支持矩形、非二次幂纹理。

要使用它,您需要在着色器中设置一个 sampler2DRect 制服,然后让 texture2DRect() 从中获取颜色,就像使用 一样纹理2D()。在我使用它的 Mac 应用程序中,我需要使用 GL_TEXTURE_RECTANGLE_EXT 而不是 GL_TEXTURE_2D 创建 OpenGL 纹理。

科斯必须向我指出这一点来回答我的问题 这里

texture2DRect() is an OpenGL shading language function that I believe is added by the ARB_texture_rectangle extension in order to support rectangular, non-power-of-two textures.

To use it, you'll need to set up a sampler2DRect uniform in your shader, then have texture2DRect() grab a color from that just like you would with texture2D(). In a Mac application that I have using this, I needed to create my OpenGL texture using GL_TEXTURE_RECTANGLE_EXT instead of GL_TEXTURE_2D.

Kos had to point this out to me in response to my question here.

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