Nearest neighbor "pixelly" texturing in Cocos2d?

I am trying to scale the sprite, but the texture needs to be scaled using "pixelly", for example, retro games.

I know how to do this in OpenGL, but I'm not sure how to do it in Cocos2d.

How can I do it? Is there any way to get OpenGL? Or something through Cocos2d?

+3
source share
2 answers

With Cocos2d 0.8 (the latter) it is very simple ...

You just call setAliasTexParameters on your texture ...

eg:

Sprite * aSprite = [Sprite spriteWithFile: @ "someTextureImage.png"];

[aSprite.texture setAliasTexParameters];

+7
source

Cocos2dx v3

Sprite* my_sprite = Sprite::create("my_image.png");
my_sprite->getTexture()->setAliasTexParameters();
my_sprite->setScale(4);

.

+1

Source: https://habr.com/ru/post/1714301/


All Articles