GLGraphicsOffscreen Texture gets see-through when it shouldn't.
in
Contributed Library Questions
•
2 years ago
I just encountered a wierd problem/bug with semiTransparent Alphas on the GLGraphics OffscreenBuffer.
It seems that whenever I draw something semiTransparent, it forces everything in that spot to be semiTransparent. and make the Texture seethrough, even though we might had a background or even no transparent objects lying underneith.
here is the problem nailed down in a sketch.
Here i draw full filled rect and a semitransparent rect over each other, the region, where the semi transparent crosses the full filled one, make the full filled also semi-transparent, and we can see the ellipse underneith the textured image.
well we shouldn't actually see the circles at all, scince the OffScreenBuffer has a black .background.
Here picture and code. any ideas!?
It seems that whenever I draw something semiTransparent, it forces everything in that spot to be semiTransparent. and make the Texture seethrough, even though we might had a background or even no transparent objects lying underneith.
here is the problem nailed down in a sketch.
Here i draw full filled rect and a semitransparent rect over each other, the region, where the semi transparent crosses the full filled one, make the full filled also semi-transparent, and we can see the ellipse underneith the textured image.
well we shouldn't actually see the circles at all, scince the OffScreenBuffer has a black .background.
Here picture and code. any ideas!?
-
import processing.opengl.*;
import codeanticode.glgraphics.*;
GLGraphicsOffScreen glg2;
void setup() {
size(640, 480, GLConstants.GLGRAPHICS);
// Creating an off-screen drawing surfaces. The first one has
// 4x multi-sampling enabled.
glg2 = new GLGraphicsOffScreen(this, 200, 100);
}
void draw() {
background(0);
// In the off-screen surface 2, we draw random rectangles.
glg2.beginDraw();
glg2.noStroke();
glg2.rectMode(CENTER);
glg2.background(0);
glg2.fill(20, 50, 230, 255);
glg2.rect(glg2.width/2,glg2.height/2,glg2.width/3,glg2.height);
glg2.fill(20, 250, 0, 50);
glg2.rect(glg2.width/2,glg2.height/2,glg2.width,glg2.height/3);
glg2.endDraw();
fill(255);
ellipseMode(CENTER);
ellipse(width/2,height/2,400,400);
ellipse(width/2,height/2,100,100);
image(glg2.getTexture(), 10, 10, width - 20, height - 20);
}
1