If you're using that declaration, then any RGBA texture which is bigger than 8192 pixels (~91x90 pixels!) will cause a range check error. Shouldn't that be a much bigger array, like Array[0..4294967295] Of Byte?