0

I used the code listed as the answer in Get longitude and latitude from the Globe in WebGL

However, when I tried it, when I turn the globe over, even when I click the same point, I get different coordinate, and the longitude coordinate is almost always wrong.

I have no idea how to fix it without the globe being much more intelligent and somehow having recording what all rotations it has been through, or even keeping track of a particular longitude (Maybe the international date line) so that it can find out what the point's lat, long tuple is.

Any suggestions or ideas?

Community
  • 1
  • 1
aishpr
  • 143
  • 3
  • 15
  • Could you post a fiddle? I don't think keeping track of rotations would be too difficult, if all else fails. – Luigi Jun 11 '14 at 22:19
  • So, the thing is, if you've seen an example of webgl globe/worked with it before, the renderer which keeps drawing the globe at a certain frequency, always draws the radial coloured lines at the right latitude and longitude, even when we rotate the globe. So, there is an internal mechanism that keeps track of changing coordinates, with changing orientation. So after I posted the question, I discovered that I could probably use that information and invert the logic, but, I don't know how to. How do I approach that? (And sorry, I haven't used jsfiddle before - still figuring it out) – aishpr Jun 11 '14 at 22:30
  • If I was implementing something like this from first principles, I'd do the old colour picker approach - when you want to do a mouse pick, render a version of your sphere where each vertex colour is set to a specific value (e.g. R = lat, G=long) - [you could use RG,BA if you need more accuracy] - then just sample the pixel colour at the mouse position, and you can use that to extract the lat,long. – benjymous Feb 23 '15 at 16:02

0 Answers0