hello,
1- i try to render a colored sprite with alpha on a texture : using :
//----------------------------------------------
-(void)renderMe
{
CGSize s = [[CCDirector sharedDirector] winSize];
renderTarget = [CCRenderTexture renderTextureWithWidth:320 height:480];
[renderTarget setPosition:ccp(s.width/2, s.height/2)];
[self addChild:renderTarget z:2];
brush = [[CCSprite spriteWithFile:@"coloredSpriteAlpha.png"] retain];
[brush setBlendFunc: (ccBlendFunc) { GL_ZERO,GL_ONE_MINUS_SRC_ALPHA }];
}
//---------------------------------------------
2- then in my time loop i use this
-(void) tick:(ccTime)dt
{
[renderTarget clear:0 g:0 b:0 a:255];
[renderTarget begin];
glColorMask(FALSE, FALSE, FALSE, TRUE);
[brush setPosition:ccp(240,160)];
[brush visit];
glColorMask(TRUE, TRUE, TRUE, FALSE);
[renderTarget end];
}
//---------------------------------------------
3- the result : i got an alpha effect of my sprite and i can see under the texture
4- but what i want is to show the sprite with its color rendered into this texture surface.
5- any help ??
thank you
:=)