开发者

iphone landscape mode problem again

开发者 https://www.devze.com 2023-02-09 20:25 出处:网络
I have te开发者_开发问答sted everything but I cant get it to work. This is how I set up my program:

I have te开发者_开发问答sted everything but I cant get it to work.

This is how I set up my program:

CGRect contentRect = CGRectMake(0, 0, 480, 320);
CGRect screenBounds = [[UIScreen mainScreen] bounds];
_window = [[UIWindow alloc] initWithFrame: contentRect];
_view = [[GLView alloc] initWithFrame: screenBounds];
CGAffineTransform transform = CGAffineTransformMakeRotation(3.14159/2);
_view.transform = transform;


_window.frame = contentRect;
_window.bounds = contentRect;
_window.window.bounds = contentRect;
_window.frame = contentRect;

_view.window.bounds = contentRect;
_view.bounds = contentRect;
_view.bounds = contentRect;
_view.frame = contentRect;

[_window addSubview: _view];
[_window makeKeyAndVisible];

I set up my opengl like this:

glViewport(0, 0, 480, 320);

glMatrixMode(GL_PROJECTION);
glLoadIdentity();

glOrthof( 0, 480, 0, 320, -1, 1 );

glMatrixMode(GL_MODELVIEW);
glLoadIdentity();

and as you can see one third from the right is black? what am i missing?

iphone landscape mode problem again


You should set rotation in your model/view matrix and not in the view.

0

精彩评论

暂无评论...
验证码 换一张
取 消