首页
学习
活动
专区
工具
TVP
发布
社区首页 >问答首页 >Coco2d 2.1和Xcode 7 iOS 9 crash ccShader

Coco2d 2.1和Xcode 7 iOS 9 crash ccShader
EN

Stack Overflow用户
提问于 2015-06-16 17:44:57
回答 4查看 6.6K关注 0票数 21

我测试了Xcode7,但我的cocos2d 2.1游戏在模拟器或设备上崩溃了:

ccShader_PositionColorLenghtTexture_frag.h

代码语言:javascript
复制
2015-06-15 22:36:13.319 NanoWar[18789:456971] cocos2d: ERROR: 0:12: '' : syntax error: #extension must always be before any non-preprocessor tokens

代码语言:javascript
复制
cocos2d: ERROR: 0:26: Invalid call of undeclared identifier 'fwidth'

这个类使游戏崩溃

代码语言:javascript
复制
#extension GL_OES_standard_derivatives : enable                                                                             

#ifdef GL_ES                                                                                                                
varying mediump vec4 v_color;                                                                                               
varying mediump vec2 v_texcoord;                                                                                            
#else                                                                                                                       
varying vec4 v_color;                                                                                                       
varying vec2 v_texcoord;                                                                                                    
#endif                                                                                                                      

void main()                                                                                                                 
{                                                                                                                           
#ifdef GL_OES_standard_derivatives                                                                                          
#if defined GL_OES_standard_derivatives                                                                                     
    gl_FragColor = v_color*smoothstep(0.0, length(fwidth(v_texcoord)), 1.0 - length(v_texcoord));                           
#else                                                                                                                       
    gl_FragColor = v_color*step(0.0, 1.0 - length(v_texcoord));                                                             
#endif                                                                                                                      
#endif                                                                                                                      
}
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/30864055

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档