SDL2.0 Android problem with SDL_LoadBMP

Hey everyone!

So I’d like to make a picture of mine the background of my app. It is just a gradiently colored picture, 1080*1920, you get the idea.
However, when I print it on the screen, it can’t display every color, so it gets really bad quality. My phone is an LG G2, so it can display all kinds of colors…What is the problem here?

Code i’m using:

Code:
int main(int argc, char *argv[])
{
int w,h;
PICTURE picture;
SDL_Window *window;
SDL_Renderer *renderer;
SDL_Surface *surface;

SDL_CreateWindowAndRenderer(0, 0, 0, &window, &renderer);
SDL_GetWindowSize(window,&w,&h);


surface=SDL_LoadBMP("backg.bmp");
picture.w=surface->w;
picture.h=surface->h;
picture.texture=SDL_CreateTextureFromSurface(renderer, surface);
SDL_FreeSurface(surface);
SDL_Rect destination={0,0,picture.w,picture.h};

SDL_RenderClear(renderer);
SDL_RenderCopy(renderer,picture.texture,NULL,&destination);
SDL_RenderPresent(renderer);

SDL_Delay(100000);

return 0;

}

Also, would installing SDL_Image work? I tried it, but I couldn’t get it working, if anybody got a guide, that would be great.

Thanks in advance!

Have you tried with another image? What’s exactly the problem? I’ve used SDL_LoadBMP successfully on Android, you can try if it works on your phone http://thegiallo.itch.io/space-master

Oh, I’m using SDL 2.0.4-49174 from HG on Android.

I might be off, but this sounds like a pixel format quality issue.
Android used to prefer RGB 565 for RAM and performance. I don’t know
what SDL’s defaults are on Android (or iOS incidentally). I’m not sure
if/what SDL’s mechanism is to control this, but my guess is to try
setting things to 888 with SDL_GL_SetAttribute.

https://wiki.libsdl.org/SDL_GL_SetAttribute

-EricOn 2/16/15, sweetcare <fulop.dani96 at gmail.com> wrote:

Hey everyone!

So I’d like to make a picture of mine the background of my app. It is just a
gradiently colored picture, 1080*1920, you get the idea.
However, when I print it on the screen, it can’t display every color, so it
gets really bad quality. My phone is an LG G2, so it can display all kinds
of colors…What is the problem here?


Beginning iPhone Games Development
http://playcontrol.net/iphonegamebook/