Hot answers tagged

3

The texture regions inside don't need to be powers of two. But texture compression cells are often 4x4 so you have to be careful when using compressed textures that the edges of two texture regions don't share the same cell or they'll be compressed together which will degrade the quality if they have different colors. You should leave a N pixel border ...


2

As suggested in the comments, you should try to use Tri-Linear filtering and MipMaps. The reason using TextureFilter.MipMapLinearLinear results in a black box is that you haven't generated the texture with MipMaps. In order to do so, simply pass a second parameter to the Texture constructor as true like so: img = new Texture("circle.png", true);


2

You shouldn't call dispose directly on a Texture loaded by an AssetManager, they are disposed the the AssetManager is cleared or disposed or if you call unload on the AssetManager and pass the Texture. The reason you shouldn't dispose assets from an AssetManager is that they can be shared between many other assets (two fonts may use the same texture for ...


2

I know it's stupid to answer my own question but... With very, very big thanks to @Ben I fixed this problem by creating SDL_Surface and load image to it once for each TextureAsset and store it inside TextureAsset instead of creating new SDL_Surface for same texture and free it each draw call.


1

So here's the deal with 9 patches (or as @hamza-hasan called them in the comments "9 slice scaling"). Either way the concept the same. The concept is pretty simple. Slice your source image up into 9 sections as shown in the image below. For reference I've drawn 4 red lines to represent how the texture might be sliced up to create the 9 patches. I've also ...


1

You would need to convert your texture into a rectangle, which is just a position and size. Your entity that is displaying the texture, should have the position, and the texture itself could potentially hold the size (this is completely dependent on how you are currently doing your spritebatch draw calls). It would end up looking something like: Dim ...


1

I would say Edge padding. (Even if you have disabled MipMaps) If the ‘gutters’ (blank areas between UV’s) have colors/transparencies that are very different from the colors inside the UV’d areas, then those colors can ‘bleed’ together which creates seams on the model. This problem will also occur when neighbouring UV shells have different colors; as the ...


1

I don't know if this could help you, but this is everything I do for good MipMapping: public int loadTexture(String fileName){ Texture texture = null; try { texture = TextureLoader.getTexture("PNG", new FileInputStream("res/textures/"+fileName+".png")); GL30.glGenerateMipmap(GL11.GL_TEXTURE_2D); //I preffer LINEAR_MIPMAP because ...



Only top voted, non community-wiki answers of a minimum length are eligible