glsl函数之纹理函数

本文详细介绍了OpenGL Shading Language (GLSL)中的纹理函数texture2D和textureCube,包括它们的参数、用途以及如何在计算中应用偏移量。通过这两个函数,开发者可以从纹理中检索颜色值,适用于2D和立方体贴图操作。

#glsl函数之纹理函数

texture2D

Retrieves texels from a texture

vec4 texture2D(sampler2D sampler, vec2 coord)
vec4 texture2D(sampler2D sampler, vec2 coord, float bias)

Parameters

sampler specifies the sampler to which the texture from which texels will be retrieved is bound.

coord specifies the texture coordinates at which texture will be sampled.

bias specifies an optional bias to be applied during level-of-detail computation.

Description

The texture2D function returns a texel, i.e. the (color) value of the texture for the given coordinates. The function has one input parameter of the type sampler2D and one input parameter of the type vec2 : sampler, the uniform the texture is bound to, and coord, the 2-dimensional coordinates of the texel to look up.

<
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值