Kit Man
Kit Man

Reputation: 53

cocos2d-X 3.X render texture produce ugly copy?

I am new to cocos2dX

I've searched stackoverflow with the related keywords but can't find any relevant content. So I am posting a new one.

I am using renderTexture to enhance the performance of my app, the image below is one cell(menuItem) of a table(menu), I sort of "flatten" it so it wont contain many sprites / text fields in one cell.

But the output looks jaggy. Is there any ways to have a better output ?

And is that the ugly output caused by the scale factor ?

original

original

render Texture

render texture

Upvotes: 2

Views: 1304

Answers (2)

Denis Lazarev
Denis Lazarev

Reputation: 128

I do not know why just rendered sprite is not "pixel perfect", but my solution is:

renderTexture->getSprite()->getTexture()->setAntiAliasTexParameters()

Upvotes: 0

Kit Man
Kit Man

Reputation: 53

found out the issue is related to the scale-factor of cocos2d-X. solution:

  1. Scale up the content to its original width and height (cancel the auto scaling in cocos2d-X)
  2. capture the content's screenshot with the exact same dimension REnderTexture
  3. create a sprite from the capture
  4. scale back down the resulting sprite with cocos2d-X's scale factor

hope that will help someone in need too

Upvotes: 1

Related Questions