# iPad2 problem with GL\_HALF\_FLOAT\_OES textures?

**URL:** <https://forums.imgtec.com/t/ipad2-problem-with-gl-half-float-oes-textures/1061>\
**Category:** PowerVR Insider\
**Created:** [April 20, 2011, 8:30pm UTC](https://forums.imgtec.com/t/ipad2-problem-with-gl-half-float-oes-textures/1061 "2011-04-20T20:30:38Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![seandoyle](https://avatars.discourse-cdn.com/v4/letter/s/2acd7d/32.png) [@seandoyle](https://forums.imgtec.com/u/seandoyle)\
**Post date:** [April 20, 2011, 8:30pm UTC](https://forums.imgtec.com/t/ipad2-problem-with-gl-half-float-oes-textures/1061/1 "2011-04-20T20:30:38Z")

</div>

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]);  
  
  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;  
  
  
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

---

<div class="post-metadata">

**Author:** ![seandoyle](https://avatars.discourse-cdn.com/v4/letter/s/2acd7d/32.png) [@seandoyle](https://forums.imgtec.com/u/seandoyle)\
**Post date:** [April 21, 2011, 3:39pm UTC](https://forums.imgtec.com/t/ipad2-problem-with-gl-half-float-oes-textures/1061/2 "2011-04-21T15:39:05Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![zai](https://avatars.discourse-cdn.com/v4/letter/z/d9b06d/32.png) [@zai](https://forums.imgtec.com/u/zai)\
**Post date:** [April 24, 2011, 7:39am UTC](https://forums.imgtec.com/t/ipad2-problem-with-gl-half-float-oes-textures/1061/3 "2011-04-24T07:39:51Z")

</div>

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!

---

<div class="post-metadata">

**Author:** ![seandoyle](https://avatars.discourse-cdn.com/v4/letter/s/2acd7d/32.png) [@seandoyle](https://forums.imgtec.com/u/seandoyle)\
**Post date:** [April 24, 2011, 12:38pm UTC](https://forums.imgtec.com/t/ipad2-problem-with-gl-half-float-oes-textures/1061/4 "2011-04-24T12:38:36Z")

</div>

Perfect! That was it. Thank you very much.

---

<div class="post-metadata">

**Author:** ![seandoyle](https://avatars.discourse-cdn.com/v4/letter/s/2acd7d/32.png) [@seandoyle](https://forums.imgtec.com/u/seandoyle)\
**Post date:** [May 20, 2011, 3:36pm UTC](https://forums.imgtec.com/t/ipad2-problem-with-gl-half-float-oes-textures/1061/5 "2011-05-20T15:36:48Z")

</div>

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](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.
