2
\$\begingroup\$

As it states, my RGBA values aren't coming out the way I want it to be. My RBGBA values are As it states, I am trying to create a orange tinted color on my game.

221, 189, 98, 0.7

I am using a ShapRenderer called tint, and here is the code:

ShapRenderer tint = new ShapRenderer();
tint.begin(ShapeType.Fill);
tint.setColor(221, 189, 98, 0.4f);
tint.rect(0, 0, Gdx.graphics.getWidth(), Gdx.graphics.getHeight());
tint.end();

I had tried this out in CSS, and it came out with the correct color. But with LibGDX, the game screen is plain white. The opacity (rgb 'A' value) does not have any affect on the tint color.

\$\endgroup\$

1 Answer 1

2
\$\begingroup\$

You must use floats between 1 and 0 in the setColor method, so you can just divide the numbers you're already using by 255f. To make the color transparent you need to enable blending like this: Gdx.gl.glEnable(GL20.GL_BLEND); And set the glClearColor to Gdx.gl.glClearColor(0, 0, 0, 0);

\$\endgroup\$

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .