PDA

View Full Version : Loading textures like 1:5:5:5 directly



GeorgeSarkisyan
04-09-2003, 03:53 AM
Hi!

On the one hand we have DDS format that supports textures like 1:5:5:5, 0:5:5:5,
5:6:5, 4:4:4:4
on the other hand we have corresponding OpenGL internal formats like GL_RGB5_A1, GL_RGB5, GL_RGBA4.

So why couldn't we load directly say 16 bits 1:5:5:5 to GL_RGB5_A1 and have to convert the data to GL_RGBA consisting of GL_UNSIGNED_BYTE's instead, that then would be converted by driver to internal GL_RGB5_A1

Or I've missed some appropriate extensions?

Thanks.

zeckensack
04-09-2003, 04:55 AM
You're looking for this?


glTexImage2D(GL_TEXTURE_2D,level,GL_RGB5_A1,level_ width,level_height,0,GL_BGRA_EXT,GL_UNSIGNED_SHORT _5_5_5_1_REV,data);
Try unpack byte swapping, if it doesn't work right away.

Note that this doesn't work if you build mipmaps through the glu (glu is simply too old).


edit:
This requires EXT_packed_pixels. Fortunately every card I've ever seen supports this one.


[This message has been edited by zeckensack (edited 04-09-2003).]

Bob
04-09-2003, 06:42 AM
EXT_packed_pixels is a core feature since OpenGL 1.2.

GeorgeSarkisyan
04-09-2003, 08:23 AM
Thanks.

It's exactly that I need.