-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMGLLayer.h
71 lines (54 loc) · 2.12 KB
/
MGLLayer.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
//
// Copyright 2019 Le Hoang Quyen. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
//
// We don't use GLES from Apple framework.
// Instead we use GLES provided by MetalANGLE.
#import <Foundation/Foundation.h>
#import <QuartzCore/CALayer.h>
#import "MGLKitPlatform.h"
NS_ASSUME_NONNULL_BEGIN
@class MGLContext;
typedef enum MGLDrawableColorFormat : int
{
MGLDrawableColorFormatRGBA8888 = 32,
MGLDrawableColorFormatSRGBA8888 = -32,
MGLDrawableColorFormatRGB565 = 16,
} MGLDrawableColorFormat;
typedef enum MGLDrawableStencilFormat : int
{
MGLDrawableStencilFormatNone = 0,
MGLDrawableStencilFormat8 = 8,
} MGLDrawableStencilFormat;
typedef enum MGLDrawableDepthFormat : int
{
MGLDrawableDepthFormatNone = 0,
MGLDrawableDepthFormat16 = 16,
MGLDrawableDepthFormat24 = 24,
} MGLDrawableDepthFormat;
typedef enum MGLDrawableMultisample : int
{
MGLDrawableMultisampleNone = 0,
MGLDrawableMultisample4X = 4,
} MGLDrawableMultisample;
@interface MGLLayer : CALayer
// Return the size of the OpenGL framebuffer.
@property(readonly) CGSize drawableSize;
// Default OpenGL id of the framebuffer storing content of this layer.
// Might not necessary be zero.
@property(readonly) uint32_t defaultOpenGLFrameBufferID;
@property(nonatomic) MGLDrawableColorFormat drawableColorFormat; // Default is RGBA8888
@property(nonatomic) MGLDrawableDepthFormat drawableDepthFormat; // Default is DepthNone
@property(nonatomic) MGLDrawableStencilFormat drawableStencilFormat; // Default is StencilNone
@property(nonatomic)
MGLDrawableMultisample drawableMultisample; // Default is MGLDrawableMultisampleNone
// Default value is NO. Setting to YES will keep the framebuffer data after presenting.
// Doing so will reduce performance and increase memory usage.
@property(nonatomic) BOOL retainedBacking;
// Present the content of OpenGL backed framebuffer on screen as soon as possible.
- (BOOL)present;
// Bind default framebuffer. Use this after drawing to offscreen FBO.
- (void)bindDefaultFrameBuffer;
@end
NS_ASSUME_NONNULL_END