13、2的整数次方纹理问题(2012.9.10)

来源:互联网 发布:qq找回密码软件 编辑:程序博客网 时间:2024/06/09 21:02

1.对比OpenGL ES1.12.0API

OpenGL ES 1.1API中,对于glTexImage2D方法参数的描述中这样写道:

Width:

Specifies the width of the texture image. Must be 2n for some integer n. All implementations support texture images that are at least 64 texels wide.

Height:

Specifies the height of the texture image. Must be 2m for some integer m. All implementations support texture images that are at least 64  texels high.

其中特别说明了加载的纹理宽和高必须为2n

网址:

http://www.khronos.org/opengles/sdk/1.1/docs/man/glTexImage2D.xml

OpenGL ES 2.0API中,对于glTexImage2D方法参数的描述中这样写道:

Width

Specifies the width of the texture image. All implementations support 2D texture images that are at least 64 texels wide and cube-mapped texture images that are at least 16 texels wide.

Height

Specifies the height of the texture image All implementations support 2D texture images that are at least 64 texels high and cube-mapped texture images that are at least 16 texels high.

并未特殊说明加载的纹理宽和高必须为2n

网址:

http://www.khronos.org/opengles/sdk/docs/man/xhtml/glTexImage2D.xml

2.来自超级宝典中的信息

在《OpenGL超级宝典》第四版中关于该方法这样写道:“opengl 2.0允许使用非2的整数次方的纹理”

我们知道opengl es1.0剪裁自opengl 1.3opengl es 1.1则剪裁自opengl 1.5 opengl es2.0则剪裁自opengl 2.0

3.我认为

如果opengl es 2.0API不支持非2的整数次方的纹理,那么无论硬件如何,都无法加载非2的整数次方的纹理。反之,OpenGL ES 2.0API支持非2的整数次方的纹理,则能否加载成功非2的整数次方的纹理,则需要相应硬件的支持。