Note that there are some explanatory texts on larger screens.

plurals
  1. POOpenglES blending particles but not background
    text
    copied!<p>I have the next process:</p> <pre><code> - draw background - draw objects and blend with background (1)GL10.GL_SRC_ALPHA, GL10.GL_ONE_MINUS_SRC_ALPHA - draw particle effect with blending (2)GL10.GL_SRC_ALPHA, GL10.GL_ONE in order to highlight overlapping particles </code></pre> <p>Problem - when I draw particle they are additionally blended with background and becomes very bright. </p> <p>Simply what I need is to blend particles with (2) and than all together to blend with background using (1).</p> <p>Not working solutions: </p> <ul> <li>Drawing effect to a texture and than applying it works fine...but extremely slow. </li> <li>Drawing particle effect first and than background, it look ok...but I can not draw scene object than because they need to be between bg and effect</li> </ul> <p>Here is screen to show the difference. On the right desired result, on the left particles are blended with background.</p> <p>img: </p> <p><img src="https://i.stack.imgur.com/h5K3K.png" alt="enter image description here"></p> <p>I will appreciate any help...</p> <p><strong>Latest Updates:</strong> I was able to get the color I want...but... (Seems this way will move me nowhere) I have rendered background with alpha = 0 and than use blend Function from GL11Ext: glBlendFuncSeparate(GL10.GL_SRC_ALPHA, GL10.GL_DST_ALPHA, GL10.GL_ONE, GL10.GL_ONE);</p> <p>GL10.GL_SRC_ALPHA, GL10.GL_DST_ALPHA - the colors are blended only if they have alpha(bg dont have now)</p> <p>GL10.GL_ONE, GL10.GL_ONE - alpha is set to maximum for all written particles to simulate additive blending</p> <p><img src="https://i.stack.imgur.com/hN1Yn.png" alt="enter image description here"></p> <p>It works fine as you can see...except the black color filling area where particles image has alpha 0..and whats bad that in result image that black color has alpha 1 so I can not replace it in any way...</p> <p><strong>EDIT_2</strong> General problem in simple words: I need to draw a red(0xff0000) glowing(additive blending) effect. On black background it is ok, but if I would take green(0x00ff00) than the result color would be close to 0xffff00</p> <p>Any ideas?</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload