Skip to content

Commit b0732a2

Browse files
committed
GLSL 分屏滤镜
1 parent 68af484 commit b0732a2

21 files changed

+689
-9
lines changed

iOS_Tips/DarkMode.xcodeproj/project.pbxproj

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,18 @@
1010
780F5303236D8462000D0EA8 /* SLGridView.m in Sources */ = {isa = PBXBuildFile; fileRef = 780F5302236D8462000D0EA8 /* SLGridView.m */; };
1111
780F5306236D8570000D0EA8 /* SLImageClipController.m in Sources */ = {isa = PBXBuildFile; fileRef = 780F5305236D8570000D0EA8 /* SLImageClipController.m */; };
1212
7822CCF8235B054200E70C29 /* SLPaddingLabel.m in Sources */ = {isa = PBXBuildFile; fileRef = 7822CCF7235B054200E70C29 /* SLPaddingLabel.m */; };
13+
782CFB1D239DDE95001B5528 /* SLSplitScreenViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 782CFB1C239DDE95001B5528 /* SLSplitScreenViewController.m */; };
14+
782CFB20239DEA05001B5528 /* SLSplitScreenCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 782CFB1F239DEA05001B5528 /* SLSplitScreenCell.m */; };
15+
782CFB23239DFD0F001B5528 /* SplitScreen_2.fsh in Resources */ = {isa = PBXBuildFile; fileRef = 782CFB21239DFD0F001B5528 /* SplitScreen_2.fsh */; };
16+
782CFB24239DFD0F001B5528 /* SplitScreen_2.vsh in Resources */ = {isa = PBXBuildFile; fileRef = 782CFB22239DFD0F001B5528 /* SplitScreen_2.vsh */; };
17+
782CFB27239DFD89001B5528 /* SplitScreen_1.fsh in Resources */ = {isa = PBXBuildFile; fileRef = 782CFB25239DFD88001B5528 /* SplitScreen_1.fsh */; };
18+
782CFB28239DFD89001B5528 /* SplitScreen_1.vsh in Resources */ = {isa = PBXBuildFile; fileRef = 782CFB26239DFD89001B5528 /* SplitScreen_1.vsh */; };
19+
782CFB2B239E0479001B5528 /* SplitScreen_3.vsh in Resources */ = {isa = PBXBuildFile; fileRef = 782CFB29239E0478001B5528 /* SplitScreen_3.vsh */; };
20+
782CFB2C239E0479001B5528 /* SplitScreen_3.fsh in Resources */ = {isa = PBXBuildFile; fileRef = 782CFB2A239E0479001B5528 /* SplitScreen_3.fsh */; };
21+
782CFB2F239E04A2001B5528 /* SplitScreen_4.vsh in Resources */ = {isa = PBXBuildFile; fileRef = 782CFB2D239E04A1001B5528 /* SplitScreen_4.vsh */; };
22+
782CFB30239E04A2001B5528 /* SplitScreen_4.fsh in Resources */ = {isa = PBXBuildFile; fileRef = 782CFB2E239E04A2001B5528 /* SplitScreen_4.fsh */; };
23+
782CFB33239E04AD001B5528 /* SplitScreen_6.fsh in Resources */ = {isa = PBXBuildFile; fileRef = 782CFB31239E04AD001B5528 /* SplitScreen_6.fsh */; };
24+
782CFB34239E04AD001B5528 /* SplitScreen_6.vsh in Resources */ = {isa = PBXBuildFile; fileRef = 782CFB32239E04AD001B5528 /* SplitScreen_6.vsh */; };
1325
782E3EB12373D889001E0DF9 /* SLAvCaptureSession.m in Sources */ = {isa = PBXBuildFile; fileRef = 782E3EB02373D889001E0DF9 /* SLAvCaptureSession.m */; };
1426
782E3EB42373D8C7001E0DF9 /* SLAvWriterInput.m in Sources */ = {isa = PBXBuildFile; fileRef = 782E3EB32373D8C7001E0DF9 /* SLAvWriterInput.m */; };
1527
782E3EB82373F911001E0DF9 /* SLFilterViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 782E3EB72373F911001E0DF9 /* SLFilterViewController.m */; };
@@ -89,6 +101,20 @@
89101
780F5305236D8570000D0EA8 /* SLImageClipController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = SLImageClipController.m; sourceTree = "<group>"; };
90102
7822CCF6235B054200E70C29 /* SLPaddingLabel.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = SLPaddingLabel.h; sourceTree = "<group>"; };
91103
7822CCF7235B054200E70C29 /* SLPaddingLabel.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = SLPaddingLabel.m; sourceTree = "<group>"; };
104+
782CFB1B239DDE95001B5528 /* SLSplitScreenViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = SLSplitScreenViewController.h; sourceTree = "<group>"; };
105+
782CFB1C239DDE95001B5528 /* SLSplitScreenViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = SLSplitScreenViewController.m; sourceTree = "<group>"; };
106+
782CFB1E239DEA05001B5528 /* SLSplitScreenCell.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = SLSplitScreenCell.h; path = DarkMode/OpenGL/Controller/SLSplitScreenCell.h; sourceTree = SOURCE_ROOT; };
107+
782CFB1F239DEA05001B5528 /* SLSplitScreenCell.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; name = SLSplitScreenCell.m; path = DarkMode/OpenGL/Controller/SLSplitScreenCell.m; sourceTree = SOURCE_ROOT; };
108+
782CFB21239DFD0F001B5528 /* SplitScreen_2.fsh */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.glsl; path = SplitScreen_2.fsh; sourceTree = "<group>"; };
109+
782CFB22239DFD0F001B5528 /* SplitScreen_2.vsh */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.glsl; path = SplitScreen_2.vsh; sourceTree = "<group>"; };
110+
782CFB25239DFD88001B5528 /* SplitScreen_1.fsh */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.glsl; path = SplitScreen_1.fsh; sourceTree = "<group>"; };
111+
782CFB26239DFD89001B5528 /* SplitScreen_1.vsh */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.glsl; path = SplitScreen_1.vsh; sourceTree = "<group>"; };
112+
782CFB29239E0478001B5528 /* SplitScreen_3.vsh */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.glsl; path = SplitScreen_3.vsh; sourceTree = "<group>"; };
113+
782CFB2A239E0479001B5528 /* SplitScreen_3.fsh */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.glsl; path = SplitScreen_3.fsh; sourceTree = "<group>"; };
114+
782CFB2D239E04A1001B5528 /* SplitScreen_4.vsh */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.glsl; path = SplitScreen_4.vsh; sourceTree = "<group>"; };
115+
782CFB2E239E04A2001B5528 /* SplitScreen_4.fsh */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.glsl; path = SplitScreen_4.fsh; sourceTree = "<group>"; };
116+
782CFB31239E04AD001B5528 /* SplitScreen_6.fsh */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.glsl; path = SplitScreen_6.fsh; sourceTree = "<group>"; };
117+
782CFB32239E04AD001B5528 /* SplitScreen_6.vsh */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.glsl; path = SplitScreen_6.vsh; sourceTree = "<group>"; };
92118
782E3EAF2373D889001E0DF9 /* SLAvCaptureSession.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = SLAvCaptureSession.h; sourceTree = "<group>"; };
93119
782E3EB02373D889001E0DF9 /* SLAvCaptureSession.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = SLAvCaptureSession.m; sourceTree = "<group>"; };
94120
782E3EB22373D8C7001E0DF9 /* SLAvWriterInput.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = SLAvWriterInput.h; sourceTree = "<group>"; };
@@ -245,6 +271,16 @@
245271
children = (
246272
783FB45F2394A76B0039AEFD /* shaderf.fsh */,
247273
783FB45E2394A76B0039AEFD /* shaderv.vsh */,
274+
782CFB25239DFD88001B5528 /* SplitScreen_1.fsh */,
275+
782CFB26239DFD89001B5528 /* SplitScreen_1.vsh */,
276+
782CFB21239DFD0F001B5528 /* SplitScreen_2.fsh */,
277+
782CFB22239DFD0F001B5528 /* SplitScreen_2.vsh */,
278+
782CFB2A239E0479001B5528 /* SplitScreen_3.fsh */,
279+
782CFB29239E0478001B5528 /* SplitScreen_3.vsh */,
280+
782CFB2E239E04A2001B5528 /* SplitScreen_4.fsh */,
281+
782CFB2D239E04A1001B5528 /* SplitScreen_4.vsh */,
282+
782CFB31239E04AD001B5528 /* SplitScreen_6.fsh */,
283+
782CFB32239E04AD001B5528 /* SplitScreen_6.vsh */,
248284
);
249285
path = ShaderLanguage;
250286
sourceTree = "<group>";
@@ -308,13 +344,17 @@
308344
78A35B1B23978A5D004BCCB7 /* SLShaderCubeViewController.m */,
309345
7860D78C2398D34E008C53EC /* SLMixColorTextureVC.h */,
310346
7860D78D2398D34E008C53EC /* SLMixColorTextureVC.m */,
347+
782CFB1B239DDE95001B5528 /* SLSplitScreenViewController.h */,
348+
782CFB1C239DDE95001B5528 /* SLSplitScreenViewController.m */,
311349
);
312350
path = Controller;
313351
sourceTree = "<group>";
314352
};
315353
78777CDD238FEA15006FA671 /* View */ = {
316354
isa = PBXGroup;
317355
children = (
356+
782CFB1E239DEA05001B5528 /* SLSplitScreenCell.h */,
357+
782CFB1F239DEA05001B5528 /* SLSplitScreenCell.m */,
318358
);
319359
path = View;
320360
sourceTree = "<group>";
@@ -662,12 +702,22 @@
662702
buildActionMask = 2147483647;
663703
files = (
664704
786147F12362A39500C5424C /* Resources.bundle in Resources */,
705+
782CFB33239E04AD001B5528 /* SplitScreen_6.fsh in Resources */,
706+
782CFB24239DFD0F001B5528 /* SplitScreen_2.vsh in Resources */,
707+
782CFB2C239E0479001B5528 /* SplitScreen_3.fsh in Resources */,
665708
78B10490232F57C50051579F /* LaunchScreen.storyboard in Resources */,
666709
78B1048D232F57C50051579F /* Assets.xcassets in Resources */,
667710
783FB4602394A76B0039AEFD /* shaderv.vsh in Resources */,
668711
7851CB372331CC87002295B5 /* SLDarkModeViewController.xib in Resources */,
712+
782CFB30239E04A2001B5528 /* SplitScreen_4.fsh in Resources */,
713+
782CFB23239DFD0F001B5528 /* SplitScreen_2.fsh in Resources */,
714+
782CFB34239E04AD001B5528 /* SplitScreen_6.vsh in Resources */,
669715
78B1048B232F57C30051579F /* Main.storyboard in Resources */,
716+
782CFB27239DFD89001B5528 /* SplitScreen_1.fsh in Resources */,
670717
783FB4612394A76B0039AEFD /* shaderf.fsh in Resources */,
718+
782CFB2F239E04A2001B5528 /* SplitScreen_4.vsh in Resources */,
719+
782CFB2B239E0479001B5528 /* SplitScreen_3.vsh in Resources */,
720+
782CFB28239DFD89001B5528 /* SplitScreen_1.vsh in Resources */,
671721
);
672722
runOnlyForDeploymentPostprocessing = 0;
673723
};
@@ -747,6 +797,7 @@
747797
isa = PBXSourcesBuildPhase;
748798
buildActionMask = 2147483647;
749799
files = (
800+
782CFB1D239DDE95001B5528 /* SLSplitScreenViewController.m in Sources */,
750801
7857977823725C21004CD664 /* SLFaceDetectController.m in Sources */,
751802
78B10488232F57C30051579F /* ViewController.m in Sources */,
752803
78FA0FA02354141E003E456B /* SLAvEditExport.m in Sources */,
@@ -789,6 +840,7 @@
789840
788ACD622390BFD400737EC2 /* SLLoadImageVC.m in Sources */,
790841
78777CE6238FF65C006FA671 /* SLDelayPerform.m in Sources */,
791842
78DAA1162360256200A60F64 /* SLEditSelectedBox.m in Sources */,
843+
782CFB20239DEA05001B5528 /* SLSplitScreenCell.m in Sources */,
792844
7830A59E2358520200BC79BA /* SLEditTextView.m in Sources */,
793845
7860D78E2398D34E008C53EC /* SLMixColorTextureVC.m in Sources */,
794846
78E179312351A4020007E4BB /* SLShotViewController.m in Sources */,

iOS_Tips/DarkMode/OpenGL/.DS_Store

0 Bytes
Binary file not shown.

iOS_Tips/DarkMode/OpenGL/Controller/SLMixColorTextureVC.m

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ @interface SLMixView : UIView
2222
@property(nonatomic, assign) GLuint myColorRenderBuffer; //渲染缓存区
2323
@property(nonatomic, assign) GLuint myColorFrameBuffer; // 帧缓冲区
2424
@property (nonatomic, assign) GLuint vertexBuffer; //顶点缓冲区 用完记得释放
25-
@property(nonatomic, assign)GLuint myPrograme; //着色器程序
25+
@property(nonatomic, assign) GLuint myPrograme; //着色器程序
2626

2727
@property (nonatomic, assign) NSInteger angle; //旋转弧度
2828

@@ -226,7 +226,7 @@ -(void)renderLayer {
226226

227227
//设置清屏颜色
228228
glClearColor(0.3f, 0.45f, 0.5f, 1.0f);
229-
//清除屏幕
229+
//清除颜色缓冲区和深度缓冲区
230230
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
231231

232232
//1.设置视口大小

iOS_Tips/DarkMode/OpenGL/Controller/SLOpenGLController.m

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
#import "SLShaderCubeViewController.h"
1414
#import "SLMixColorTextureVC.h"
1515
#import "SLGLKPyramidVC.h"
16+
#import "SLSplitScreenViewController.h"
1617

1718
@interface SLOpenGLController ()<UITableViewDelegate, UITableViewDataSource>
1819
@property (nonatomic, strong) UITableView *tableView;
@@ -44,8 +45,8 @@ - (void)setupUI {
4445
#pragma mark - Data
4546
- (void)getData {
4647
//tableView、UIAlertView等系统控件,在不自定义颜色的情况下,默认颜色都是动态的,支持暗黑模式
47-
[self.dataSource addObjectsFromArray:@[@" GLKit 加载图片", @" GLKit 绘制正方体", @" GLKit 颜色和纹理混合金字塔",@" OpenGL ShaderLanguage(GLSL) 加载图片", @" GLSL 绘制金字塔", @" GLSL 颜色和纹理混合"]];
48-
[self.classArray addObjectsFromArray:@[[SLLoadImageVC class], [SLCubeViewController class], [SLGLKPyramidVC class], [SLShaderLanguageViewController class], [SLShaderCubeViewController class], [SLMixColorTextureVC class]]];
48+
[self.dataSource addObjectsFromArray:@[@" GLKit 加载图片", @" GLKit 绘制正方体", @" GLKit 颜色和纹理混合金字塔",@" OpenGL ShaderLanguage(GLSL) 加载图片", @" GLSL 绘制金字塔", @" GLSL 颜色和纹理混合", @" GLSL 分屏滤镜"]];
49+
[self.classArray addObjectsFromArray:@[[SLLoadImageVC class], [SLCubeViewController class], [SLGLKPyramidVC class], [SLShaderLanguageViewController class], [SLShaderCubeViewController class], [SLMixColorTextureVC class], [SLSplitScreenViewController class]]];
4950
[self.tableView reloadData];
5051
}
5152
#pragma mark - Getter

iOS_Tips/DarkMode/OpenGL/Controller/SLShaderCubeViewController.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ @interface SLTriangleView : UIView
2222
@property(nonatomic, assign) GLuint myColorRenderBuffer; //渲染缓存区
2323
@property(nonatomic, assign) GLuint myColorFrameBuffer; // 帧缓冲区
2424
@property (nonatomic, assign) GLuint vertexBuffer; //顶点缓冲区 用完记得释放
25-
@property(nonatomic, assign)GLuint myPrograme; //着色器程序
25+
@property(nonatomic, assign) GLuint myPrograme; //着色器程序
2626

2727
@property (nonatomic, assign) NSInteger angle; //旋转弧度
2828

iOS_Tips/DarkMode/OpenGL/Controller/SLShaderLanguageViewController.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ @interface SLView : UIView
4040
@property(nonatomic, assign) GLuint myColorFrameBuffer; // 帧缓冲区
4141
@property (nonatomic, assign) GLuint vertexBuffer; //顶点缓冲区 用完记得释放
4242

43-
@property(nonatomic, assign)GLuint myPrograme; //着色器程序
43+
@property(nonatomic, assign) GLuint myPrograme; //着色器程序
4444

4545
@end
4646

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
//
2+
// SLSplitScreenCell.h
3+
// DarkMode
4+
//
5+
// Created by wsl on 2019/12/9.
6+
// Copyright © 2019 https://github.com/wsl2ls ----- . All rights reserved.
7+
//
8+
9+
#import <UIKit/UIKit.h>
10+
11+
NS_ASSUME_NONNULL_BEGIN
12+
13+
/// 分屏个数选择
14+
@interface SLSplitScreenCell : UICollectionViewCell
15+
16+
@property (nonatomic, strong) NSString *title;
17+
@property (nonatomic, assign) BOOL isSelect;
18+
19+
@end
20+
21+
NS_ASSUME_NONNULL_END
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
//
2+
// SLSplitScreenCell.m
3+
// DarkMode
4+
//
5+
// Created by wsl on 2019/12/9.
6+
// Copyright © 2019 https://github.com/wsl2ls ----- . All rights reserved.
7+
//
8+
9+
#import "SLSplitScreenCell.h"
10+
11+
@interface SLSplitScreenCell ()
12+
@property (nonatomic, strong) UILabel *label;
13+
@end
14+
15+
@implementation SLSplitScreenCell
16+
17+
- (instancetype)initWithFrame:(CGRect)frame {
18+
self = [super initWithFrame:frame];
19+
if (self) {
20+
[self commonInit];
21+
}
22+
return self;
23+
}
24+
25+
- (void)layoutSubviews {
26+
[super layoutSubviews];
27+
self.label.frame = CGRectInset(self.label.frame, 0, 0);
28+
}
29+
30+
- (void)commonInit {
31+
self.label = [[UILabel alloc] initWithFrame:self.bounds];
32+
self.label.textAlignment = NSTextAlignmentCenter;
33+
self.label.font = [UIFont boldSystemFontOfSize:15];
34+
[self addSubview:self.label];
35+
}
36+
37+
- (void)setTitle:(NSString *)title {
38+
_title = title;
39+
self.label.text = title;
40+
}
41+
- (void)setIsSelect:(BOOL)isSelect {
42+
_isSelect = isSelect;
43+
self.label.backgroundColor = isSelect ? [UIColor blackColor] : [UIColor orangeColor];
44+
self.label.textColor = isSelect ? [UIColor whiteColor] : [UIColor blackColor];
45+
}
46+
47+
@end
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
//
2+
// SLSplitScreenViewController.h
3+
// DarkMode
4+
//
5+
// Created by wsl on 2019/12/9.
6+
// Copyright © 2019 https://github.com/wsl2ls ----- . All rights reserved.
7+
//
8+
9+
#import <UIKit/UIKit.h>
10+
11+
NS_ASSUME_NONNULL_BEGIN
12+
13+
/// GLSL 分屏滤镜
14+
@interface SLSplitScreenViewController : UIViewController
15+
16+
@end
17+
18+
NS_ASSUME_NONNULL_END

0 commit comments

Comments
 (0)