   Texture format woes
  When I attempt to initialise a one-component, 16-bpc texture (internal format GL_LUMINANCE16), I end up with one that uses only 8 bits per channel. Filling the texture with 0.5, and then reading texels back as unsigned shorts with glReadPixels, gives me a value of 32639 for each texel. This is the value I would expect at 8-bit precision (65535*floor(0.5*255)/255=32639) - for 16 bits, I should get 32767.I get the same problem if I use a two-component internal format (GL_LUMINANCE16_ALPHA16). However, GL_RGBA16 works as expected: in that case, I get 16 bits per channel.The obvious conclusion would seem to be that GL_LUMINANCE16 and GL_LUMINANCE16_ALPHA16 are unsupported, and the GL is invisibly falling back to 8 bpc. However, my Geforce 8800 GTS does support these formats according to Nvidia's own chart. Also, if I actually specify GL_LUMINANCE8_ALPHA8, texture access slows down massively compared to GL_LUMINANCE16_ALPHA16, suggesting these formats aren't internally equivalent.I installed the latest official drivers, but that hasn't fixed it. Any ideas?   
  I do not see how this should matter...But are you using the same sign GL_UNSIGNED_SHORT when you create the texture and then you read back..?;Quote:Original post by mrrI do not see how this should matter...But are you using the same sign GL_UNSIGNED_SHORT when you create the texture and then you read back..?Not sure exactly what you mean. I initialise the buffer like this:glTexImage2D(GL_TEXTURE_2D, 0, GL_LUMINANCE16, 1024, 1024, 0, GL_LUMINANCE, GL_UNSIGNED_SHORT, NULL);And read back like this:GLushort pixel;glReadPixels(0, 0, 1, 1, GL_LUMINANCE, GL_UNSIGNED_SHORT, &pixel);;  What value did you use for pixel packing? Are you just using the default?   ;  glReadPixels?What are you render to? Are you render to the texture? FBO?   ;  I use the default pixel packing, yes.The texture is attached to an FBO. I've tried both clearing it with glClear and writing to it with a fragment shader - in both cases, values seem to be stored with 8-bit rather than 16-bit precision.   ;  I don't know for sure what the behavior is in OpenGL, but in DirectX you don't get any texture formats with only 16 bits per pixel out of an NVidia card. For example: one channel 16bit integer does not work. I have to use a two-channel 16bit integer format so that a texel is at least 32 bits wide before I'm allowed to render into it. On an NVidia card, that is. ATI has no problems with those. And this restriction only applies to render targets, static textures which are only read from in the GPU are fine.So here's my guess: try to enhance your texture to two channels of 16bit each. And beware: NVidia does not support any blending or filtering on integer textures.   ;Quote:Original post by SchrompfI don't know for sure what the behavior is in OpenGL, but in DirectX you don't get any texture formats with only 16 bits per pixel out of an NVidia card. For example: one channel 16bit integer does not work. I have to use a two-channel 16bit integer format so that a texel is at least 32 bits wide before I'm allowed to render into it. On an NVidia card, that is. ATI has no problems with those. And this restriction only applies to render targets, static textures which are only read from in the GPU are fine.So here's my guess: try to enhance your texture to two channels of 16bit each. And beware: NVidia does not support any blending or filtering on integer textures.As mentioned, I already tried two 16-bit channels (internal format GL_LUMINANCE16_ALPHA16). Same problem - it acts as if it has 8-bit channels.   