blackberry / SDL

Simple DirectMedia Layer is an open-source, cross-platform multimedia library designed to provide a low level API.
GNU Lesser General Public License v2.1
86 stars 46 forks source link

Locked on Landscape, on playbook #42

Closed giorgosgs closed 11 years ago

giorgosgs commented 11 years ago

After January updates I have an error that I didnt have in the previous SDL release. When I hold my playbook in portrait mode and I start my SDL app, the game screen shrinks in 1/3 horizontal and 1/1 vertical. Its stretched. Look at the image I attack. The red is the game screen and the rest of the screen is black. Before January updates this worked ok.

image

I start the app with this:

    gv.window = SDL_SetVideoMode(SCREEN_WIDTH, SCREEN_HEIGHT, SCREEN_BPP, SDL_OPENGL | SDL_FULLSCREEN);
    if (!gv.window) {
        fprintf(stderr, "Couldn't set %dx%d video mode: %s\n", SCREEN_WIDTH, SCREEN_HEIGHT, SDL_GetError());
        //return false;
    }
jnicholl commented 11 years ago

That's not good. Perhaps the aspect-ratio stretching code is incorrect with GL windows? What are the values of SCREEN_WIDTH and SCREEN_HEIGHT in your example? Also, are you using the environment variable STRETCH_MODE? Can you experiment with setting it to "noscale" or "fill"?

giorgosgs commented 11 years ago

Here is how I do it:

//Auto adjust resolution
const SDL_VideoInfo* myMonitor = SDL_GetVideoInfo();
SCREEN_WIDTH = myMonitor->current_w;
SCREEN_HEIGHT = myMonitor->current_h;

I dont use STRETCH_MODE or anything else. I dont even know how to use it.

I noticed 2 weird things:

1) When I compiled the new SDL library with QNX Momentics I got an error saying: cannot find 'mainWindow ' in SDL_playbookvideo.c in this line:

info->mainWindow = _priv->mainWindow;

I had to comment it out for it to compile.

2) When the playbook is in portrait and I start the app and see it like the image above I print the game's resolution and it says: 600x450. It should say 1024x600. I don't get it.

jnicholl commented 11 years ago

Something seems strange about your SDL library. Did you refresh the project after updating from Git? I do not get any errors about mainWindow when building. Alternatively, can you test that SDL works if you check it out to 20c331e324ad5d58ef80c8352a760e2ac866747e instead of HEAD? This should remove the more recent changes from January, but keep the change that introduced the STRETCH_MODE options, and hopefully help us find the problematic change. Thanks!

giorgosgs commented 11 years ago

Yes I refreshed my project.

I started the project with fixed resolution:

gv.window = SDL_SetVideoMode(1024, 600, SCREEN_BPP, SDL_OPENGL | SDL_FULLSCREEN);

When the playbook is in portrait and I start the app and see it shrinked in 1/3 horizontal and 1/2 vertical.

giorgosgs commented 11 years ago

This is very weird! I loaded the SDL before STRETCH_MODE change and still it does the same error!

giorgosgs commented 11 years ago

Maybe a fix before that which at the time I didnt check this error?

I really dont know which fix triggered the error but its there and its happening 100% 1) When I start the app on my playbook from landscape view the app starts correct. 2) When I start the app on my playbook from portrait view the app starts wrong, like the image above.

I have:

    <initialWindow>
        <aspectRatio>landscape</aspectRatio>
        <autoOrients>false</autoOrients>
        <systemChrome>none</systemChrome>
        <transparent>false</transparent>
    </initialWindow>

I suspect that when I launch the app in portrait, it doesnt have time to fully change the resolution to landscape when the app starts. Its in a middle state (from one aspect to the other) and thus the new app cannot be set correctly.

giorgosgs commented 11 years ago

Any news?

jnicholl commented 11 years ago

I've been completely swamped with other things at the moment and haven't really had any time to investigate. It would help me out if you could isolate which version you had that was working before (just the SHA will do).

giorgosgs commented 11 years ago

I had the same issue before 5 months and I submitted it and you guys fixed it. Check here: https://github.com/blackberry/SDL/issues/28 You will see there who fixed it and when. But the issue came back...

giorgosgs commented 11 years ago

Can you please look into it. I would like to publish my app into the BB Appworld until mid Feb to participate into blackberries 'build for blackberry' program. Thanks a lot.

jnicholl commented 11 years ago

I will try to investigate. If necessary, can you send me an application that shows the problem? I will try to investigate in either case, but it may be useful to have your app. A simple test app is fine.

jnicholl commented 11 years ago

Can you try it with d92c59639dbefc4bfb7ba8b74c3789a67ccac449?

giorgosgs commented 11 years ago

I tried it. I confirm, it works. Now the resolutions works as expected.