So, I have David's Linux port set up with something like this
1 2 3 4 5 6 7 8 9 10 11 12 13 14 | Texture = SDL_CreateTexture(Renderer, SDL_PIXELFORMAT_ARGB8888, SDL_TEXTUREACCESS_STREAMING, Width, Height); BitmapWidth = Width; BitmapHeight = Height; BitmapMemory = mmap(0, Width * Height * BytesPerPixel, PROT_READ | PROT_WRITE, MAP_PRIVATE | MAP_ANONYMOUS, -1, 0); } |
I'm trying to blit the image http://imgur.com/PKYWQnS by doing this:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 | void ShowImage(BMPFILE* bmpStruct) { int x=0; int y=0; uint8 *Pixel = (uint8 *)BitmapMemory; uint32 *pixel = (uint32 *)Pixel; uint8 *dataPointer = (uint8 *) bmpStruct->data; for (y=0;y <bmpStruct->info->height;y++) { for (x=0;x < bmpStruct->info->width;x++) { int pitch=0; SDL_LockTexture(Texture,NULL,(void**) pixel,&pitch); uint32 it = *(dataPointer); it <<= 8; it |= *(dataPointer+1); it <<= 8; it |= *(dataPointer+2); *(pixel++) = (uint32) it; dataPointer+=3; SDL_UnlockTexture(Texture); } } #endif } |
I figured since this is a 24bit map I would just grab a byte, or it into a 32bit int and shift it.
But I get this:
http://imgur.com/AeVLRgf
The only think I can think of that's not prob right is that it's compressed?