iPad2 problem with GL_HALF_FLOAT_OES textures?

Hi -





I’m uploading grayscale half-float textures and then rendering them in a shader. This code works well with the first generation iPad but it appears that the texture has a constant value when it’s accessed in the shader.





glTexImage2D(GL_TEXTURE_2D, 0, GL_LUMINANCE, m_width, m_height, 0, GL_LUMINANCE, GL_HALF_FLOAT_OES, (GLubyte *)[d bytes]);


          


Both iPad 1 and iPad 2 are running iOS 4.3.2.





I don’t see anything on Apple’s site that has changed in OpenGL ES - has anything changed with the hardware that would make these two machines behave differently?





Thanks

I’ve created a greyscale ramp with values from 0.0 to 4095.0 and ran it on both iPad 1 and iPad2. It appears that the values returned by texture2D() are different on the two devices:





highp float luminance0to4095 = texture2D(hero, v_st).r;





On the iPad 1 - luminance0to4095 will contain values from 0 to 4095.0. On the iPad2 - it appears they are somewhere between 2.0 and 4.0 (I believe they are constant - but I didn’t narrow it down further).





Any ideas what could cause the half-float textures to be handled differently on the different machines?

Hi there, we also had trouble rendering our GL_LUMINANCE / GL_FLOAT texture correctly on the iPad 2 whereas it worked fine with iPad 1 and iOS Simulator

Turned out the iPad 2 clips luminance values to 0.0 - 1.0, so we scaled our values down before uploading it to gpu, and then de-normalize it in the shader. Hope that helps!

Perfect! That was it. Thank you very much.


Actually - the problem was different than I originally understood. See the discussion thread on Apple’s forum:





https://devforums.apple.com/thread/97183?tstart=0





When I declared the texture as highp then I was able to use the entire range [0.0, 4095.0] just as I had on the iPad 1.