Part of the Khronos Group
OpenGL.org

The Industry's Foundation for High Performance Graphics

from games to virtual reality, mobile phones to supercomputers

Results 1 to 4 of 4

Thread: Overlapping Shader Effects in Opengl ES 2.0

  1. #1
    Junior Member Newbie
    Join Date
    Jun 2012
    Posts
    11

    Overlapping Shader Effects in Opengl ES 2.0

    Is it possible to overlap shader effects in OpenGL ES 2.0? (not using FBOs)

    How to use the result of a shader with another shader without having to do a glReadPixels and push again the processed pixels?

    The next pseudo-code is what I'm trying to achieve:

    Code :
    // Push RGBA pixels into the GPU
    glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, width, height, 0, GL_RGBA, GL_UNSIGNED_BYTE, Pixels_To_Render);
     
    // Apply first shader effect
    glUseProgeam( FIRST_SHADER_HANDLE);
    glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);
     
    // Apply the second shader effect by sampling from the result of the first shader effect
    glUseProgeam( SECOND_SHADER_HANDLE );
    glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);
     
    // Get the overall result
    glReadPixels(......)

  2. #2
    Senior Member OpenGL Pro
    Join Date
    Jan 2012
    Location
    Australia
    Posts
    1,117
    It depends on what you mean by overlapping effects. If your second shader was putting a halo around the mesh it would probably work; if it was rendering something on top of the original mesh it probably would not work because of z-buffer fighting; if you are in 2D it could work by disabling depth tests.

    How to use the result of a shader with another shader without having to do a glReadPixels

    I believe you can do this in OpenGL ES 2.x but I don't program mobiles so I can't remember whether 2.x is 2.0 or later

  3. #3
    Junior Member Newbie
    Join Date
    Jun 2012
    Posts
    11
    Yes is acutally for 2 on a quad.
    I need to render a bitmap into a quad, apply a first effect, and then on the new image with the first effect, apply a second effect, producing a new image with 2 effects applied to it.

    Is for mobile devices which uses opengl 2.0 ES

  4. #4
    Senior Member OpenGL Pro
    Join Date
    Jan 2012
    Location
    Australia
    Posts
    1,117
    this extension might work for you

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •