www.jpct.net

jPCT-AE - a 3d engine for Android => Support => Topic started by: xDonny on November 27, 2013, 05:09:56 pm

Title: Disable texture resize
Post by: xDonny on November 27, 2013, 05:09:56 pm
I have 64x64 textures but it always re-sizes to 256x256 and then looks blurry when applied to my object.
Title: Re: Disable texture resize
Post by: EgonOlsen on November 27, 2013, 07:29:33 pm
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?
Title: Re: Disable texture resize
Post by: xDonny on November 27, 2013, 08:11:03 pm
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
Title: Re: Disable texture resize
Post by: EgonOlsen on November 27, 2013, 08:52:53 pm
That's not done by the engine. Maybe you are doing it when loading them...can you post the lines that load the textures?
Title: Re: Disable texture resize
Post by: xDonny on November 27, 2013, 09:20:21 pm
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));
      }
      }
Title: Re: Disable texture resize
Post by: EgonOlsen on November 27, 2013, 09:37:53 pm
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)?
Title: Re: Disable texture resize
Post by: xDonny on November 27, 2013, 11:49:52 pm
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
Title: Re: Disable texture resize
Post by: EgonOlsen on November 28, 2013, 08:01:16 am
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...