Cocos2d iphone 来自精灵表和着色器的Cocos 2d Iphone v3精灵
搜索stackoverflow,Google没有返回任何结果Cocos2d iphone 来自精灵表和着色器的Cocos 2d Iphone v3精灵,cocos2d-iphone,shader,sprite,Cocos2d Iphone,Shader,Sprite,搜索stackoverflow,Google没有返回任何结果 [[CCSpriteFrameCache sharedSpriteFrameCache] addSpriteFramesWithFile:@"sun.plist"]; CCSprite* sprite = [CCSprite spriteWithImageNamed:@"8.jpg" ]; sprite.position = ccp(self.contentSize.width/2 + 300, self.contentSize
[[CCSpriteFrameCache sharedSpriteFrameCache] addSpriteFramesWithFile:@"sun.plist"];
CCSprite* sprite = [CCSprite spriteWithImageNamed:@"8.jpg" ];
sprite.position = ccp(self.contentSize.width/2 + 300, self.contentSize.height/2);
[self addChild: sprite];
显示屏将显示从plist中选择的精灵
但如果我应用着色器程序,精灵会重叠
解决办法是什么?
不带着色器:
重叠:
thx
---UPDT 05.05.2014
@interface gSprite : CCSprite
...
- (void) draw;
@end
- (void) draw{
....
_shaderProgram = [[CCShaderCache sharedShaderCache] programForKey:@"LightingBlurShader"];
[_shaderProgram use];
[_shaderProgram setUniformsForBuiltins];
glUniform1i([[Engine sharedEngine] lightCount], activeLighCount);
glUniform2fv([[Engine sharedEngine] lightPositionUniformLocation], activeLighCount, arrayLigthPos);
glUniform1fv([[Engine sharedEngine] lightFalloffUniformLocation],activeLighCount, arrayLightFalloff);
glUniform1fv([[Engine sharedEngine] lightIntensityUniformLocation], activeLighCount, arrayLightIntensity);
....
[super draw];
} //draw
我认为你的图片链接不起作用,你可以直接将这些图片添加到问题中。链接图片需要10个声誉帖子,但我是新手成员)我将图片重新加载到另一个站点我已经为你添加了图片。你能不能也发布应用着色器的代码?我更新了开始帖子。可能问题是我需要传递动画当前帧的着色器坐标?