glTexImage2D - 通道算作内部格式

glTexImage2D - channels count as the internal format

OpenGL 2.1 documentation 说 glTexImage2D 接受通道计数作为内部格式。在这种情况下如何选择内部格式? specyfing 通道是否算作内部格式是 OpenGL > 2.1 中的错误?

Does specyfing channels count as the internal format is an error in OpenGL > 2.1 ?

是的,至少对于 Core Profile。请参阅“3.8.1 纹理图像规范”部分中的 OpenGL 3.2 (or following) Core specifications

internalformat may be specified as one of the internal format symbolic constants listed in table 3.11, as one of the sized internal format symbolic constants listed in tables 3.12- 3.13, as one of the generic compressed internal format symbolic constants listed in table 3.14, or as one of the specific compressed internal format symbolic constants (if listed in table 3.14). Specifying a value for internalformat that is not one of the above values generates the error INVALID_VALUE.

将此与同一节 3.8.1 中 the OpenGL 2.1 specification 中的附加句子进行对比(在 3.2 核心规范中被省略):

internalformat may (for backwards compatibility with the 1.0 version of the GL) also take on the integer values 1, 2, 3, and 4, which are equivalent to symbolic constants LUMINANCE, LUMINANCE ALPHA, RGB, and RGBA respectively.