Get screen coordinates and size of OpenGL 3D Object after transformation -


i have couple of 3d objects in opengl in processing sketch , need find out if mouse hovering on objects. since there constant transformation can't compare original coordinates , size mouse position. found screenx() , screeny() methods return translated screen coordinates after transformation , translation still need displayed size after rotation.

determining object mouse on called picking , there 2 main approaches:

  1. color picking. draw each object using different color buffer (this done when picking, colored objects never displayed on screen). use glreadpixels read pixel under cursor , check color determine object is. if mouse isn't on object you'll background color. more details here: lighthouse 3d picking tutorial, color coding
  2. ray casting. cast ray through cursor location scene , check if intersects objects. more details here: mouse picking ray casting

from reading description option 1 simpler , need.


Comments

Popular posts from this blog

html - How to style widget with post count different than without post count -

How to remove text and logo OR add Overflow on Android ActionBar using AppCompat on API 8? -

javascript - storing input from prompt in array and displaying the array -