9 ms·
Ejecta – A Fast, Open Source JavaScript, Canvas and Audio Implementation for iOS
- al2o3cr 13y agoLooks cool, but "works out of the box except for controls" is pretty much "doesn't work out of the box" for games...
- RyanZAG 13y agoWould be nice to see some benchmarks. I can't see how this could be faster than just running it in Safari. In Safari you get access to far faster javascript jit than you do in the embedded app js engine. The app itself just translates the javascript canvas calls into objc calls to the core graphics.. which is what safari's canvas does anyway? Is the extra level of indirection through safari enough to compensate for slower jit? Plus it's a lot harder to compile this than it is to put a js game on the web. Needs benchmarks to be able to make any decisions.
- ttuulari 13y agoOne strong point for Ejecta is webGL support. Safari doesn't support webGL.
- Revex 13y agoCheck again. Ejecta doesn't support webGL.
- phoboslab 13y agoNot true. Ejecta has been supporting WebGL for a while now. It was announced in this blog post: http://impactjs.com/blog/2013/05/ejecta-1-3 http://impactjs.com/blog/2013/05/ejecta-1-3 If you're doing WebGL stuff, I would encourage you to get the current Ejecta dev version from Github, instead of the last release version. There have been a lot of WebGL related bugfixes since: https://github.com/phoboslab/Ejecta https://github.com/phoboslab/Ejecta
- pjmlp 13y agoNative is really the only way to go for serious graphics programming on mobile devices, specially given the sore state of mobile WebGL.
- phoboslab 13y ago(Ejecta dev here) Ejecta uses OpenGL ES 2 for Canvas, not Core Graphics. The default demo that comes with Ejecta[1] runs with 60fps on the iPhone4S. Just try it in Mobile Safari. Even Desktop Browsers struggle with this. Of course it's a contrived benchmark, but it still makes a point, I think :) There are also a lot of other reason to use Ejecta. If you _want_ to distribute your App in the AppStore, the alternative is to use a WebView framework such as PhoneGap, which can't use JIT either. That said, the raw JavaScript performance is rarely the bottleneck for games - most of the time, drawing is. [1] http://phoboslab.org/crap/bezier/ http://phoboslab.org/crap/bezier/
- mamcx 13y agoHi, sorry to hijack the thread. What JS chart tool play well with ejecta in iOS? You know?
- sanxiyn 13y agoEjecta seems to use OpenGL to implement canvas. WebKit (thus Safari) does not do that, and there is significant performance gap there. Company 100, Inc. maintains a patch to WebKit that use OpenGL to implement canvas. It is not yet merged, but I have tried it and it is significantly faster than stock WebKit for game scenario. So I have no trouble believing Ejecta is faster. http://www.dorothybrowser.com/portfolio/canvasgl/ http://www.dorothybrowser.com/portfolio/canvasgl/
- adamnemecek 13y agoIt's not really a "JavaScript implementation" when it appears to be just a wrapper around JavaScriptCore, innit bruv.
- hopfog 13y agoEjecta is awesome. So is ImpactJS. Dominic (the creator) is experimenting with making Ejecta cross-platform so hopefully we will see an Android version soon.
- camus2 13y agoThe JavaScriptCore API is private on iOS, which means you're not allowed to link to it. Ejecta therefore comes bundled with its own version of the library to circumvent these restrictions. So you are basically using another VM(a second javascript core) in an IOS app. Isnt it forbidden to do so,running VMs in IOS apps? A better approach would be to do like TITANIUM ,except that you expose a CANVAS like API,so that your javascript canvas framework is compatible with it => less work,and no trick that would make your app kicked out of the store once the scheme is busted.
- Rafert 13y agoNo, it isn't. It would make the likes of Xamarin and RubyMotion impossible. You're confused with the fact that App Store policies do not allow downloading and running new executable code.
- camus2 13y agoI thought Xamarin and RM compiled to objc.
- adrnsly 13y agoI use Ejecta for almost all my prototyping, super easy to make changes during a meeting to do live iteration testing.
- checker659 13y agoWhy not use v8 and make the runtime run "everywhere"? Edit: Sorry, just realised the development is done in Objective-C.
- sanxiyn 13y agoV8 only has C++ API which makes it quite inconvinient to use if you aren't using C++.
- phoboslab 13y agov8 also doesn't have an interpreter mode, just a compiler. On iOS you can't allocate writable+executable memory, so you can't use v8. As I mentioned in another thread, I currently have a toy project that implements most of the Canvas2D API in plain C. Maybe this will amount to something some day.
- checker659 13y agoAFAIK, you can turn off JIT compilation in v8, isn't that true?
- sanxiyn 13y agoNo, you can't turn off JIT compilation in V8. V8 has no not-JIT execution engine.
- pcwalton 13y agoOne of the coolest things I learned from the original blog post [1] on Ejecta was a trick that the library uses for drawing polygons on the GPU in OpenGL without triangulating them first [2]. It's one of the coolest graphics programming tricks I've ever seen and when I understood how it worked my mind was blown. [1]: http://phoboslab.org/log/2012/09/ejecta http://phoboslab.org/log/2012/09/ejecta [2]: http://www.glprogramming.com/red/chapter14.html#name13 http://www.glprogramming.com/red/chapter14.html#name13
- sanxiyn 13y agoUsing stencil buffer to draw polygons without tesselation seems to be one of those folklores that is not widely known. I learned about it some years ago here: http://zrusin.blogspot.com/2006/07/hardware-accelerated-polygon-rendering.html http://zrusin.blogspot.com/2006/07/hardware-accelerated-poly...
- phoboslab 13y agoWith a bit more trickery, you can even implement the Non-Zero fill rule (Canvas2D default), instead of the simpler Even-Odd rule. Ejecta now supports both: https://github.com/phoboslab/Ejecta/blob/master/Source/Ejecta/EJCanvas/2D/EJPath.mm#L361-L396 https://github.com/phoboslab/Ejecta/blob/master/Source/Eject...
- skavish 13y agothis is impressive! btw do you have any numbers on how bezie drawing using OpenGL compares to regular drawing on 2d canvas, performance wise? let's say I have an html5 app which draws stuff using 2d canvas. do you think it makes sense to draw to webgl instead using implementation like yours, i.e. mapping 2d canvas api to webgl?
- mattdesl 13y agoCould I also use this technique to clip a scene to the path of a complex polygon? How does it hold up with many overlapping shapes of varying color; wouldn't it lead to far more state changes and ultimately much greater fill-rate? And what are your thoughts on using this for font rendering? This looks brilliant. Thanks for the info.