GL_ARB_texture_env_combine MBX limitation ?

This topic contains 3 replies, has 2 voices, and was last updated by  Xmas 8 years, 10 months ago.

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #29645

    Xav
    Member

    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,
        texture_back_color.g,
        texture_back_color.b,
        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); 

    // 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 *
    //    (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);

    #32532

    Xmas
    Member

    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.

    #32533

    Xav
    Member

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

    #32534

    Xmas
    Member

    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.

Viewing 4 posts - 1 through 4 (of 4 total)
You must be logged in to reply to this topic.