I tested Xcode 7 with but my cocos2d 2.1 games crash on simulator or on devices:
ccShader_PositionColorLenghtTexture_frag.h
2015-06-15 22:36:13.319 N
Using the accepted answer above, but for newer versions of cocos2d:
In CCShader.m replace the lines
static GLint
CompileShaderSources(GLenum type, NSArray *sources)
{
with
#define EXTENSION_STRING "#extension GL_OES_standard_derivatives : enable"
static NSString * g_extensionStr = @EXTENSION_STRING;
static NSArray * PrependExtensionIfNeeded(NSArray *sources)
{
NSMutableArray *mutableSources = [NSMutableArray array];
BOOL hasExtension = NO;
for (NSString *source in sources)
{
NSString *newSource = [source copy];
if([source rangeOfString:g_extensionStr].location != NSNotFound)
{
hasExtension = YES;
NSArray *strs = [source componentsSeparatedByString:g_extensionStr];
newSource = [strs componentsJoinedByString:@"\n"];
}
[mutableSources addObject:newSource];
}
if (hasExtension)
{
NSMutableString *firstSource = [NSMutableString stringWithString:[mutableSources firstObject]];
[firstSource insertString:[NSString stringWithFormat:@"%@\n", g_extensionStr] atIndex:0];
[mutableSources replaceObjectAtIndex:0 withObject:firstSource];
}
return mutableSources;
}
static GLint
CompileShaderSources(GLenum type, NSArray *sources)
{
sources = PrependExtensionIfNeeded(sources);