Author Topic: Texture 1024^2 vs 512^2  (Read 3657 times)

Offline icarusfactor

  • int
  • **
  • Posts: 58
    • View Profile
Texture 1024^2 vs 512^2
« on: February 13, 2011, 09:22:13 pm »
I had a problem with a 512^2 Texture and loading it to the frame buffer. It would draw the image skinny and twice or repeat Xx2 and Yx1.

I fixed it by making the image 1024^2 and scaling it down to the frame buffer how I wanted. but was wondering what the quirk was of this if any, will just use the 1024^2 image since it will do all I want, just wanted to post this in case it is a bug with Textures.

               Bitmap image = Bitmap.createBitmap( 512, 512, Bitmap.Config.ARGB_4444 );


....

               Bitmap immutable_imagebg = BitmapFactory.decodeResource(getResources(), R.drawable.elements_background );
               image = immutable_imagebg.copy(Bitmap.Config.ARGB_4444, true);
               Texture backpage = new Texture( image, true  );
               TextureManager.getInstance().addTexture("ElementBackground", backpage );


....

fb.blit( TextureManager.getInstance().getTexture( "ElementBackground"),
           0 , 0,
           0 , 0 ,
                          512 , 512,
           FrameBuffer.TRANSPARENT_BLITTING);


NOTE:createBitmap remained 512 while loading of the 512 or 1024 image , but the 1024 image works while the 512 does not.

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 12295
    • View Profile
    • http://www.jpct.net
Re: Texture 1024^2 vs 512^2
« Reply #1 on: February 13, 2011, 09:38:59 pm »
Have you checked that your loaded image really has the size you expect it to have? I never put images that should go into textures into drawable, because some Android versions scale them at load time at will. Try if putting it into raw helps.
« Last Edit: February 13, 2011, 09:51:35 pm by EgonOlsen »

Offline icarusfactor

  • int
  • **
  • Posts: 58
    • View Profile
Re: Texture 1024^2 vs 512^2
« Reply #2 on: February 13, 2011, 09:46:54 pm »
Will try that when I get a chance, I have bitmap fonts in a 512^2 image and they work fine, but I use a totally different method of loading them since I modify each pixel, but this image goes directly to the framebuffer.  Will post further if I gleen any more info from the problem.

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 12295
    • View Profile
    • http://www.jpct.net
Re: Texture 1024^2 vs 512^2
« Reply #3 on: February 13, 2011, 09:52:36 pm »
If i understand you correctly, the image in "image" is already wrong, isn't it? It would have nothing to do with textures then!?

Offline icarusfactor

  • int
  • **
  • Posts: 58
    • View Profile
Re: Texture 1024^2 vs 512^2
« Reply #4 on: February 13, 2011, 11:17:00 pm »
Yes, it gets overwritten by by the immutable image to make a mutable one, which that seems to work. Just the size part I having problems with.

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 12295
    • View Profile
    • http://www.jpct.net
Re: Texture 1024^2 vs 512^2
« Reply #5 on: February 13, 2011, 11:40:44 pm »
I'm confused now...my actual question was, how "image" looks like before you make a texture from it!?