I'm joyous of GLGraphics library abilities, and I'm playing with it arroud free-hand painting. I use GLGraphicsOffScreen to store my painting and apply brush, than I image() the texture onto the screen before painting of GUI.
The problem is when I want to paint with alpha-blended brush into my offscreen. The texture of entire offscreen become transparent and do not cover the backgroud of the window.
For example:
Code:
import processing.opengl.*;
import codeanticode.glgraphics.*;
import codeanticode.protablet.*;
GLGraphicsOffScreen L1;
void setup()
{
size(1000, 600, GLConstants.GLGRAPHICS);
L1 = new GLGraphicsOffScreen(this, width, height, true, 4);
L1.beginDraw();
L1.background(128,255);
L1.noStroke();
// simulate my painting with non-100% papacity of brush
L1.fill(0,0,0,128);
L1.ellipse(100,100,50,50);
L1.endDraw();
//make some strips to see the problem
background(255,255);
stroke(0);
for(int i=0;i<width;i+=10){
line(i,0,i,height);
};
image(L1.getTexture(), 0, 0, width, height);
// Ops, theres a hole :(
}
How can I render my brush with alpha blending into offscreen, but not to change alpha-channel. I want 100%-opaque offscreen texture, and just alpha-blend something onto it (like Flow in photoshop).
it means alpha-channel of the painting should not be replaced by alpha-channel of brush (like ellipse in example) bud rather should build-up additively.
If I have 100%-transparent (alpha=0) offscreen texture at the beginning, I wan't each alpha-blended ellipse() to increase alpha by its the A in fill(R,G,B,A);
Naturaly I'd like to use as much of standard rendering tools of processing (like ellipse, line, quad ... ) as possible. I don't want to do any per-pixel operation if not necessary;