<?xml version="1.0" encoding="UTF-8"?>
<!-- generator="bbPress/1.1" -->
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom">
	<channel>
		<title>cocos2d for iPhone &#187; Topic: Render a sprite on a texture</title>
		<link>http://www.cocos2d-iphone.org/forum/topic/4925</link>
		<description>A fast, easy to use, free, and community supported 2D game engine</description>
		<language>en-US</language>
		<pubDate>Fri, 10 Feb 2012 01:47:15 +0000</pubDate>
		<generator>http://bbpress.org/?v=1.1</generator>
		<textInput>
			<title><![CDATA[Search]]></title>
			<description><![CDATA[Search all topics from these forums.]]></description>
			<name>q</name>
			<link>http://www.cocos2d-iphone.org/forum/search.php</link>
		</textInput>
		<atom:link href="http://www.cocos2d-iphone.org/forum/rss/topic/4925" rel="self" type="application/rss+xml" />

		<item>
			<title>TwoHanded on "Render a sprite on a texture"</title>
			<link>http://www.cocos2d-iphone.org/forum/topic/4925#post-29419</link>
			<pubDate>Tue, 09 Mar 2010 18:02:00 +0000</pubDate>
			<dc:creator>TwoHanded</dc:creator>
			<guid isPermaLink="false">29419@http://www.cocos2d-iphone.org/forum/</guid>
			<description><p>Muchas grazias</p>
<p>wonderfull</p>
<p>haha</p>
<p>thank you</p>
<p>:=)
</p></description>
		</item>
		<item>
			<title>CJ on "Render a sprite on a texture"</title>
			<link>http://www.cocos2d-iphone.org/forum/topic/4925#post-29416</link>
			<pubDate>Tue, 09 Mar 2010 17:21:54 +0000</pubDate>
			<dc:creator>CJ</dc:creator>
			<guid isPermaLink="false">29416@http://www.cocos2d-iphone.org/forum/</guid>
			<description><p>see the part where you did:<br />
<code>glColorMask(FALSE, FALSE, FALSE, TRUE);</code></p>
<p>I'm pretty sure that means you don't want the color information, only the alpha.</p>
<p>so you probably want to use this instead:<br />
<code>glColorMask(TRUE, TRUE, TRUE, TRUE);</code>
</p></description>
		</item>
		<item>
			<title>TwoHanded on "Render a sprite on a texture"</title>
			<link>http://www.cocos2d-iphone.org/forum/topic/4925#post-29410</link>
			<pubDate>Tue, 09 Mar 2010 16:29:59 +0000</pubDate>
			<dc:creator>TwoHanded</dc:creator>
			<guid isPermaLink="false">29410@http://www.cocos2d-iphone.org/forum/</guid>
			<description><p>hello,<br />
1- i try to render a colored sprite with alpha on a texture : using :<br />
//----------------------------------------------<br />
-(void)renderMe<br />
{<br />
        CGSize s = [[CCDirector sharedDirector] winSize];<br />
	renderTarget = [CCRenderTexture renderTextureWithWidth:320 height:480];<br />
	[renderTarget setPosition:ccp(s.width/2, s.height/2)];</p>
<p>	[self addChild:renderTarget z:2];</p>
<p>	brush = [[CCSprite spriteWithFile:@"coloredSpriteAlpha.png"] retain];<br />
	[brush setBlendFunc: (ccBlendFunc) { GL_ZERO,GL_ONE_MINUS_SRC_ALPHA }];<br />
}<br />
//---------------------------------------------<br />
2- then in my time loop i use this</p>
<p>-(void) tick:(ccTime)dt<br />
{<br />
	[renderTarget clear:0 g:0 b:0 a:255];<br />
	[renderTarget begin];<br />
	glColorMask(FALSE, FALSE, FALSE, TRUE);<br />
	[brush setPosition:ccp(240,160)];<br />
	[brush visit];<br />
	glColorMask(TRUE, TRUE, TRUE, FALSE);<br />
	[renderTarget end];<br />
}</p>
<p>//---------------------------------------------</p>
<p>3- the result : i got an alpha effect of my sprite and i can see under the texture</p>
<p>4- but what i want is to show the sprite with its color rendered into this texture surface.</p>
<p>5- any help ??</p>
<p>thank you</p>
<p>:=)
</p></description>
		</item>

	</channel>
</rss>

