WebGL framework - what's the best choice? X3DOM? - frameworks

I'm about to start a Web application that will use interactive generated 3D content. Aim is to let it run natively in the browser, i.e. no Flash is allowed, only JavaScript + HTML5.
Apart from using pure WebGL it's better to use a lib that will offer a more high level interface.
The approach of X3DOM looks great for me - and it looks like it's supposed to become native in the browser and the lib will pave the road.
But after my first impressions I'm not sure if it's lightweight enough. Apart from the 400kb JS-File it slows down Firefox.
The features I need are not many. The whole scene set up could be easily done by "hand". But I need user interaction including to figure out where the user clicks. And later I want to be able to load and insert 3D objects in a common file format.
PS: Browsers of choice are Firefox and Webkit based ones. Desktop and Mobile ones. I don't care about IE.
PPS: Yes, I know the question: WebGL Framework

X3DOM is great when you come from an X3D background (and developed by great people), but if you have no preference watsoever, Three.JS would be my pick.

I looked at most WebGL frameworks just last week, and it indeed seems almost every one of them is in the 300kB range. That's too heavy for me, too. Luckily I found lightgl.js which has everything you need to get started in 28kB, MIT license.
The main thing for me is just abstracting canvas, shader and texture initialization. But lightgl.js does also have some mouse handling and model loading etc.

i think the decision boils down to:
do you want to have a more design or programmer approach.
x3dom: its leveraging of x3d for describing the scene lends itself to a more designer approach, with just the adding of the x3dom css and js one can do this :
<X3D><Scene><Shape><Box/></Shape</Scene></X3d>
three.js: only allows for scene generation through javascript, and a lot of additional code is necessary just to set up the canvas. view the source of this simple box example: http://stemkoski.github.com/Three.js/Template.html
neither way is wrong, i prefer designing the scene and then using js when needed for any computations.

Related

Best Way to approach a 3D customisable Globe in Flutter?

following question:
I'm currently working on a Travel App and I thought of the idea of implementing an 3D Globe that can be rotated by the user. I thought of the Globe as a basic White Sphere with the borders of the countries visible as a stroke. All countries that have been visited should be filled with a color.
I thought of implementing it with the unity widget, but I'd like to maintain a lightweight feeling.
Is there a way to emulate js or WebGL?
What do you think is the best way to approach this?
Thank you for your time
Linus
You can use webview_flutter, I played with it a little bit to display planet models in javascript library three.js. Thanks to it you can use it like standard js instance of it with only one drawback that I didn't try to solve: I was unable to run it in browser mode as Flutter needs to emulate js itself by platform speciffic way. There is option to load js/html code from local assets but then you will not be able to load models in js directly as you will face cors policy restrictions, then the only way is to pass models as json from flutter code. It works pretty well, supports two way communication between js and flutter so you can also add events to model etc.

Dynamic Chart using Xamarin Forms

I am newbie in Xamarin; I know there must be ready components for what I need, already I searched but not yet found.
I need to create a dynamic graphic like this:
http://www.highcharts.com/demo/dynamic-update
I wore this in PhoneGap (html5 + JS), but now I'm moving to Xamarin forms and would like to know if any third component is what I need or I'll have to do everything from scratch.
Thank you.
I'm currently looking into graphing too and OxyPlots seems to be a pretty good line graph tool. I don't think it supports dynamic updating so you'd have to program it to update manually when new data points come available.
I've not gotten round to actually using this myself but I thought I'd post this here in case it works for you.
Edit: Here's a list of examples. Also you can add it to your project using nuget so it should be easy to set up.
I'm using Syncfusion controls for Xamarin.Forms and I'm satisfied with it. They also have a free license for individual developers and small businesses.
For dynamically updated Xamarin charts SciChart offers an extremely high performance solution. With the SciChart Xamarin Chart control you can draw up to a million points, zoom, pan and scroll big datasets interactively.
Check out performance demos here:
https://www.scichart.com/example/xamarin-chart-realtime-fifo-scrolling-chart-example/
https://www.scichart.com/example/xamarin-chart-performance-demo-example/
https://www.scichart.com/example/xamarin-chart-ecg-monitor-demo-example/
Disclosure: I am the tech lead on the SciChart Xamarin project

