Disable texture resize

Started by xDonny, November 27, 2013, 05:09:56 PM

Previous topic - Next topic

xDonny

I have 64x64 textures but it always re-sizes to 256x256 and then looks blurry when applied to my object.

EgonOlsen

jPCT-AE doesn't scale anything. There's a chance that this is done by Android itself if you load your textures from the drawable-folder, but i doubt that this will result in an exact 256*256 texture. What makes you think that the texture is 256*256?

xDonny

I'm using the raw folder in resources. I believe this because I am using 50 64x64 textures and when I filter by "texture" the log tells me that it's loading a texture that is 256x256 50 times

EgonOlsen

That's not done by the engine. Maybe you are doing it when loading them...can you post the lines that load the textures?

xDonny

for (int i = 0; i < texList.length; i++)
      {
         Bitmap temp = BitmapFactory.decodeStream(c.getResources().openRawResource(texList));
         
      preview = Bitmap.createBitmap(temp, 16, 32, 16, 16);
      Texture texture = new Texture(temp,true);
      texture.defaultToMipmapping(true);
      
      if (!TextureManager.getInstance().containsTexture(c.getResources().getResourceEntryName(texList)))
      {
         TextureManager.getInstance().addTexture(c.getResources().getResourceEntryName(texList), texture);
         TextureManager.getInstance().addTexture(c.getResources().getResourceEntryName(texList) + "preview", new Texture(preview,true));
      }
      }

EgonOlsen

Looks fine! It's actually not needed to work with Bitmaps here. You could simply use the InputStream to the image itself to load it, but that's not the point.
But as said: The engine doesn't rescale. There's not even code to do this that could have been triggered by accident.
Are you sure that your files are 64*64? Maybe they contain multiple resolutions in one file (jpg supports this albeit it's rarely used)?

xDonny

Well, I'm stumped. They're all 64x64 png's. I just wrote a script and converted them all to 256x256 so and that's what i'll make them in from now on :p Thanks

EgonOlsen

Still, it would have been nice to know what went wrong here in the first place. I really don't see how 64*64 can magically convert into 256*256 when there's not even code that can do this!? Anyway...as long as it's solved...