0

I have a subclass of GLKView for user drawing. But i also need to draw his latest drawing image when he opens the appropriate screen. The problem is in the second part, as it seems i do something wrong which causes drawImage:inRect:fromRect: not to work.

Here is my code for drawing.

-(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]];
    }
}
Annie
  • 147
  • 1
  • 8

1 Answers1

0

Solved the problem by writing this code in my subclass's drawRect method.

Annie
  • 147
  • 1
  • 8