Hacker News new | ask | show | jobs
by DonHopkins 1552 days ago
Oh, right, hello Graham! Now I recognize your name, which sounded familiar. When I was originally researching these topics, I found your great stuff and took lots of notes!

https://github.com/SimHacker/UnityJS/blob/master/notes/Oculu...

https://github.com/SimHacker/UnityJS/blob/master/notes/PInvo...

https://github.com/SimHacker/UnityJS/blob/master/notes/Skybo...

https://github.com/SimHacker/UnityJS/blob/master/notes/Unity...

https://github.com/SimHacker/UnityJS/blob/master/notes/Surfa...

https://github.com/SimHacker/UnityJS/blob/master/notes/ZeroC...

Now I recall that we even had an email discussion about how to render an Android WebView into a Unity texture and efficiently get GPU textures into Unity, relating to your UnityAndroidVideoTexture and popmovie plugin, back in December 2016 -- thanks for the great advice, and for open sourcing and sharing that code! That was some very tricky stuff to have to figure out on my own.

And of course every platform has its own weird tricky plumbing like that that (which changes over time). So UnityJS is intended to abstract that from the casual programmer, who only needs to deal with good old JavaScript, without mixing in C++, Java, C, and Objective C.

Another great source to learning the best way of doing tricky low level platform dependent plumbing things like that is the Chrome and Firefox browser source code. Much better than reading through old out-of-date blog postings that don't even apply any more. Those huge projects have extremely talented people from the respective companies working directly on them, who deeply know (or even implemented) all the latest poorly- or un-documented APIs.

Reading that code is like drinking from a firehose, and it can be overwhelming finding the actual four lines of magic code that does the tricky stuff, but you know it has to be in there somewhere, so don't give up!

A good way of figuring out where to start and finding a pointer into the right part of the monolithic source code is to look for related bugs and issues and pr's that discuss and point into the code, and search the bug database for names of important and unique API functions and symbols.

For example, here are some notes I took on Apple's "IOSurface", which is kind of like the Apple equivalent of Android GL_TEXTURE_EXTERNAL_OES textures:

https://github.com/SimHacker/UnityJS/blob/master/notes/IOSur...