'glTexImage2D - channels count as the internal format

OpenGL 2.1 documentation says that glTexImage2D accepts channels count as the internal format. How does choosing the internal format work in such scenario ? Does specyfing channels count as the internal format is an error in OpenGL > 2.1 ?



Solution 1:[1]

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

Yes, for Core Profile at least. See OpenGL 3.2 (or following) Core specifications in section "3.8.1 Texture Image Specification"

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.

Contrast this with the additional sentence in the OpenGL 2.1 specification in that same section 3.8.1 (which is omitted in the 3.2 core specification):

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.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 httpdigest