GLKView set drawable properties

后端 未结 3 1794
梦如初夏
梦如初夏 2021-02-11 17:31

I\'m trying to port Apples GLPaint example to use GLKit. Using a UIView, its possible to return the CAEAGLLayer of the view and set the drawableProperties to include kEAGLDrawab

3条回答
  •  我寻月下人不归
    2021-02-11 18:06

    Not sure if this will work but here is some code we have:

    GLKView * const view = (GLKView *)self.view;  
    view.context = self.context;
    view.delegate = self;
    view.drawableColorFormat = GLKViewDrawableColorFormatRGBA8888;
    view.drawableDepthFormat = GLKViewDrawableDepthFormat24;
    view.drawableMultisample = GLKViewDrawableMultisampleNone;
    self.preferredFramesPerSecond = 30;
    
    [EAGLContext setCurrentContext:self.context];
    CAEAGLLayer * const eaglLayer = (CAEAGLLayer*) view.layer;
    eaglLayer.opaque = YES;
    

    You should be able to access eaglLayer.drawableProperties. Hopefully that lets you set the parameter you want.

提交回复
热议问题