In that example I create a single mesh of many spheres because it only
requires a single GL call to render all of them (instead of looping
per each sphere and render it with a GL call which would be much more
expensive).
Does that make any sense? :)
On Wed, Sep 7, 2011 at 9:15 PM, Jasper Speicher <jas...@tellart.com> wrote:
> I looked at the picking colors in world flights. Seems that there are
> only one set of floats per sphere, rather than pervert-ex [sic]?
>
--
Nicolas Garcia Belmonte - http://philogb.github.com/
I turned off picking in the example because there were too many points
and they were too small to be clicked, so the interaction was kind of
uncomfortable. You can make the cities layer pickable again by setting
`pickable: true` here:
https://github.com/senchalabs/philogl/blob/master/examples/worldFlights/index.js#L123
You can find more information on model constructor configuration
properties here:
http://senchalabs.github.com/philogl/doc/o3d.html#O3D:Model:constructor
The pickingColors array is created by you, and should have the same
amount of components than the vertices of the mesh. Remember that this
is only if you want to find out which part of a mesh is being clicked,
for just knowing which model in the scene has been clicked there is an
easier picking method in the framework.
Thing of the pickingColors array as an array of indices that will
point to the vertices / face you want to match with. For example, pear
each sphere I have created a different color. Those colors are taken
from the index of the sphere in the array of spheres I'm creating
here:
https://github.com/senchalabs/philogl/blob/master/examples/worldFlights/cities.js#L39
Once a user clicks on the mesh, I get the pixel in the pick method and
return the original sphere index in the array:
https://github.com/senchalabs/philogl/blob/master/examples/worldFlights/index.js#L128
Then, on the events object here:
https://github.com/senchalabs/philogl/blob/master/examples/worldFlights/index.js#L384
You shoud add a new listener for clicking for example:
onClick: function() {
console.log(arguments);
}
if you click on a city you should get the proper index.
Does that make any sense? Please let me know if you have any other questions.
Nicolas.
--