Display html in unity3D

I'm working on a Unity App where I need to load some html pages(with touch support).
I've found 3 plugins for that and each have some limitations. Are there any other good plugins so I can test and see.
These are the ones I'm currently testing
uWebKit - having a issue with higher resolutions(when swiping the carousal it gets slow with higher resolutions)
Coherent UI - Doesn't support touch events. Have to write code to make touch works properly.
Awesomium - Didn't test this, because it seems bit too expensive.
If any of you know of any other plugins for that please list them.
Thanks
Have you tried PowerUI (http://powerui.kulestar.com/) it is a plugin which renders HTML within Unity directly. (Rather than using an external web renderer, and then copying the texture into Unity).
It only renders a subset of HTML/JS, so it is primarily suited to building up interfaces from scratch, but it is quite useful, fast, and I believe it supports touch events.

GWT Image Cropping

I'm building a website using GWT and would like to add Image Cropping capability so users can upload their profile image and then crop it as they need to. I'm looking for something similar to Jcrop but in GWT.
I found THIS and THIS code samples how to crop an image on the client side but there is no UI part where user can select part of their image that needs to be cropped.
There were also couple of similar questions on SO (for example and this GWT with Jcrop) but nobody gave an example of the selection part of the image that uses pure GWT.
If you have an idea how to do it please share and I'm sure other people will leverage from this in the future.
Here is the example of what I'm looking for:
I recommend that you take route #1. I've been working full time in GWT for awhile and spend a lot of time looking for libraries, and this is one that I just don't think exists yet.
Here are your options:
Wrap Jcrop using a JSNI interface.
Pros: You have to include JQuery and JCrop, which are small and robust
Cons: Learning how to build your first JSNI wrapper can be a pain
Build your own from GWT Drag and Drop
Pros: "Pure GWT"
Cons: You probably won't handle all the edge cases that JCrop has figured out over time, nor be as featureful.
Port JCrop to GQuery
Pros: JCrop is open source and only around ~1600 lines of code
Cons: It's ~1600 lines of code, which is likely to be much bigger when ported to Java
If you decide to do any of the above, please open source it! I'd be happy to contribute, and it looks like something that I could use in my GWT projects as well.
GWT Cropper is a widget that allows cropping an image.
https://code.google.com/p/gwt-cropper/
Edited in 2015: as long as Google Code is about to be closed, the project has been moved to GitHub. The new address is https://github.com/w32blaster/gwt-cropper

What is a good vector library for Cocoa or Cocoa-touch?

I'm looking for a good vector library for displaying animated graphics on the iPhone. Something that could possibly display SVG. Anyone have any ideas or insights?
Quartz, i.e. the vector graphics library that's already built into the phone. Depending on the requirements, you could write a parser for the parts of the SVG spec you actually plan on using. For example perhaps your application only requires the Tiny SVG spec.
Sorry that this answer doesn't point to a framework that already exists, but depending on how badly you really need it, it might make sense to roll your own or a start an open source project (especially since this is the kind of project people would probably be quite happy to contribute to).
GCDrawKit is an outstanding vector illustration framework, but it does not have native support for SVG yet and is built around AppKit, so it's not iPhone compatible. It also is not geared towards animation.
WebKit provides native support for SVG on the Mac, and even lets you manipulate the DOM to modify or save SVG, but I don't believe you're given enough access to it on the iPhone to do the same there.
Your best bet is to write a parser for SVG XML (it isn't too difficult a format), use Quartz for drawing, and back it up with Core Animation for the animated elements.
WebKit
libsvg
Cairo
github.com/SVGKit/SVGKit - almost-but-not-quite standards compliant SVG lib on iOS. (FYI i'm one of the maintainers).
UIWebView works great for SVG.
Just drop it in you app in IB, load a file into it and you are set.
You can then call JavaScript from ObjC, very useful for manipulation.
I just answered another cocoa-touch SVG question: Drawing vector graphics on iphone
but my general suggestion was to look at GitHub for answers (Objective-c & SVG Search)
https://github.com/search?type=Everything&language=objective-c&q=SVG