<br><br><div class="gmail_quote">On 21 January 2011 15:21, Claude Heiland-Allen <span dir="ltr"><<a href="mailto:claude@goto10.org">claude@goto10.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
<div class="im">On 21/01/11 06:58, David Griffiths wrote:<br>
</div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="im">
On Thu, 2011-01-20 at 22:26 +0100, Kassen wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
         Yeah, I think that could be the problem.<br>
</blockquote>
<br></div></blockquote></blockquote><div><br></div><div>Gabor;</div><div><br></div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div class="im"></div><div class="im">
The problem is lack of an alpha channel. It's skewed in that way as it's<br>
expecting 4 bytes per pixel but it's getting 3.<br>
</div></blockquote>
<br></blockquote><div><br></div><div>Ah! It looked to me like it could be miss-reporting its dimensions, originally, so this makes perfect sense. Phew. tricky stuff.</div><div> </div><div>Cluade;</div><div><br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">

To be more explicit: pixels are contiguous in each row, but there might need to be gaps between the rows in memory as each row needs to start aligned to a certain number of bytes.  With 4 channels (RGBA) this works fine with the default alignment of 4, but with 3 channels you'd need a multiple of 4 pixels in each row otherwise you'd get diagonal weirdness (and potentially a buffer overflow crash).<br>
<br></blockquote><div><br></div><div>Ok, I follow this, I think. Are you saying that even without alpha channel bytes the image might display as long as it has a certain amount of pixels, as the pixels "get back in sync"? Wouldn't we expect that kind of image to be non-diagonal but instead have odd colours?</div>
<div><br></div><div>Also, to summarise;</div><div>*POT textures are preferred for performance (probably with alpha?)</div><div>*NPOT textures will work as long as they have a alpha channel.</div><div>*NPOT textures without alpha should work as long as their dimensions are integer powers of 4.</div>
<div><br></div><div>Is that right?</div><div><br></div><div>I still think I have one texture (terras2) that breaks these rules, though one dimension is indeed a multiple of 4. Maybe one is enough, as long as it's the dimension lines are scanned in?</div>
<div><br></div><div>PHEW! Great detective work here!</div><div><br></div><div>Yours,</div><div>Kas.</div></div>