Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

_display link memory issue fixed #21

Open
wants to merge 8 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions BCMeshTransformView/BCMeshShader.m
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,14 @@ - (BOOL)loadProgram

_program = glCreateProgram();

vertShaderPathname = [[NSBundle mainBundle] pathForResource:[self shaderName] ofType:@"vsh"];
NSBundle *bundle = [NSBundle bundleForClass:[self class]];
vertShaderPathname = [bundle pathForResource:[self shaderName] ofType:@"vsh"];
if (![self compileShader:&vertShader type:GL_VERTEX_SHADER file:vertShaderPathname]) {
NSLog(@"Failed to compile vertex shader \"%@\"", [self shaderName]);
return NO;
}

fragShaderPathname = [[NSBundle mainBundle] pathForResource:[self shaderName] ofType:@"fsh"];
fragShaderPathname = [bundle pathForResource:[self shaderName] ofType:@"fsh"];
if (![self compileShader:&fragShader type:GL_FRAGMENT_SHADER file:fragShaderPathname]) {
NSLog(@"Failed to compile fragment shader \"%@\"", [self shaderName]);
return NO;
Expand Down
2 changes: 1 addition & 1 deletion BCMeshTransformView/BCMeshTransform.h
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ extern NSString * const kBCDepthNormalizationAverage;


@interface BCMutableMeshTransform : BCMeshTransform

@property (nonatomic, copy) NSString *depthNormalization;

+ (instancetype)meshTransform;
Expand Down
1 change: 1 addition & 0 deletions BCMeshTransformView/BCMeshTransform.mm
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,7 @@ - (BCMeshVertex)vertexAtIndex:(NSUInteger)vertexIndex


@implementation BCMutableMeshTransform
@dynamic depthNormalization;

+ (instancetype)meshTransform
{
Expand Down
4 changes: 3 additions & 1 deletion BCMeshTransformView/BCMeshTransformView.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,14 @@
//

#import <UIKit/UIKit.h>

#import <GLKit/GLKit.h>
#import "BCMeshTransform.h"
#import "BCMutableMeshTransform+Convenience.h"

@interface BCMeshTransformView : UIView

@property (nonatomic, strong) GLKView *glkView;

// Animatable. Animation won't fire for incompatible mesh transforms.
// Animation will always begin from current state, even if UIViewAnimationOptionBeginFromCurrentState
// option is not set. Defaults to identity transform with 4 vertices.
Expand Down
6 changes: 4 additions & 2 deletions BCMeshTransformView/BCMeshTransformView.m
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,6 @@

@interface BCMeshTransformView() <GLKViewDelegate>

@property (nonatomic, strong) GLKView *glkView;

@property (nonatomic, strong) BCMeshShader *shader;
@property (nonatomic, strong) BCMeshBuffer *buffer;
@property (nonatomic, strong) BCMeshTexture *texture;
Expand Down Expand Up @@ -120,6 +118,10 @@ - (void)commonInit
self.meshTransform = [BCMutableMeshTransform identityMeshTransformWithNumberOfRows:1 numberOfColumns:1];
}

-(void)dealloc {
[_displayLink invalidate];
}

- (void)layoutSubviews
{
[super layoutSubviews];
Expand Down