Open micahpearlman opened 11 years ago
Micah,
That's great!
I think having a separate branch for GLES 2.0 would be fine (that's how the Cocos2D repo is setup, they don't support both ES 1.0 and ES 2.0). I'm not likely going to have much time to work on this right away, so if you want to fork CCSVG, I think that's a good plan :-)
A bit off topic, but... We're using Cocos2D 2.0 for everything these days. When we ran into the ES 2.0 compatibility issue, I kind of did an end-run around the problem. If you look at my fork of MonkVG, I added a code path for dumping all the vertices in a batch just before they get submitted to OpenGL (1). We're using the OS X version of MonkSVG and MonkVG to dump the vertices to a binary file in an offline preprocess step, then loading the binary file and dumping the data directly into OpenGL. This is super fast (since there's no tesselation at run time), it gives us a better idea of memory footprint (size of file on disk == size of file in memory), and it's compatible with ES 1.0 and ES 2.0 to boot.
Luke
1) https://github.com/lukelutman/MonkVG/commit/6d5d1e03aca38bc45c0329e1d3a73d9733873eb9
So I forked CCSVG and got it all working with Cocos2d 2.0. I spent a bunch of wasted time chasing down some crazy phantom issues with Xcode so I probably changed more things then was necessary. I rebuilt the Xcode workspace and sub-projects, and now CCSVG is not even a project but just a source code copy. Also, the git submodules now point to my versions of MonkVG and MonkSVG. Sorry if that messes you up too much. Would you still be interested in a "pull request" on my fork?
Micah - Can you share your modifications? I'm struggling with getting CCSVG to work with Cocos2d 2.0
Clone my fork of CCSVG to get it to work on Cocos2D 2.x
On May 31, 2013, at 5:46 PM, W1ngy notifications@github.com wrote:
Micah - Can you share your modifications? I'm struggling with getting CCSVG to work with Cocos2d 2.0
— Reply to this email directly or view it on GitHub.
Awesome! Thanks Micah. I was able to run the example project successfully but when I add a CCSVG to a layer in my project the entire screen goes white :(
Hmmm. Perhaps the MonkVG shaders aren't being loaded? I'm not in front of the code so I can't tell you off the top of my head where to check but it should be somewhat obvious.
~~ Micah Pearlman micahpearlman@gmail.com 415-637-6986 http://www.linkedin.com/pub/micah-pearlman/16/7b6/193 ~~
On Jun 1, 2013, at 9:20 AM, W1ngy notifications@github.com wrote:
Awesome! Thanks Micah. I was able to run the example project successfully but when I add a CCSVG to a layer in my project the entire screen goes white :(
— Reply to this email directly or view it on GitHub.
After further investigation I noticed that its my regular CCSprites that are turning white.
Can you render an SVG image with CCSVG?
On Jun 1, 2013, at 9:35 AM, W1ngy notifications@github.com wrote:
After further investigation I noticed that its my regular CCSprites that are turning white.
— Reply to this email directly or view it on GitHub.
Yeah. The svg renders but the other sprites turn white. When I remove the CCSVGSprite then they turn back to their normal colors.
Its only happening to the CCSprites that have a Z order higher than the CCSVGSprite.
Can you set up an example project with the bug? I'm guessing the GL state isn't being properly restored after an SVG image is being rendered. Do you have any GL state optimizations in the Cocos side turned on or something?
On Jun 1, 2013, at 10:22 AM, W1ngy notifications@github.com wrote:
Its only happening to the CCSprites that have a Z order higher than the CCSVGSprite.
— Reply to this email directly or view it on GitHub.
Yeah you're right. Its using one of the colors from the svg and painting everything else with that color.
I tried making a demo app but can't reproduce the problem. I haven't made any changes to any of the cocos2d files in my project.
I replaced all the libraries in my project with fresh copies and now everything works :D
Yay!
On Jun 1, 2013, at 6:40 PM, W1ngy notifications@github.com wrote:
I replaced all the libraries in my project with fresh copies and now everything works :D
— Reply to this email directly or view it on GitHub.
The regex in mkSVG for finding the bounds info ignores anything with decimals. So it finds 512 but not 512.12 or 512.00
I fixed using - regex numberWithUnitPattern( "^(-?\d+(\.\d+)?)(px)?$" );
Luke,
I'm finally getting around to updating MonkVG to be compatible with both OpenGL ES 1.1 AND OpenGL ES 2.0. (you can see the current work in the gles-2.0 branch in MonkVG). I was planning on making sure that CCSVG then works with Cocos2D 2.0.
How would you want to structure these sorts of changes? I'm thinking I should create a fork of your repository and then you can peruse the changes and decide how you want to integrate them sometime later. Or we can work a little more closely and we can figure out a way to make sure CCSVG works both on Cocos2D 1.x and 2.x. Thoughts?