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

Fullscreen Renders Improperly in Portrait (not closed) #28

Closed giorgosgs closed 11 years ago

giorgosgs commented 11 years ago

I have the same issue reported as closed on my playbook. (I use the latest emulate SDL build. Downloaded and compiled today)

In my "bar-descriptor.xml" I have: < initialWindow > < aspectRatio >landscape< / aspectRatio > < autoOrients >false< / autoOrients > < systemChrome >none< / systemChrome > < transparent >false < / transparent > < / initialWindow >

The game normally runs in landscape. If I hold the device in landscape orientation, and begin an application, it runs just fine.

if I begin the application while I am holding the PlayBook in portrait, the screen initializes in a squished view. Sometimes (rarely) it renders correctly. It seems to be a race condition as stated in the 'closed' similar issue.

(I use bbndk-2.0.1 and playbook 2.0.1.358)

giorgosgs commented 11 years ago

Any help?

I cannot fix this issue myself. It seems that when the app starts (holding the PlayBook in portrait) it is still in portrait and the program sees a resolution of 600x1024 and acts accordingly. But after a second the orientation changes to landscape (because I have set: < aspectRatio >landscape< / aspectRatio >) but its too late since the program started with 600x1024 and not 1024x600. What can we do?

jnicholl commented 11 years ago

I asked asimonov to reply, I thought this issue was fixed. It doesn't happen with frogatto, and that uses SDL. Are you using opengl with SDL?

From: giorgosgs [mailto:notifications@github.com] Sent: Saturday, August 11, 2012 04:25 PM To: blackberry/SDL SDL@noreply.github.com Subject: Re: [SDL] Fullscreen Renders Improperly in Portrait (not closed) (#28)

Any help?

I cannot fix this issue myself. It seems that when the app starts (holding the PlayBook in portrait) it is still in portrait and the program sees a resolution of 600x1024 and acts accordingly. But after a second the orientation changes to landscape (because I have set: < aspectRatio >landscape< / aspectRatio >) but its too late since the program started with 600x1024 and not 1024x600. What can we do?

— Reply to this email directly or view it on GitHubhttps://github.com/blackberry/SDL/issues/28#issuecomment-7669989.


This transmission (including any attachments) may contain confidential information, privileged material (including material protected by the solicitor-client or other applicable privileges), or constitute non-public information. Any use of this information by anyone other than the intended recipient is prohibited. If you have received this transmission in error, please immediately reply to the sender and delete this information from your system. Use, dissemination, distribution, or reproduction of this transmission by unintended recipients is not authorized and may be unlawful.

giorgosgs commented 11 years ago

Opengl and SDL. I hope it was fixed too...

jnicholl commented 11 years ago

Do you open multiple windows, or only a single one? Frogatto is also OpenGL, so it can't just be OpenGL-related.

From: giorgosgs [mailto:notifications@github.com] Sent: Monday, August 13, 2012 02:42 AM To: blackberry/SDL SDL@noreply.github.com Cc: Jeremy Nicholl Subject: Re: [SDL] Fullscreen Renders Improperly in Portrait (not closed) (#28)

Opengl and SDL. I hope it was fixed too...

— Reply to this email directly or view it on GitHubhttps://github.com/blackberry/SDL/issues/28#issuecomment-7684391.


This transmission (including any attachments) may contain confidential information, privileged material (including material protected by the solicitor-client or other applicable privileges), or constitute non-public information. Any use of this information by anyone other than the intended recipient is prohibited. If you have received this transmission in error, please immediately reply to the sender and delete this information from your system. Use, dissemination, distribution, or reproduction of this transmission by unintended recipients is not authorized and may be unlawful.

jnicholl commented 11 years ago

I haven't been able to reproduce the squished display, but I did find some problems related to opening an application in portrait mode. What resolution are you setting for your window (SDL_SetVideoMode)?

asimonov-im commented 11 years ago

Unfortunately, I am unable to reproduce the issue with my sample application (https://github.com/asimonov-rim/SDL_GL). Perhaps you could try building and running the sample on your device and see if the cube becomes squished.

Some other things to consider:

  1. Make sure you have the commit that appears to fix the issue for us - 2848c718671f8859c5b240464c84202ccd86b876
  2. If possible, send us your code or a stripped-down version of it that still has the issue.
giorgosgs commented 11 years ago

I use a single window.

I tried the SDL_GL sample and when I start it with landscape mode it works fine. When I start it with portrait mode then it crashes before it even begins. I tried to debug it but it worked fine (seems a race condition bug since in debug it started slower and had time to switch to landscape)

I have the fixes (commit) in my SDL code.

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

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;
    }
asimonov-im commented 11 years ago

jnicholl and I committed two patches, the most recent of which is meant to force SDL_GetVideoInfo to return landscape dimensions. We don't know why SDL_GL would crash in portrait mode (is there a log message?). Hopefully they'll help, it's hard to tell what's going on when we don't seem to get any of the same results.

giorgosgs commented 11 years ago

I think I know why SDL_GL crashes. I did almost the same patch myself before 2 days (switched the height and width if the height is bigger than the width) and it crashed because "SDL_SetVideoMode" could not set that resolution. I suppose at that exact time the orientation is still in portrait and we ask the "SDL_SetVideoMode" to create a resolution that it cannot create. After some time (milliseconds) the program changes to landscape automatically but its too late.

I guess SDL_GL tries to "SDL_SetVideoMode" of 1024x600 when the app is still in 600x1024 and SDL_SetVideoMode crashes.

jnicholl commented 11 years ago

My understanding was that SDL_SetVideoMode should only reject resolutions based on what is in the list of possible display modes, and with the recent change, it should enforce landscape modes as the only possible display modes? Would it be possible to copy the exact error message from when the program exits, after updating to the newest version? Thanks!

giorgosgs commented 11 years ago

ok will do

giorgosgs commented 11 years ago

I confirm that the bug is now fixed!