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:
// 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(......)
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
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
this extensionmight work for you