tags:

views:

19

answers:

1

Hi, I'm new to openGL and I have a question, I'd like to make a "video wall" type application, where multiple images are mapped onto a cylinder, I'd like to then enable each of these images as buttons....

Is this possible? I'm not sure if objects in an openGL space can act as buttons....

Thanks

A: 

sure, it's possible. When the user clicks the opengl context you should be able to get back a x, y location where they clicked. It's then a matter of just doing your projection math backwards to find out what part of the scene they clicked.

You can also render the entire scene to a back buffer with each button set as a different color, then do a glReadPixels from this back buffer at the location of the click. The color value returned is the button they clicked.

And here's an example with a even faster method: http://www.lighthouse3d.com/opengl/picking/

There you only draw the picking buffer when the user clicks the mouse, and only for the single pixel they clicked.

Note: not all of these methods may work with OpenGL ES....so you'll have to pick the one that's right for you.

As a side note, this is also how many FPS games accomplish hit detection.

Timothy Baldridge