<?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: CCSprite texturemapping : how to cycle UV-Coordinates ?</title>
		<link>http://www.cocos2d-iphone.org/forum/topic/4000</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:49:04 +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/4000" rel="self" type="application/rss+xml" />

		<item>
			<title>h.hamm on "CCSprite texturemapping : how to cycle UV-Coordinates ?"</title>
			<link>http://www.cocos2d-iphone.org/forum/topic/4000#post-23995</link>
			<pubDate>Fri, 22 Jan 2010 14:49:37 +0000</pubDate>
			<dc:creator>h.hamm</dc:creator>
			<guid isPermaLink="false">23995@http://www.cocos2d-iphone.org/forum/</guid>
			<description><p>Oh dear... long story short, here is the solution :</p>
<p>ccTexParams params = { GL_LINEAR, GL_LINEAR, GL_REPEAT, GL_REPEAT };<br />
[texture_ setTexParameters:&#38;params];
</p></description>
		</item>
		<item>
			<title>h.hamm on "CCSprite texturemapping : how to cycle UV-Coordinates ?"</title>
			<link>http://www.cocos2d-iphone.org/forum/topic/4000#post-23994</link>
			<pubDate>Fri, 22 Jan 2010 14:41:44 +0000</pubDate>
			<dc:creator>h.hamm</dc:creator>
			<guid isPermaLink="false">23994@http://www.cocos2d-iphone.org/forum/</guid>
			<description><p>Hi,</p>
<p>I want to cycle through texture coordinates like : all pixels of the texture are scrolling via u-coordinate out of the sprite and comming back from the right.<br />
In States with three Pixels named 1, 2 and 3 its like :<br />
&#60;- [123] &#60;- u = 0.0<br />
&#60;- [231] &#60;- u = 0.333<br />
&#60;- [312] &#60;- u = 0.667<br />
&#60;- [123] &#60;- u = 1.0</p>
<p>in CCSprite I added a "setTextureCoordinates" function :<br />
-(void) setTextureCoordinatesBL:(CGPoint)bl BR:(CGPoint)br TL:(CGPoint)tl TR:(CGPoint)tr<br />
{<br />
	quad_.bl.texCoords.u = bl.x;<br />
	quad_.bl.texCoords.v = bl.y;<br />
	quad_.br.texCoords.u = br.x;<br />
	quad_.br.texCoords.v = br.y;<br />
	quad_.tl.texCoords.u = tl.x;<br />
	quad_.tl.texCoords.v = tl.y;<br />
	quad_.tr.texCoords.u = tr.x;<br />
	quad_.tr.texCoords.v = tr.y;<br />
	[selfRenderTextureAtlas_ updateQuad:&#38;quad_ atIndex:0];<br />
}</p>
<p>The Texture is moving as expected but the pixeles are not comming backin from the right side:</p>
<p>&#60;- [123] &#60;- u = 0.0<br />
&#60;- [23 ] &#60;- u = 0.333<br />
&#60;- [3  ] &#60;- u = 0.667<br />
&#60;- [   ] &#60;- u = 1.0</p>
<p>So I guess its because CCSprites loads its texture via GL_CLAMP_TO_EDGE. In my case it should be GL_REPEAT. Where could I say how to load a texture ?</p>
<p>in CCTexture2D I found this :<br />
-(void) setAliasTexParameters<br />
{<br />
	ccTexParams texParams = { GL_NEAREST, GL_NEAREST, GL_CLAMP_TO_EDGE, GL_CLAMP_TO_EDGE };<br />
	[self setTexParameters: &#38;texParams];<br />
}</p>
<p>-(void) setAntiAliasTexParameters<br />
{<br />
	ccTexParams texParams = { GL_LINEAR, GL_LINEAR, GL_CLAMP_TO_EDGE, GL_CLAMP_TO_EDGE };<br />
	[self setTexParameters: &#38;texParams];<br />
}</p>
<p>so it seems that Textures ALWAYS loaded in clamped... </p>
<p>any suggestions?
</p></description>
		</item>

	</channel>
</rss>

