Saving imageRef from GLPaint creates completely black image

前端 未结 3 1853
时光说笑
时光说笑 2020-12-20 02:15

Hi I am trying out drawing app and have a problem when it comes to saving the image that is drawn. Right now I\'m very early in learning this but I have added code from: How

相关标签:
3条回答
  • 2020-12-20 02:18

    The save method should be called within the scope of the OpenGL context. To solve this you can move your method within the same rendering .m file and call this function from outside.

    Also you need to consider OpenGL clear color.

    (detail explanation in comments, lol)

    0 讨论(0)
  • 2020-12-20 02:26

    I found that changing the CGBitmapInfo into:

    CGBitmapInfo bitmapInfo = kCGImageAlphaPremultipliedLast;
    

    Results in a transparent background.

    0 讨论(0)
  • 2020-12-20 02:29

    Ah, you have to do this at the beginning.

    [EAGLContext setCurrentContext:drawContext];
    
    0 讨论(0)
自定义标题
段落格式
字体
字号
代码语言
提交回复
热议问题