From 2f825a6065784a5d8b4a281e182a33c6d79ac48e Mon Sep 17 00:00:00 2001 From: alex1704 Date: Mon, 4 May 2015 20:07:25 +0300 Subject: [PATCH] [NSBundle mainBundle] changed to [NSBundle bundleForClass:[self class]] for BCMeshShader::loadProgram in order to be able find resource when embeded in framework --- BCMeshTransformView/BCMeshShader.m | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/BCMeshTransformView/BCMeshShader.m b/BCMeshTransformView/BCMeshShader.m index 346ec49..539b0dd 100644 --- a/BCMeshTransformView/BCMeshShader.m +++ b/BCMeshTransformView/BCMeshShader.m @@ -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;