Cocos2d ver 2.0 and verlet rope

Cocos2d ver 2.0 and verlet rope
0.0 0

Hi, everyone.

I just faced a problem. I was working with v1.0.0 - beta. 
And I didn't think about this, but then we started to adding 
images for diffirent devices and tried to used prefixes : -hd, -ipad, -ipadhd and so on. 
And found out that v1.0.0 didn't support this prefixes. I downloaded ver2.0.0. and this problem with file prefixes gone. 

But appears another issue. I using VerletRope. In v1.0.0. it worked fine, but in second version I got exception : 
"GL_CLAMP_TO_EDGE should be used in NPOT dimensions". It happends because Verlet Rope function : createRope using CCTexture2D :

CCSprite *tmpSprite = [CCSprite spriteWithBatchNode:spriteSheet rect:CGRectMake(0,0,multiplier,[[[spriteSheet textureAtlas] texture] pixelsHigh])];
float32 fl = [[spriteSheet textureAtlas] texture].pixelsHigh;    
[tmpSprite.texture setTexParameters:&params];

Last string produces exception, because in v2 CCTexture2D should be in power of two dimension. It can be hacked if we comment Assert strings in CCTexture2D : 

NSAssert( (width_ == ccNextPOT(width_) || texParams->wrapS == GL_CLAMP_TO_EDGE) &&
             (height_ == ccNextPOT(height_) || texParams->wrapT == GL_CLAMP_TO_EDGE),
             @"GL_CLAMP_TO_EDGE should be used in NPOT dimensions");

But, if we do this exception will disappears, and all levels working well, but textures of verlert rope are not draw, just black squares.

So, question is simple. How I can handle this? 

- Is there any way to make verlet rope working on v2.0.0.? Or maybe there is another analog of verler rope for v2.0.0?  
- Or maybe I should stick with previous version and implement file prefixes myself?

Thanks for your time.


OpenGL ES 2.0 supports textures that whose dimensions is not power of two, so the engine(ver2.0.x) didn’t translate it to power of two. But you can not set some parameters such as GL_CLAMP_TO_EDGE.
If you want to use these parameters you should use POT pictures, or you should hack engine that translate image data into POT, then generate the corresponding texture just as cocos2d-x v1.x does.


Minggo, thanks for the answer!

What exactly parameters you saying about? I didn’t mind to turn them off (not set) as far as my app will work without them. I did the search for : GL_CLAMP_TO_EDGE. And commented out four lines with : glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE );
But this doesn’t solve the problem, I suppose there are some other parameter that I need to turn off?

And about second option, with hacking engine, it will be great if you give some direction about there in v1.x I should search for this hack (and then I will try to move it to v2.x);