[英]iOS iPhone Application running iOS7 Retina graphics for iPad2 and iPad Mini
我注意到,默认情况下,在非视网膜设备(iPad 2和iPad Mini)上运行的iPhone应用程序现在默认呈现在iPhone Retina Graphics(2x)上(如果应用程序具有视网膜资产)。
当前在没有视网膜屏幕的情况下在Retina Graphics运行iPhone应用程序的设备:
对于运行带有有效载荷视网膜图形的iPhone应用程序的非视网膜设备,现在没有缩放选项。 很好,但是我一直在尝试使我的Openframeworks iOS环境与新的视网膜窗口一起使用,并且它仍在渲染非视网膜OpenGL窗口(因为设备本身不是2倍高的dpi缩放比例)。
环境:
当前main.mm
ofAppiOSWindow * window = new ofAppiOSWindow();
NSInteger glViewW = [UIScreen mainScreen].bounds.size.height;
NSInteger glViewH = [UIScreen mainScreen].bounds.size.width;
// glViewW returns 768
// glViewH returns 1024
window->enableRendererES2();
// [UIScreen mainScreen] is used by enableRetina to check for scale dpi.
window->enableRetina();
window->enableDepthBuffer();
ofSetupOpenGL(ofPtr<ofAppBaseWindow>(window), 320, 480, OF_FULLSCREEN);
window->startAppWithDelegate("AppDelegate");
主ViewController运行打开(GameViewController.mm)
- (BOOL)createGLView {
if(self.glView != nil) {
return NO;
}
app = new GameEngineApp();
app->setDelegate(self);
NSInteger glViewW = [UIScreen mainScreen].bounds.size.height;
NSInteger glViewH = [UIScreen mainScreen].bounds.size.width;
// glViewW returns 320
// glViewH returns 480
CGRect glViewRect = CGRectMake(0, 0, glViewW, glViewH);
self.glView = [[[ofxiOSEAGLView alloc] initWithFrame:glViewRect
andApp:app] autorelease];
self.glView.delegate = self;
self.glView.multipleTouchEnabled = NO;
[appContainer insertSubview:self.glView atIndex:0];
[self.glView layoutSubviews];
[self.glView setup];
[self.glView startAnimation];
return YES;
有人知道吗 我正在研究一些可能很快会解决的解决方案。
好吧,我在发布之前找到了一个解决方案,因此将其放在此处以供参考。 :)
因此,在创建main.mm时,请勿立即启用视网膜。 您需要等到启动AppDelegate并启动本机iOS核心功能。
修改后的Main.mm:
#include "ofMain.h"
#include "ofAppiOSWindow.h"
int main() {
ofAppiOSWindow * window = new ofAppiOSWindow();
window->enableRendererES2();
//-------------------------------------------------------------------------
// --Disabled:-- window->enableRetina(); // delete / comment this line out here
//-------------------------------------------------------------------------
window->enableDepthBuffer();
// the below numbers will not effect the window size as this is done later
ofSetupOpenGL(ofPtr<ofAppBaseWindow>(window), 320,480, OF_FULLSCREEN);
window->startAppWithDelegate("AppDelegate");
}
修改了GameViewController.mm(我在其中实例化openFrameworks glView):
- (BOOL)createGLView {
if(self.glView != nil) {
return NO;
}
app = new GameEngineApp();
app->setDelegate(self);
NSInteger glViewW = [UIScreen mainScreen].bounds.size.height;
NSInteger glViewH = [UIScreen mainScreen].bounds.size.width;
CGRect glViewRect = CGRectMake(0, 0, glViewW, glViewH);
//-------------------------------------------------------------------------
ofAppiOSWindow::getInstance()->enableRetina(); // <-- Enable retina here
//-------------------------------------------------------------------------
self.glView = [[[ofxiOSEAGLView alloc] initWithFrame:glViewRect
andApp:app] autorelease];
self.glView.delegate = self;
self.glView.multipleTouchEnabled = NO;
[appContainer insertSubview:self.glView atIndex:0];
[self.glView layoutSubviews];
[self.glView setup];
[self.glView startAnimation];
return YES;
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.