   16 bit textures
  Hi, I'm loading a texture image which is a 16 bit greyscale image, with actual values between 0 and 255. glTexImage2D(GL_TEXTURE_2D, 0, GL_LUMINANCE16, pImage->Width(), pImage->Length(), 0, GL_LUMINANCE, GL_UNSIGNED_SHORT, pImage->GetPtr(0)); The texture simply appears black when drawn. I believe this is because the values are so low (0-255) compared to what the data type can hold (0-65535). So, I've tried setting the scale values before the call to glTextImage2D:glPixelTransferf(GL_RED_SCALE, 256.0f);glPixelTransferf(GL_GREEN_SCALE, 256.0f);glPixelTransferf(GL_BLUE_SCALE, 256.0f);Still appears black. Any ideas where I might be going wrong? Do I understand the function of the scaling parameters correctly?Thanks,WF   
  Why not just scale whatever is in pImage->GetPtr(0) yourself?   ;Quote:Original post by WeedfinHi, I'm loading a texture image which is a 16 bit greyscale image, with actual values between 0 and 255. In that case are you sure that values are meant to be taken as 16-bits for luminance ? Isn't that for example 8 bits for luminance and 8 for alpha ? If that's the case you can simply change the glTexImage call to " .. GL_LUMINANCE_ALPHA, GL_UNSIGNED_BYTE .."   ;  I'm not entirely sure about this, but if you do not need a 16-bit greyscale texture and all the values really are in the range of 0-255, then you could simply call:glTexImage2D(GL_TEXTURE_2D, 0, GL_LUMINANCE, pImage->Width(), pImage->Length(), 0, GL_LUMINANCE, GL_UNSIGNED_SHORT, pImage->GetPtr(0));Again, I'm not sure, but the 16 bits might be cast to 8 bits internally.   ;Quote:Original post by IgnifexI'm not entirely sure about this, but if you do not need a 16-bit greyscale texture and all the values really are in the range of 0-255, then you could simply call:*** Source Snippet Removed ***Again, I'm not sure, but the 16 bits might be cast to 8 bits internally.That's interesting, I wasn't sure exactly how that parameter works. I thought it would be safe to use a larger value, but if my input values are truly only between 0 and 255, I could probably save some room on the graphics card by using GL_LUMINANCE8. WF   ;Quote:Original post by V-manWhy not just scale whatever is in pImage->GetPtr(0) yourself?Well, I was using gluBuild2DMipMaps, and someone pointed out the link gluBuild2DMipmaps, which explains the process is done on the CPU, and to use glTexImage2D instead.Using glTexImage2D does it on the graphics card, apparently, which would probably be faster than scaling the image my self. I'm not sure of exactly what portions of the texture building process happen on the card and off the card, though (specifically scaling).WF;  A grayscale image only has one channel so the scaling wouldn't work per se. I don't know which channel is used to store the luminance value. Internally the values used by the pipline are normalize [0.0f,1.0f] so scaling by 255 would not work let see why. A 16bit luminance texture expect values from 0 to 2^16, therefore all incoming values and divided by 2^16 to normalize them and the clamped to the 0 to 1 range so  (colorvalue * 255)/2^16 will still give you a really small value, almost 0. Your best bet is to use a 8-bit luminance texture and save memory or convert the values to 16bit luminance.   