- April 20, 2011 at 10:30 pm #30508
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?
ThanksApril 21, 2011 at 5:39 pm #34871
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?April 24, 2011 at 9:39 am #34872
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!May 20, 2011 at 5:36 pm #34874