Reputation: 166
Is there any way to click in a very specific place of WebGL animation and produce any response outside of it like sending a value to a database.
This seems like a very simple question but WebGL seems to be really powerful but a relatively new stuff not very well known and the answer to any question is difficult to find.
Upvotes: 0
Views: 245
Reputation: 8023
HTML5 element CANVAS produce onclick / onmousewheel / ... events with exact mouse position like any other HTML element.
It's up to you to save some information about scene object positions on CANVAS. Technique with second framebuffer and coloring objects in it is often used.
There are very nice examples in book "WebGL Beginner's Guide", Packt Publishing, Chapter 8: Picking.
Upvotes: 2