# GL\_ARB\_texture\_env\_combine MBX limitation ?

**URL:** <https://forums.imgtec.com/t/gl-arb-texture-env-combine-mbx-limitation/198>\
**Category:** PowerVR Insider\
**Created:** [December 3, 2008, 6:28pm UTC](https://forums.imgtec.com/t/gl-arb-texture-env-combine-mbx-limitation/198 "2008-12-03T18:28:26Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![xav](https://avatars.discourse-cdn.com/v4/letter/x/f1d935/32.png) [@xav](https://forums.imgtec.com/u/xav)\
**Post date:** [December 3, 2008, 6:28pm UTC](https://forums.imgtec.com/t/gl-arb-texture-env-combine-mbx-limitation/198/1 "2008-12-03T18:28:26Z")

</div>

Hi!  
  
I am experiencing difficulties when using combiners GL\_INTERPOLATE with OpenGL ES 1.1 / MBX hardware, while same code works fine on a regular OpenGL/x86 hardware.   
  
When I used the emulation x86/Linux layer from the PowerVR SDK, it says:  
“OGLESPCViewer: _WARNING_ GLES implemenation has limited support for GL\_INTERPOLATE, which OGLESPCViewer will fail to represent.”  
(Emulation and real native execution of this code fails to represent the same way in fact)  
  
I can’t find any explanation about such limitation in the avalaible documentation.  
  
Please, could you precise me what are the limitations in the OpenGLES/MBX implementation for this extension?  
  
(My code doesn’t use enhanced behaviour authorized by the crossbar extension)  
  
Thanks!  
  
Sample code follows:  
  
…  
glColor4f(texture\_back\_color.r,  
&nbsp;&nbsp;&nbsp; texture\_back\_color.g,  
&nbsp;&nbsp;&nbsp; texture\_back\_color.b,  
&nbsp;&nbsp;&nbsp; texture\_back\_color.a);  
  
// TEX UNIT 0  
// Simple Modulation  
glActiveTexture(GL\_TEXTURE0);  
glEnable(GL\_TEXTURE\_2D);  
glBindTexture(GL\_TEXTURE\_2D, texture\_id\_back);  
glClientActiveTexture(GL\_TEXTURE0);  
glEnableClientState(GL\_TEXTURE\_COORD\_ARRAY);  
glTexEnvf(GL\_TEXTURE\_ENV, GL\_TEXTURE\_ENV\_MODE, GL\_MODULATE);  
glTexCoordPointer(2, GL\_FLOAT, 0, texture\_coordinates);&nbsp;   
  
// TEX UNIT 1  
// Texture combiner : INTERPOLATE (RGB & ALPHA)  
glActiveTexture(GL\_TEXTURE1);  
glEnable(GL\_TEXTURE\_2D);  
glBindTexture(GL\_TEXTURE\_2D, texture\_id\_front);  
glClientActiveTexture(GL\_TEXTURE1);  
glEnableClientState(GL\_TEXTURE\_COORD\_ARRAY);  
glTexCoordPointer(2, GL\_FLOAT, 0, texture\_coordinates);  
  
glTexEnvf(GL\_TEXTURE\_ENV, GL\_TEXTURE\_ENV\_MODE, GL\_COMBINE);  
glTexEnvf(GL\_TEXTURE\_ENV, GL\_COMBINE\_RGB, GL\_INTERPOLATE);  
glTexEnvf(GL\_TEXTURE\_ENV, GL\_COMBINE\_ALPHA, GL\_INTERPOLATE);  
  
// RGB : interpolate -\> s0 \* s2 + s1 \* (1 - s2)  
// -\> texture\_front\_color \* texture\_front + texture\_back \* (1 - texture\_front)  
// Source 0  
glTexEnvfv(GL\_TEXTURE\_ENV, GL\_TEXTURE\_ENV\_COLOR, texture\_front\_color);  
glTexEnvf(GL\_TEXTURE\_ENV, GL\_SRC0\_RGB, GL\_CONSTANT);  
glTexEnvf(GL\_TEXTURE\_ENV, GL\_OPERAND0\_RGB, GL\_SRC\_COLOR);  
// Source 1  
glTexEnvf(GL\_TEXTURE\_ENV, GL\_SRC1\_RGB, GL\_PREVIOUS);  
glTexEnvf(GL\_TEXTURE\_ENV, GL\_OPERAND1\_RGB, GL\_SRC\_COLOR);  
// Source 2  
glTexEnvf(GL\_TEXTURE\_ENV, GL\_SRC2\_RGB, GL\_TEXTURE);  
glTexEnvf(GL\_TEXTURE\_ENV, GL\_OPERAND2\_RGB, GL\_SRC\_COLOR);  
  
// Alpha : interpolate  
// interpolate -\> s0 \* s2 + s1 \* (1 - s2)  
// -\> texture\_front\_color.a \* texture\_front.a + (texture\_back \* texture\_back\_color).a \*   
//&nbsp;&nbsp;&nbsp; (1 - texture\_front.a)  
// Source 0  
glTexEnvf(GL\_TEXTURE\_ENV, GL\_SRC0\_ALPHA, GL\_CONSTANT);  
glTexEnvf(GL\_TEXTURE\_ENV, GL\_OPERAND0\_ALPHA, GL\_SRC\_ALPHA);  
// Source 1  
glTexEnvf(GL\_TEXTURE\_ENV, GL\_SRC1\_ALPHA, GL\_PREVIOUS);  
glTexEnvf(GL\_TEXTURE\_ENV, GL\_OPERAND1\_ALPHA, GL\_SRC\_ALPHA);  
// Source 2  
glTexEnvf(GL\_TEXTURE\_ENV, GL\_SRC2\_ALPHA, GL\_TEXTURE);  
glTexEnvf(GL\_TEXTURE\_ENV, GL\_OPERAND2\_ALPHA, GL\_SRC\_ALPHA);  
  
…

---

<div class="post-metadata">

**Author:** ![xmas](https://avatars.discourse-cdn.com/v4/letter/x/958977/32.png) [@xmas](https://forums.imgtec.com/u/xmas)\
**Post date:** [December 4, 2008, 10:09am UTC](https://forums.imgtec.com/t/gl-arb-texture-env-combine-mbx-limitation/198/2 "2008-12-04T10:09:42Z")

</div>

Could you give us more details on how the results are different, and what platform you are targeting? I’m not aware of any reason the above code should fail.

---

<div class="post-metadata">

**Author:** ![xav](https://avatars.discourse-cdn.com/v4/letter/x/f1d935/32.png) [@xav](https://forums.imgtec.com/u/xav)\
**Post date:** [December 4, 2008, 1:20pm UTC](https://forums.imgtec.com/t/gl-arb-texture-env-combine-mbx-limitation/198/3 "2008-12-04T13:20:06Z")

</div>

I have resolved my problem, let me explain what happened :  
The initial code was different from the sample code I have posted here, it was using GL\_TEXTURE1 for Source alpha & color for interpolation not GL\_TEXTURE as I wrote, I changed it while I was searching a solution ( when I suspected the crossbar extension ).  
  
My first platform was on&nbsp; x86/OpenGL2.0, all the things looks right.  
Then I tried it on the target platform, an i.MX31/MBX OpenGLES 1.1. When I first tested my code directly on i.MX31/MBX the code fails to represent correctly (it seems like alpha values wasn’t treated correctly: all was opaque) due to GL\_TEXTURE1 in fact.  
  
After that, I tried it through the PowerVR SDK Emulation Layer on x86/Linux and it warns about a “GLES limitation support for GL\_INTERPOLATE”. So I tried to find the reasons for this and I replaced GL\_TEXTURE1 by GL\_TEXTURE as it was the same thing for texture unit 1… But the Emulation layer always fails to represent it and always claims about this limitation, so I did not retried it on i.MX and I thought there was a limitation for GLES as the ‘OGLESPCViewer’ says…  
  
So the ‘OGLESPCViewer’ warning message confused me, because it says that “_WARNING_ GLES implemenation has limited support for GL\_INTERPOLATE” even without using GL\_TEXTURE1…  
  
  
Thanks for your support.

---

<div class="post-metadata">

**Author:** ![xmas](https://avatars.discourse-cdn.com/v4/letter/x/958977/32.png) [@xmas](https://forums.imgtec.com/u/xmas)\
**Post date:** [December 4, 2008, 1:38pm UTC](https://forums.imgtec.com/t/gl-arb-texture-env-combine-mbx-limitation/198/4 "2008-12-04T13:38:45Z")

</div>

Glad to hear you solved the problem.  
  
  
  
  
  
It’s always a good idea to check glGetError when you get unexpected results, it helps especially with those hard-to-spot invalid enums.
