All pastes #638123 Raw Edit

tex loading

public text v1 · immutable
#638123 ·published 2007-07-29 15:23 UTC
rendered paste body
            int frameSize = reader.ReadInt32();
            
            byte[] data = reader.ReadBytes(frameSize);
            Bgr565[] pixels = new Bgr565[data.Length / 2];
            int currentPixel = 0;
            for (int i = 0; i < data.Length; i += 2)
            {
                pixels[currentPixel].PackedValue = (data[i+1] << 8 ) + data[i];
                
                currentPixel++;
            }

            _texture.SetData<Bgr565>(pixels);