openGL之API学习(三十五)texture和texture2D

在OpenGL 3.3及以上版本,texture2D()函数被弃用,建议使用新的texture()函数替代。texture()函数接受各种类型的sampler,支持1D、2D、3D及Cube等纹理类型,并且可以设置bias参数进行LOD计算。在OpenGL ES 3.0中,类似的改动也发生了,texture2D()被替换为texture()。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

纹理采样函数

texture2D() is deprecated as of (at least) OpenGL 3.3; see page 99 of the 3.30 GLSL specification. It will continue to be supported in OpenGL compatibility profiles to avoid breaking existing code, but its usage in new code is strongly discouraged.

Between glsl 120 and 130 they changed the function to texture and made it accept every kind of samplers, not just a sampler2D.

EDIT: The details are slightly different for OpenGL ES, but the end result is the same: texture2D() was deprecated and replaced by texture() in OpenGL ES 3.0; see section 8.8 of the 3.0 GLSL ES specification.

 

gvec4 texture(     gsampler1D sampler,
      float P,
      [float bias]);
 
gvec4 texture(  

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值