Hi,
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.
In States with three Pixels named 1, 2 and 3 its like :
<- [123] <- u = 0.0
<- [231] <- u = 0.333
<- [312] <- u = 0.667
<- [123] <- u = 1.0
in CCSprite I added a "setTextureCoordinates" function :
-(void) setTextureCoordinatesBL:(CGPoint)bl BR:(CGPoint)br TL:(CGPoint)tl TR:(CGPoint)tr
{
quad_.bl.texCoords.u = bl.x;
quad_.bl.texCoords.v = bl.y;
quad_.br.texCoords.u = br.x;
quad_.br.texCoords.v = br.y;
quad_.tl.texCoords.u = tl.x;
quad_.tl.texCoords.v = tl.y;
quad_.tr.texCoords.u = tr.x;
quad_.tr.texCoords.v = tr.y;
[selfRenderTextureAtlas_ updateQuad:&quad_ atIndex:0];
}
The Texture is moving as expected but the pixeles are not comming backin from the right side:
<- [123] <- u = 0.0
<- [23 ] <- u = 0.333
<- [3 ] <- u = 0.667
<- [ ] <- u = 1.0
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 ?
in CCTexture2D I found this :
-(void) setAliasTexParameters
{
ccTexParams texParams = { GL_NEAREST, GL_NEAREST, GL_CLAMP_TO_EDGE, GL_CLAMP_TO_EDGE };
[self setTexParameters: &texParams];
}
-(void) setAntiAliasTexParameters
{
ccTexParams texParams = { GL_LINEAR, GL_LINEAR, GL_CLAMP_TO_EDGE, GL_CLAMP_TO_EDGE };
[self setTexParameters: &texParams];
}
so it seems that Textures ALWAYS loaded in clamped...
any suggestions?