Is there a way to morph / convert a circular sprite into a square programmatically?
Posted
by
John
on Stack Overflow
See other posts from Stack Overflow
or by John
Published on 2014-08-23T06:42:12Z
Indexed on
2014/08/23
10:21 UTC
Read the original article
Hit count: 261
cocos2d-x
|cocos2d-x-3.0
I have a sprite which is basically just an image of a circle and some content inside.
Is there a way that I can programmatically stretch / distort it into something like:
I don't care so much about the distortion. The original circular image is 100x100px, and the modified image should also be 100x100px. So its really the content that is being distorted.
Can this be done using shaders or some other programmatic way ? The initial circular image is most likely determined at run time, which is why I need to programmatically convert the circular sprite to square.
Please do not edit the tags, as the question applies to both versions of cocos2d (iPhone & x), and the solution will most likely work in both regardless of whether one uses C or C++ since the apis are similar, and OpenGL commands work similarly.
© Stack Overflow or respective owner