Libgdx sprite not in browser

This is the first time I am trying to deploy libgdx game in html but with some difficulty.

Everything works fine on the desktop, but my two sprites don't appear in the browser, the rest is fine.

These two sprites should be in the background and scroll as to why the character is moving.

I load my textures in the show method of the GameScree class like this:

backgroundTexture = new Texture(Gdx.files.internal("background.png"));

//setting wraping to repeat to achive scrolling background by one texture
backgroundTexture.setWrap(Texture.TextureWrap.Repeat, Texture.TextureWrap.Repeat);

//and I render it like this (I create a Sprite of it)
batch.draw(backgroundSprite.getTexture(),0,0, (int) position ,0, 1280, 720);

      

As the position is increased, the background scrolls, which works great on the desktop.

I got errors in chromes console:

[. Offscreen-For-WebGL-00000000071AC350] RENDER WARNING: The texture bound to texture unit 0 is not renderable. It might be non-power-of-2 and have incompatible texture filtering.

What I don't quite understand, why, how is it incompatible? Also, none of my textures are POT, but they still work.

+3


source to share


1 answer


You should avoid using mipmaps when the texture is not 2.

backgroundTexture.setFilter(Texture.TextureFilter.Linear, Texture.TextureFilter.Linear);

      



Better to use texture at power 2 (pixel width and height are multiple n values )

+1


source







All Articles