Texture 1024^2 vs 512^2

Started by icarusfactor, February 13, 2011, 09:22:13 PM

Previous topic - Next topic

icarusfactor

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.

EgonOlsen

#1
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.

icarusfactor

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.

EgonOlsen

If i understand you correctly, the image in "image" is already wrong, isn't it? It would have nothing to do with textures then!?

icarusfactor

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.

EgonOlsen

I'm confused now...my actual question was, how "image" looks like before you make a texture from it!?