double check that alpha works correctly #12
Comments
(use case: http://i.imgur.com/mp79p5T.png over http://i.imgur.com/S22HNaU.png ) - **the 2 top results are right**: transparent `` (so native UIImage) over the rainbow _(both tested using an UIImage (left) & a GLKView (right))_ - **the 2 bottom results are wrong**: transparent GLKView over the rainbow.the alpha seems to combine in a non linear way using a GLKView on top of anything. currently using this formula: glEnable(GL_BLEND);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); is there something wrong here? |
blending should not be enabled during fbo drawings glDisable(GL_BLEND);
recDraw(_renderData);
glEnable(GL_BLEND);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); my guess is otherwise blending will accumulates during last bindFramebuffer ( null ) |
glBlendFuncSeparate(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA, GL_ONE, GL_ONE_MINUS_SRC_ALPHA);
glClearColor(0.0, 0.0, 0.0, 0.0);
glClear(GL_COLOR_BUFFER_BIT);
glBlendFunc(GL_ONE, GL_ONE_MINUS_SRC_ALPHA);
glDrawArrays(GL_TRIANGLES, 0, 6); this is a complex problem. not sure about the final solution yet. For now it works but all shaders MUST be premultiplied alpha... |
there is now a if (renderData.premultipliedAlpha)
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
else
glBlendFunc(GL_ONE, GL_ONE_MINUS_SRC_ALPHA); now i'm not super happy with this and especially in the gl-react WebGL implementation, it seems to not work in Safari.. Still looking for a better solution |
basically it seems the problem fundamentally exists because textures loaded are automatically preloaded. because |
I think something is weird with alpha in gl-react-native.
We need to make a test proof example that alpha works correctly (draw a linear black opacity=100% to black opacity=0% over an image, same with white. compare with the same effect done with gimp also do the same on gl-react side).
The text was updated successfully, but these errors were encountered: