1

Retina 以外のデバイス (iPad 2 および iPad Mini) で実行されている iPhone アプリケーションが、デフォルトで iPhone Retina Graphics (2x) でレンダリングされるようになったことに気付きました (アプリケーションに Retina アセットがある場合)。

現在、Retina 画面なしで Retina グラフィックスで iPhone アプリケーションを実行しているデバイス:

  • iPad2
  • アイパッドミニ

ペイロードに Retina グラフィックスを含む iPhone アプリケーションを実行している非 Retina デバイスには、ズーム オプションがありません。これは素晴らしいことですが、私は Openframeworks iOS 環境を新しい Retina ウィンドウで動作させようとしてきましたが、依然として非 Retina OpenGL ウィンドウをレンダリングしています (デバイス自体が高 dpi 2x スケールではないため)。

環境:


現在のメイン.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; 

}

誰でも何か考えがありますか?私はいくつかの解決策に取り組んでおり、すぐに修正される可能性があります。

4

1 に答える 1

2

さて、投稿する前に解決策を見つけたので、参考のためにここに掲載します。:)

そのため、main.mm を作成するときに、すぐに Retina を有効にしないでください。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; 
}
于 2013-11-04T05:37:35.433 に答える