I’m using textures to display formatted text inside a scroll view inside a pop-up window. In cases where the text is too long to fit in a single 1024-pixel tall texture, I use two or more textures drawn one below the other. Other than the file-size issue, this method works great and the textures fit together and scroll smoothly.
The problem is that textures that are less than 1024 pixels tall get shrunk horizontally. All are the same width, 460 pixels, which I’ve checked and triple checked. All are drawn at the same width using a GUI Label. But the shorter textures display narrower in the scroll view. And the amount by which they are shrunk is not always the same.
I’ve attached two examples. In each, you can see the “seam” where the first and second textures meet. In both these examples, the texture on top is 460 x 1024, and the one below is 460 x less than 1024. It’s most noticeable in the first example, as the seam is in the middle of a line of text.
Any ideas what might cause this, or how to make all the textures display at their proper widths regardless of their heights?
I thought IPhone texture dimensions had to be powers of two and square? 460 is neither a power of 2 or square, if the height is 1024. I think you can get away with them not being square if you choose not to compress them. Perhaps try 512x1024 and disable compression?
My understanding was that iPhone textures do not have to be a power of two, but if they are not, they will not be compressed. I’ve never seen anything about them having to be square. And they are limited in size to 1024, which is why I have to stitch two or more together for big text blocks.
BTW, this is an iPad app, if that makes a difference.
And I did disable compression on these textures, otherwise the text becomes unreadable.
I guess I could try to make them all power of two sizes (lots of work to reformat the text), but would that explain why they are squished? I have other GUI textures that are not a power of two, and they display correctly.
I made all my textures a power of two, although not all are square, and the problem is still there. I don’t think this is a compression issue, as none of the images were compressed when imported. Also, as I understand it, regardless of the size of a texture, when drawn in a GUI Label it should be drawn to fill the specified rect. And now even though all textures are the same power-of-two width, and all have the same dest rect, some are still drawn narrower or wider than others.
Could there be a problem with GUI Labels not working in a scroll view? I know GUI Textures do not, which is why I’m using Labels. I don’t know what else to try.
The style is a blank style, no textures, and everything set to zero. This is the only way I could get it to hide the scroll bars (to scroll with touch). I’ve also tried turning Stretch Width on and off, and that makes no difference. I also just tried putting the scroll bars back (not using the GUI style), and still the same.
And it doesn’t seem to matter if the textures are square or not. I have four blocks of text, each a different length and each requiring a different number of textures. And each is drawn slightly differently.
Block 1 is one texture, 512 x 512, and it draws narrower than the others.
Block 2 is two textures (one below the other), both 512 x 1024, and they both draw the correct, same size.
Block 3 is three textures, the first two 512 x 1024 and the last 512 x 512, and the last draws narrower than the others.
And block 4 is four textures, the first three 512 x 1024 and the last 512 x 512, and the last draws narrower than the others.
So either the square textures are being drawn too narrow (but all at a slightly different width), or the non-square textures are being drawn too wide (but all the same width).