OpenGL: 3D objects as Component


#1

How can I make a three-dimensional model inside of an OpenGL scene function as a Component? I would like for objects in the scene to be capable of receiving UI events such as mouse clicks and key presses.

My best guess would be to first receive the event within the parent (OpenGLRenderer) component, and then "forward" it to the appropriate Component object after identifying which object in the scene was under the mouse click.

 

My questions:

(1) If this was indeed the best solution, how does one "forward" an event from one Component to another?

 

(2) Does JUCE provide higher-level capabilities along the lines of GL_SELECT, that determine if a particular rendering call resulted in fragments being drawn within a given "pick box"?

 

I hope this was posed clearly. Thank you!


#2

At the moment there's no explicit support for this - you'd need to create your own way of mapping input mouse events to the component via whatever matrix you're using to draw it.