I am trying to draw a frame with two textures within Libgdx. My texture is just a white square that i scale and draw with SpriteBatch to the screen. The color is set with batch.setColor()
. Now I want to draw a black rectangle and a smaller opaque rectangle in the middle, so it looks like a frame.
batch.begin();
batch.setColor(new Color(0,0,0,1)); //Black
batch.draw(rectangle, 0,0,100,100);
batch.setColor(new Color(0,0,0,0)); //Transparent
batch.draw(rectangle, 25,25,50,50);
batch.end();
I am using this blend function:Gdx.gl.glBlendFunc(GL_ONE_MINUS_SRC_ALPHA, GL_ONE_MINUS_SRC_COLOR);
the problem now is when i draw this it just shows the black rectangle cause the transparent rectangle is drawn on top of it. I want to draw it that I can see through the second rectangle the stuff I drawed before so it acts like a frame.
My question is: How can i accomplish this?