Horizontal view
I'm trying to get OpenGL ES setup so that Y is up when the phone is being held horizontally. I don't need it to auto-rotate, in fact, it needs not to. I just want the view to rotate horizontally so that you hold the phone that way when playing the game.
The only thing I can find regarding setting the orientation of the view involves a view controller and I am not good at all with IBoutlets and InterfaceBuilder. If there's a way to do it without a view controller, and anybody can help, it would be greatly appreciated. I've been trying to figure this out for a while now.
The only thing I can find regarding setting the orientation of the view involves a view controller and I am not good at all with IBoutlets and InterfaceBuilder. If there's a way to do it without a view controller, and anybody can help, it would be greatly appreciated. I've been trying to figure this out for a while now.
You can rotate your projection matrix.
Code:
glMatrixMode( GL_PROJECTION ); // Select the projection matrix
glLoadIdentity(); // and reset it
glRotatef(-90.0f, 0.0f, 0.0f, 1.0f); // rotate the coordinate system to switch to landscape view
glOrthof(0.0, 480.0f, 320.0f, 0.0f, 1, -1); // Set up ortho or perspective here
glMatrixMode( GL_MODELVIEW ); // Select the modelview matrix
glLoadIdentity(); // and reset it
Is there a way to actually rotate the view?
This isn't working for me, no matter what I try.
I put the rotation in there that you suggested but once I get the 3D rotated back to the way it should be, it turns out to be exactly the same as before I changed anything. The only thing different is when the phone is rotated, the Y axis actually is up but it looks exactly the same otherwise.
The issue is, the perspective appears to go into the phone to the right.
I put the rotation in there that you suggested but once I get the 3D rotated back to the way it should be, it turns out to be exactly the same as before I changed anything. The only thing different is when the phone is rotated, the Y axis actually is up but it looks exactly the same otherwise.
The issue is, the perspective appears to go into the phone to the right.
I finally got the view just right, or so it seems. Here's what I had to do:
1) Rotate local Z + 90
2) Translate local X + 5
3) Rotate world X + 70.
This gives me a slightly tilted birds-eye perspective when the phone is horizontal.
1) Rotate local Z + 90
2) Translate local X + 5
3) Rotate world X + 70.
This gives me a slightly tilted birds-eye perspective when the phone is horizontal.
Here I go replying to myself yet again. I found a better way to do it.
starting in landscape mode without status bar. There are several good topics in that website. Check it out.
Cheers!
starting in landscape mode without status bar. There are several good topics in that website. Check it out.
Cheers!

