My program need to display RGB555 format image that’s captured from a card,the “RGB555” format uses the following memory layout :
High-order byte: Low-order byte:
X R R R R R G G G G G B B B B B
X = Don’t care, R = Red, G = Green, B = Blue
I don’t know whether current version OpenGL support the image format or not,if not,I had to convert it to GL_BGR format before upload it to texture,so does OpenGL support it?
I believe you’re looking for
GL_BGRA format with GL_UNSIGNED_SHORT_1_5_5_5_REV data type
Thanks Nico,I had tried the “GL_UNSIGNED_SHORT_1_5_5_5_REV” data type,it is the format I want,but the performance is poor,I think the OpenGL driver may convert “GL_UNSIGNED_SHORT_1_5_5_5_REV” type to “GL_UNSIGNED_BYTE” in CPU,and then upload to texture,so is it possible to convert “GL_UNSIGNED_SHORT_1_5_5_5_REV” in GPU,what I said means I upload my RGB555 image as GL_BGRA format with GL_UNSIGNED_BYTE,and the use a pixel shader to convert the RGB555 image to RGBA32,is it possible?
Ow, I’m sorry. I forgot to mention the internal format. So
internal format = GL_RGB5_A1
format = GL_BGRA
data type = GL_UNSIGNED_SHORT_1_5_5_5_REV
PS. Why would you need to convert it to an RGBA32F? You won’t get any more accuracy because of it.