warren
Junior Member
Posts: 11
|
Tiling
Mar 31, 2015 23:57:23 GMT -8
Post by warren on Mar 31, 2015 23:57:23 GMT -8
I've noticed that tiling only seems to work correctly (ie., using GD.BitmapSize(NEAREST, REPEAT, REPEAT, 480, 272); ) when the bitmap width and height are 2^n. Examples in the book are 128x128 and 256x256, and I've also had luck with 64x64, and 256x64. Can anyone confirm this? I struggled for hours trying to figure out why my arbitrarily sized bitmaps wouldn't tile correctly.
Update: I've also found it necessary for multiple bitmaps to use GD.BitmapHandle prior to GD.BitmapSize. I incorrectly assumed that this was a global attribute.
Warren Davis
|
|
|
Tiling
Apr 1, 2015 6:45:40 GMT -8
Post by jamesbowman on Apr 1, 2015 6:45:40 GMT -8
Yes, confirmed. Bitmaps must be powers of two for tiling to work. I just raised a ticket to cover this in the book. github.com/jamesbowman/gd2-book/issues/5And yes, GD.BitmapSize modifies the size of the currently selected bitmap 0-15, which is selected with GD.BitmapHandle. The same is true for GD.BitmapSource and GD.BitmapLayout. There are sixteen copies of all these values, one copy for each bitmap handle.
|
|