-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMGLKView.h
66 lines (48 loc) · 2.11 KB
/
MGLKView.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
//
// 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.
//
#ifndef MGLKView_h
#define MGLKView_h
#import "MGLContext.h"
@class MGLKView;
@protocol MGLKViewDelegate <NSObject>
// Implement this method to draw to the view using current OpenGL
// context associated with the view.
- (void)mglkView:(MGLKView *)view drawInRect:(CGRect)rect;
@end
// NOTE: do not subclass this class, use delegate if needed to override
// the drawing method.
@interface MGLKView : MGLKNativeView
@property(nonatomic) MGLContext *context;
@property(nonatomic, assign) IBOutlet id<MGLKViewDelegate> delegate;
// 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;
@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
@property(nonatomic, weak, readonly) MGLLayer *glLayer;
// Return the size of the OpenGL default framebuffer.
@property(readonly) CGSize drawableSize;
@property(nonatomic, readonly) NSInteger drawableWidth;
@property(nonatomic, readonly) NSInteger drawableHeight;
// OpenGL id of the underlying default framebuffer object.
// Might not necessary be zero.
@property(readonly) uint32_t defaultOpenGLFrameBufferID;
#if TARGET_OS_IOS || TARGET_OS_TV
// Enable setNeedsDisplay method.
@property(nonatomic) BOOL enableSetNeedsDisplay;
@property(readonly, strong) UIImage *snapshot;
#endif
- (id)initWithFrame:(CGRect)frame context:(MGLContext *)context;
// Redraw the view's contents immediately.
- (void)display;
// Binds the underlying default framebuffer object to OpenGL ES.
// Use this after drawing to offscreen FBO.
- (void)bindDrawable;
@end
#endif /* MLKView_h */