Unfortunately, it looks like I am starting to agree with you stevo. I made a minimal example to prove the behavior to you guys, but (unfortunately for my ego) so far it looks like it is behaving like it should.
I will have to dig further into this, to figure out what it is I am doing that is causing this behavior.On Friday, September 14, 2012 at 7:59 AM, stevo5800 wrote:
That might be another difference from mine and yours I’m using OpenGL 1.0 renderer
gormlai wrote:
Thanks, Sam for the link. I have taken a look at the code, and after comparing with my own code and trying a few settings, I am pretty sure it has to do with my use of OpenGL.
The main offending piece of code looks to be glViewport. As an example on the iPad 1, the parameters resolve to glViewport(0,0,1024,768) which gives me the wide screen but still in portrait mode (with some of the picture not visible). If I use glViewport(0,0,768,1024) then I get a normal portrait mode.
To me this indicates there is an NSOpenGLView or the like, that haven’t figured out, the screen has rotated yet?
I use OpenGL 2.0 (so all matrices, etc are set up in shaders), and also render targets are used a lot.
Thanks for hanging in there for me so far guys. Did I mention I used the SDL1.2 almost all the time through its existence?
Cheers,
Gorm
On Wednesday, September 12, 2012 at 10:33 AM, stevo5800 wrote:
Quote:
No one can confirm that iPad rotations work or do not work properly on the actual device? I’m a little confused here rotation works properly for me on simulator iPad and iPod, and on iPod and iPhone device. iPad is the only device I do not have. I don’t see much difference in maelstrom seems like you just flipped the width and height. Correct me if I’m wrong he is complaining about the app not starting in landscape mode, so to get the app to start in landscape mode all you need to do is reverse the width and width height right? Well thats what I’m doing and I know many others doing the same thing to get there app to start in landscape mode. So what’s bothering me is what is making he’s app have this weird effect?
Sam Lantinga wrote: I don’t know about minimal, but you can grab Maelstrom:http://hg.libsdl.org/Maelstrom
I think you need to comment out one thing before it compiles on iOS, but other than that it should work fine.
On Sun, Sep 9, 2012 at 11:21 AM, Gorm Lai <> wrote:
Quote: I actually just pulled the latest build from mercurial as well.
One big difference though could be that I am using a device (I have a lot of other small libraries that doesn’t run in the simulator atm).
I would be super interested if anyone had a minimal iOS opengl landscape example (Though the official read me still does say it is not supported , which was why I phrased this as a best practices question).
Best,
Gorm
On Sunday, September 9, 2012 at 7:14 PM, stevo5800 wrote:
Quote: You running it on simulator or actual device? I don’t have the actual device with me but I ran it from the simulator and everything works fine, I even downloaded the latest SDL from mercurial just to make sure there was no bug in SDL and it started up in landscape mode.
gormlai wrote: That is exactly, what I am doing, and as I said everything is good after the first first manual rotation.
On Sunday, September 9, 2012 at 6:38 PM, stevo5800 wrote:
Quote: the width and height need to be changed globally
example
//global variables
#define SCREEN_WIDTH 1024
#define SCREEN_HEIGHT 768
window = SDL_CreateWindow(0, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT,
SDL_WINDOW_OPENGL | SDL_WINDOW_BORDERLESS |
SDL_WINDOW_SHOWN | SDL_WINDOW_FULLSCREEN);
if (!window) {
printf(“Could not initialize Window\n”);
//return 1;
}
ctx = SDL_GL_CreateContext(window);
glClearColor(0, 0, 0, 0);
glViewport(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
glOrthof(0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 1, -1 );
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
gormlai wrote: So, I tried switching the parameters, and it has no effect. The game is always in portrait mode on startup. The call that seems to decide what happens is the call to glViewport
if I call glViewport(0,0,width,height) it creates a rectangle in the bottom of the screen (with the upper part black) like in the screenshot here http://imgur.com/J2FbO, that I posted before.
If I use glViewport(0,0,height,width) it creates a full portrait mode screen. This is independent of whether or not I switch the parameters in the call to SDL_CreateWindow
It looks to me like the OpenGL context has discovered it is in landscape mode the first manual rotation happens. Would this be a possibility?
On Sunday, September 9, 2012 at 5:53 PM, stevo5800 wrote:
Quote: Try switching the width and height then it will force it to start in landscape mode so lets say native res is w = 768; height = 1024 reverse them to w = 1024; h = 768, then the only rotation it will register is the opposite side that is same width and height, you won’t need to send SDL any hints as well.
gormlai wrote: Thanks for the answers so far. To answer:
The app is only supposed to work in landscape mode. I have also taken care to avoid SDL_WINDOW_RESIZABLE
The setup I currently use is:
unsigned int windowFlags = SDL_WINDOW_SHOWN | SDL_WINDOW_OPENGL;
#if defined(IOS)
windowFlags |= SDL_WINDOW_BORDERLESS | SDL_WINDOW_FULLSCREEN;
SDL_SetHint(“SDL_HINT_ORIENTATIONS”, “LandscapeLeft LandscapeRight”);
#endif
This works as expected, and I can force rotation to either landscape modes only.
The problem is only on startup. I have linked to 2 screenshots. The first is trivial and just shows the iPad showing the default launch screen in the correct orientation on launch. The second screenshot shows the game on startup until any screen rotations has been provoked. The screenshot clearly shows that it is either the app/SDL thinking it is in the wrong screen mode, while the SDK knows it is in landscape mode as the welcome greeting from GameCenter is shown with the correct orientation.
screenshot 0: http://imgur.com/VQbME
screenshot 1: http://imgur.com/J2FbO
Also, I can force the screen to rotate into the correct orientation by simply rotating the device manually with my hands, after which everything works as expected.
I have also set the landscape modes in the plist.
Any ideas?,
Gorm
On Sunday, September 9, 2012 at 4:56 PM, stevo5800 wrote:
Quote: What view is giving you issues the SDL or new UIView? Does your app only work in landscape mode or you support all rotation?
Not sure if this is your problem also but, my app only runs in landscape mode to get my app to start in landscape I flipped the Width and Height and it rotate for you automatic, so no SDL_WINDOW_RESIZABLE. As you might of notice without that flag the window does indeed still resize but only if it’s the opposite same width and height(perfect for my app). The way I programmed the view in my example, my new UIView did not auto rotate was kinda scratching my head onto why it would not pick up rotation, problem was simple I added a view to the window but SDL also has a view there, so I’m putting in a second view, according to Apple documentation, only one viewcontroller will respond to rotations and thats the first one(SDL view). Not a big deal since it then tells me I could add the view to the current SDL view in instead of adding it to the window, so now any rotations SDL does your other UIView will rotate with it, so no more need of manual rotation like I did before.
Sam Lantinga wrote: For what it’s worth, I’m using landscape mode with Maelstrom with no hacks and it’s working fine here… ?
On Sat, Sep 8, 2012 at 2:50 AM, Gorm Lai <> wrote:
Quote: Hi All,
I know landscaped mode is not officially supported in the iOS build, but like most people I kinda got it to work.
I have now started to remove and refactor some of my hacks, and actually landscaped mode seems to work great now, except when the app starts up.
In this case, the screen is shown in portrait mode on the iPad mode, though it is not rotated, just showing a landscape screen at the bottom of a portrait mode (imagine a 768x1024 and 1024x768 screen intersecting with a common starting point in the lowest left corner)
It is quite easy to force the screen back into landscape mode, simply by rotating manually once. It looks like the iOS device knows it is in landscape mode at startup, but SDL doesn’t.
What would be the best workaround for this? Taking the topmost view controller and rotating it 90 degrees?
Cheers,
Gorm
SDL mailing list
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org
SDL mailing list
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org
SDL mailing list
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org
SDL mailing list
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org
SDL mailing list
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org
SDL mailing list
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org
SDL mailing list
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org
SDL mailing list
SDL at lists.libsdl.org (mailto:SDL at lists.libsdl.org)
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org