0

GLKViewユーザー描画用のサブクラスがあります。しかし、彼が適切な画面を開いたときに、彼の最新の描画イメージも描画する必要があります。問題は2番目の部分にあります。動作しない原因となる何か間違ったことをしているようですdrawImage:inRect:fromRect:

これが私の描画用のコードです。

-(void)setSignatureImage:(UIImage *)image {
    EAGLContext *context = [[EAGLContext alloc] initWithAPI:kEAGLRenderingAPIOpenGLES2];
    self.context = context;
    [EAGLContext setCurrentContext:context];

    self.drawableDepthFormat = GLKViewDrawableDepthFormat24;
    self.enableSetNeedsDisplay = YES;

    CIContext *cicontext = [CIContext contextWithEAGLContext:context options:@{kCIContextWorkingColorSpace : [NSNull null]} ];

    UIImage *pre_img = image;
    CIImage *outputImage = [CIImage imageWithCGImage:pre_img.CGImage];

    if (outputImage) {
        [cicontext drawImage:outputImage inRect:[outputImage extent] fromRect:[outputImage extent]];
    }
}
4

1 に答える 1

0

サブクラスの drawRect メソッドにこのコードを記述して問題を解決しました。

于 2016-03-15T12:10:06.453 に答える