我发现,显然需要设置正确调整视图视图中的“规模”的方法(如视图是基于位置而像素出于某种奇怪的原因,这些职位不会随着决议的增加而重新调整等)。这是我真正能找到的唯一的东西。我已经注意到在GLView的init方法中包含下面的调用检查并在下面设置...但我仍然想知道是否有更好的方法。我不会手动调整所有的东西的大小乘以高度和宽度的规模属性?
- (id)initWithFrame:(CGRect)frame
{
NSLog(@"frame: Origin: x:%f y:%f, Size: width:%f height:%f", frame.origin.x, frame.origin.y, frame.size.width, frame.size.height);
self = [super initWithFrame:frame];
if (self) {
**if([[UIScreen mainScreen] respondsToSelector: NSSelectorFromString(@"scale")])
{
if([self respondsToSelector: NSSelectorFromString(@"contentScaleFactor")])
{
[self setContentScaleFactor:[[UIScreen mainScreen] scale]];
NSLog(@"Scale factor: %f", [[UIScreen mainScreen] scale]);
}
}**
NSLog(@"frame: Origin: x:%f y:%f, Size: width:%f height:%f Scale factor: %f", frame.origin.x, frame.origin.y, frame.size.width, frame.size.height, self.contentScaleFactor);
CAEAGLLayer *eaglLayer = (CAEAGLLayer *)super.layer;
eaglLayer.opaque = YES; // set to indicate that you do not need Quartz to handle transparency. This is a performance benefit.
context = [[EAGLContext alloc] initWithAPI:kEAGLRenderingAPIOpenGLES1];
if (!context || ![EAGLContext setCurrentContext:context]) {
return nil;
}
嗯,我并没有特别需要这样(它绝对可以缩放它,但我使用glViewport(0,0,width * [[UIScreen mainScreen] scale],height * [ [UIScreen mainScreen] scale]);编辑视口以缩放。我不喜欢这个想法,我必须手动乘以一个比例,但是会做什么。我只是在更深入地了解OpenGL ES 1.1。我知道我在ES 2.0中从来不用担心这个问题。所以不要再担心了。 – TheCodingArt 2013-03-06 17:41:52