WebGL 的 MAX_TEXTURE_SIZE 是最大面积、直径还是字节数?
Is WebGL's MAX_TEXTURE_SIZE the max area, diameter, or bytes?
有趣的是,有多少文档避免了对 WebGLRenderingContext#getParameter(WebGLRenderingContext.MAX_TEXTURE_SIZE)
含义的歧义。 "Size"不是很具体。
它是以字节为单位的纹理的最大存储大小,意味着降低位深度或使用更少的颜色通道会增加最大尺寸?它是纹理的最大 像素 直径,这意味着如果您的纹理是高度矩形的,您在可寻址区域方面会受到更多限制?是否最大像素数?
它是以像素为单位的最大直径。如果 M
是最大纹理大小,那么您可以创建大小为 M x M
、M/2 x M/4
、M x 1
等的纹理;但是你不能制作大小为 2M x 2M
或 1 x 2M
.
的纹理
考虑 this opengl capability report 中报告的最大 MAX_TEXTURE_SIZE 是 16384 (2^15)。如果那是最大像素数(没关系 字节 ),而不是最大直径,您将无法创建 256x256 纹理。 真的很小。
(请注意 MAX_TEXTURE_SIZE 之外的限制适用。例如,我的机器 returns 最大纹理大小为 2^15。但是 2^15 x 2^15 纹理带有 rgba 浮点像素将占用 16 GB 的 space。它不适合可用内存。)
中所说
The remaining sections of this document are intended to be read in conjunction with the OpenGL ES 2.0 specification (2.0.25 at the time of this writing, available from the Khronos OpenGL ES API Registry). Unless otherwise specified, the behavior of each method is defined by the OpenGL ES 2.0 specification
OpenGL ES 2.0.25 spec, section 3.7.1 表示
The maximum allowable width and height of a two-dimensional texture image must be at least 2^(k−lod)
for image arrays of level zero through k, where k is the log base 2 of MAX_TEXTURE_SIZE
and lod is the level-of-detail of the image array.
这是您可以为纹理指定的最大宽度 and/or 高度。请注意,正如@Strilanc 指出的那样,这与内存无关。因此,虽然您可能可以创建 1 x MAX_TEXTURE_SIZE
或 MAX_TEXTURE_SIZE x 1
纹理,但您可能无法创建 MAX_TEXTURE_SIZE x MAX_TEXTURE_SIZE
纹理,因为 运行 内存不足
有趣的是,有多少文档避免了对 WebGLRenderingContext#getParameter(WebGLRenderingContext.MAX_TEXTURE_SIZE)
含义的歧义。 "Size"不是很具体。
它是以字节为单位的纹理的最大存储大小,意味着降低位深度或使用更少的颜色通道会增加最大尺寸?它是纹理的最大 像素 直径,这意味着如果您的纹理是高度矩形的,您在可寻址区域方面会受到更多限制?是否最大像素数?
它是以像素为单位的最大直径。如果 M
是最大纹理大小,那么您可以创建大小为 M x M
、M/2 x M/4
、M x 1
等的纹理;但是你不能制作大小为 2M x 2M
或 1 x 2M
.
考虑 this opengl capability report 中报告的最大 MAX_TEXTURE_SIZE 是 16384 (2^15)。如果那是最大像素数(没关系 字节 ),而不是最大直径,您将无法创建 256x256 纹理。 真的很小。
(请注意 MAX_TEXTURE_SIZE 之外的限制适用。例如,我的机器 returns 最大纹理大小为 2^15。但是 2^15 x 2^15 纹理带有 rgba 浮点像素将占用 16 GB 的 space。它不适合可用内存。)
The remaining sections of this document are intended to be read in conjunction with the OpenGL ES 2.0 specification (2.0.25 at the time of this writing, available from the Khronos OpenGL ES API Registry). Unless otherwise specified, the behavior of each method is defined by the OpenGL ES 2.0 specification
OpenGL ES 2.0.25 spec, section 3.7.1 表示
The maximum allowable width and height of a two-dimensional texture image must be at least
2^(k−lod)
for image arrays of level zero through k, where k is the log base 2 ofMAX_TEXTURE_SIZE
and lod is the level-of-detail of the image array.
这是您可以为纹理指定的最大宽度 and/or 高度。请注意,正如@Strilanc 指出的那样,这与内存无关。因此,虽然您可能可以创建 1 x MAX_TEXTURE_SIZE
或 MAX_TEXTURE_SIZE x 1
纹理,但您可能无法创建 MAX_TEXTURE_SIZE x MAX_TEXTURE_SIZE
纹理,因为 运行 内存不足