jeudi 11 juin 2015

Libgdx issue with RGB color not appearing correctly (glClearColor)

Hello world,

Today i'll give you a tip I found while I searching on the internet about an issue related to RGB color not displayed correctly in Libdgx.

I was searching for a nice blue background for sky in Piou with GraphicsGale and get the RGB code for it:


 So in my Java code I wrote:
Gdx.gl.glClearColor(0, 187, 249, 0);
but when I launched the game the color appears as an eye bleeding cyan:
Aaaaargh Y_Y it burns my eyes !!!!

So I searched why the blue didn't appears as it must be and I've found an answer on Stackoverflow so I modified my code with:
Gdx.gl.glClearColor(0/255f, 187/255f, 249/255f, 0);
And finally get the blue sky correctly displayed:
Fiuuuu, it's faaaaaar better :)

Hope this will help some people arround here.