PDA

View Full Version : HELP - 16bit(565) Texture Mapping...



bmcclint
08-14-2001, 07:21 AM
HELP...I am lost...I am trying to figure out if I can use 16bit texture with OpenGL. Everything I read says I can but I am getting no where.

I have texture mapping working but I have to convert all the textures to 24bit(888) format using GL_RGB/GL_UNSIGNED_BYTE as paramters and this all works well.

glTexImage2D(GL_TEXTURE_2D,
0, /* Number of MipMap Levels */
3, /* Blending components */
GL_Texture->x, /* Texture Dimentions */
GL_Texture->y,
0, /* Border Width */
GL_RGB, /* GL_RGB, GL_RGBA, etc... pg. 265 */
GL_UNSIGNED_BYTE, /* Bytes per pixel format */
&GL_Texture->data);

I have tried GL_UNSIGNED_SHORT_5_6_5 as the data type also tried GL_RGB5_A1 ands other combinations but nothing...Anyone have any ideas?

I will also have a need for color index textures but have yet to even attempt that one. I would like to get the 16bit working first but would also appreciate suggestions there...

Thanks in advance...
Bill

DFrey
08-14-2001, 12:25 PM
Try the following:

glTexImage2D(GL_TEXTURE_2D,
0, /* Number of MipMap Levels */
GL_RGB8, /* internal format, GL_RGB5 would save some memory*/
GL_Texture->x, /* Texture Dimentions */
GL_Texture->y,
0, /* Border Width */
GL_RGB, /* data format */
GL_UNSIGNED_SHORT_5_6_5, /* type */
&GL_Texture->data);

bmcclint
08-14-2001, 12:57 PM
Not working...I have tried this before...I can see the image when I use GL_RGB & GL_UNSIGNED_SHORT but it is scaled wrong (really small, I think it is still looking for 3 bytes per texel) When I use GL_UNSIGNED_SHORT_5_6_5 I get a strange color pattern, which tells me its reading different(possible 2 bytes per texel), I'll try reviewing the compelte source and see if I missed someting else,,,

Thanks though...Appreciate the response...Atleast this tells me It can be done...


Originally posted by DFrey:
Try the following:

glTexImage2D(GL_TEXTURE_2D,
0, /* Number of MipMap Levels */
GL_RGB8, /* internal format, GL_RGB5 would save some memory*/
GL_Texture->x, /* Texture Dimentions */
GL_Texture->y,
0, /* Border Width */
GL_RGB, /* data format */
GL_UNSIGNED_SHORT_5_6_5, /* type */
&GL_Texture->data);

DFrey
08-14-2001, 01:52 PM
Check your pixel unpacking settings. Also, you are using OpenGL 1.2 correct?

bmcclint
08-15-2001, 06:44 AM
the above did work at home. The office libGL might be wrong/bad. Will need to do more research here to determinie what GL software libs are here. At home I have GeForce2 and stock drivers and all is well...

THX


Originally posted by DFrey:
Check your pixel unpacking settings. Also, you are using OpenGL 1.2 correct?