加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 百科 > 正文

Coco2d 2.1和Xcode 7 iOS 9崩溃ccShader

发布时间:2020-12-15 01:57:28 所属栏目:百科 来源:网络整理
导读:我测试了Xcode 7,但是我的cocos2d 2.1游戏在模拟器或设备上崩溃: ccShader_PositionColorLenghtTexture_frag.h 2015-06-15 22:36:13.319 NanoWar[18789:456971] cocos2d: ERROR: 0:12: '' : syntax error: #extension must always be before any non-prepr
我测试了Xcode 7,但是我的cocos2d 2.1游戏在模拟器或设备上崩溃:

ccShader_PositionColorLenghtTexture_frag.h

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

cocos2d: ERROR: 0:26: Invalid call of undeclared identifier 'fwidth'

这个游戏崩溃了

#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                                                                                                                      
}

解决方法

我在 forum.cocos2d-objc.org是“rae”,我也可以把我的答案放在这里,因为所有的道路都通向StackOverflow。

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读