Closed EugenPolyakov closed 2 years ago
OpengGL 1.3 specification
Table 3.5: DrawPixels and ReadPixels type parameter values and the corresponding GL data types
And extensions EXT_read_format_bgra, IMG_read_format
Accepted by the <format> parameter of ReadPixels:
GL_BGRA_EXT 0x80E1
Accepted by the <type> parameter of ReadPixels:
GL_UNSIGNED_SHORT_4_4_4_4_REV_EXT 0x8365
GL_UNSIGNED_SHORT_1_5_5_5_REV_EXT 0x8366
glTexImage2D
also takes all of GL_UNSIGNED_BYTE_2_3_3_REV, GL_UNSIGNED_SHORT_5_6_5, GL_UNSIGNED_SHORT_5_6_5_REV, GL_UNSIGNED_SHORT_4_4_4_4_REV, GL_UNSIGNED_SHORT_1_5_5_5_REV, GL_UNSIGNED_INT_8_8_8_8_REV, GL_UNSIGNED_INT_2_10_10_10_REV so those should definitely be added to the PixelType
enum.
For the other enums, the limited groups are here again. Adding GL_BGRA_EXT
to the PixelType
group could imply that it's possible to call glTexImage2D
with GL_BGRA_EXT
. This is an issue with the current group system, and until something is done about it this problem is going to continue to exist.
I've been thinking of writing up a "plan" for having the community fix the enum groups and make it "stable" (as in, no breaking changes).
As I've not written this proposal yet, I'm fine with this PR as it is. It's good to get some of those missing formats into PixelType
.
Yes some PixelType can't be used in glTexImage2D
but GL_BGRA_EXT
(included as GL_BGRA
in OpenGL 1.2) not in exception (OpenGL 1.3):
format, type, and data match the corresponding arguments to DrawPixels (refer to
section 3.6.4); they specify the format of the image data, the type of those data,
and a pointer to the image data in host memory. The formats STENCIL_INDEX and
DEPTH_COMPONENT are not allowed.
DrawPixels has same formats as ReadPixels:
Table 3.6: DrawPixels and ReadPixels formats.
Oh @EugenPolyakov, sorry. I read what you had done wrong. Didn't see that PixelType and PixelFormat where different.
In that case I have no issues with this PR!
@oddhack, this is approved to merge.
Fix enum groups (added PixelType) for GL_UNSIGNED_BYTE_2_3_3_REV, GL_UNSIGNED_BYTE_2_3_3_REV_EXT, GL_UNSIGNED_SHORT_5_6_5, GL_UNSIGNED_SHORT_5_6_5_EXT, GL_UNSIGNED_SHORT_5_6_5_REV, GL_UNSIGNED_SHORT_5_6_5_REV_EXT, GL_UNSIGNED_SHORT_4_4_4_4_REV, GL_UNSIGNED_SHORT_4_4_4_4_REV_EXT, GL_UNSIGNED_SHORT_4_4_4_4_REV_IMG, GL_UNSIGNED_SHORT_1_5_5_5_REV, GL_UNSIGNED_SHORT_1_5_5_5_REV_EXT, GL_UNSIGNED_INT_8_8_8_8_REV, GL_UNSIGNED_INT_8_8_8_8_REV_EXT, GL_UNSIGNED_INT_2_10_10_10_REV, GL_UNSIGNED_INT_2_10_10_10_REV_EXT
Fix enum groups (added PixelFormat) for GL_BGR_EXT, GL_BGRA_EXT, GL_BGRA_IMG