   glTexImage2D and 16bit color on Windows XP
  I am attempting to write some texture creation code that will take a bitmap obtained from a Windows drawing context, and use it as a source bitmap for an OpenGL texture using the standard glTexImage2D call.  Therein lies the problem.  The library I am using on Windows to create and manipulate the bitmap has a bug in it.  The pixel map depth is being created by creating a compatible bitmap to whatever the main display is set to.  So even if I ask for a 32 bit depth bitmap, if the display is set to 16 bits, that is what I get back.  I am awaiting the library developer to fix this issue, but in the meanwhile, or in the eventuality that I am not going to be able to code around this, I need an alternative solution.If the pixel map is 32 bits, making the texture is simply a matter of the following:glTexImage2D( GL_TEXTURE_2D,0,GL_RGBA,width,height,0,GL_BGRA_EXT,GL_UNSIGNED_BYTE,textureBytes);This works great.All attempts to get glTexImage2D to work with 16 bit source images have thus far failed.  What's the trick?Thanks,Skip   
  I think the best way would be to convert it manually.  There is a 'GL_RGBA4' specification for the internal format but not the incoming format.Alternatively have a look at specifing GL_COLOR_INDEX for the input format and remapping the data using glPixelTransferi.  I have not worked with these functions but from a quick look at the specs they should be able to do what you want.Hope that helps;  Try some combinations of GL_BGRA or GL_RGBA for format and GL_UNSIGNED_SHORT_4_4_4_4 or GL_UNSIGNED_SHORT_4_4_4_4_REV for type.   ;  As a bit of clarification, it would appear that the incoming bitmap format is 5_5_5_1.  Can someone post some sample code showing how I would set up the glTexImage2D to use this format?  It is also in Windows/Intel byte ordering, so for example a white pixel represented as two bytes appears with the first byte being 0xff, and the second byte being 0x7f.  I have tried various attempts but am not seeing anything on the screen.  I go in and manually set that high bit as I want it to represent the alpha channel.  I have tried the followingglTexImage2D( GL_TEXTURE_2D, 0, GL_RGBA, width, height, 0, GL_BGRA, GL_UNSIGNED_SHORT_5_5_5_1, pixels );I have also tried this with GL_UNSIGNED_SHORT_1_5_5_5_REV.The texture creation call does not cause an error.   ;  What do you mean by "not seeing anything on the screen"? Do you literally mean NOTHING appears on the screen? Then that indicates that something other that just the texturing is wrong. For example, if the texture isn't created, you may end up with a white surface (a common result) instead of a textured surface. But at least you get something, just no texture on it.I cannot tell you exactly what the parameters should look like because you haven't specified the exact location of each color channel in a 16-bit integer. If you specify that I could tell you what combination of parameters you should use.But assuming B in bits 0-4, G in 5-9, R in 10-15 and A in 16, and assuming little endian byte order, the correct combination of parameters appears to be GL_BGRA and GL_UNSIGNED_SHORT_1_5_5_5_REV.And I believe you also have to specify little endian byte order, as OpenGL assumes big endian byte order by default; glPixelStorei(GL_UNPACK_SWAP_BYTES, GL_TRUE). Never mind, default byte order is the native platform order, so it should be OK.   ;  Hey there.  I don't see the texture mapped on the surface.  The rest of the drawing is fine.  If I do this with 32 bit pixel maps, life is good.  16 bit, not so good... no texture on the surface.  I would have expected to at least have gotten a texture of some sort, but with the colors screwed up.  No such luck.I will try your suggestion.  That is the combination I thought would have worked as well.;  Hey there.  I don't see the texture mapped on the surface.  The rest of the drawing is fine.  If I do this with 32 bit pixel maps, life is good.  16 bit, not so good... no texture on the surface.  I would have expected to at least have gotten a texture of some sort, but with the colors screwed up.  No such luck.I will try your suggestion.  That is the combination I thought would have worked as well.