Java-Gaming.org Java4K winners: [ by our judges | by the community ]         
Featured games (67)
games approved by the League of Dukes
Games in Showcase (∞)
games submitted by our members



News: Read the Java Gaming Resources, or peek at the official Java tutorials
 
    Home     Help   Search   Login   Register   
Pages: [1]
  Print  
  2d, using depth as an ID  (Read 728 times)
0 Members and 1 Guest are viewing this topic.
Offline brien

JGO n00b
*

Posts: 6



« on: 2008-04-15 07:39:57 »

hi all,

If I want to do picking often (maybe 20 times a second) for a 2d scene, would it be better to store IDs in the depth buffer than to use the standard selection approach (a render per pick)? That is, read the ID from the depth buffer using glReadPixels? Rendering is much faster than picking in the CPU for my case.

thanks
Offline Ken Russell

JGO Kernel
*****

Posts: 3446
Medals: 3


Java games rock!


« Reply #1 on: 2008-04-16 06:36:07 »

You might consider adding an alternate render pass (which doesn't get shown on-screen, but perhaps is overdrawn with the real render) which uses a unique color per object, so the system can query the object underneath the pixel via glReadPixels of the color buffer. I've been told by the NASA World Wind Java development team that they use this technique for picking in their system with good success.

Pages: [1]
  Print  
 
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.16 | SMF © 2011, Simple Machines Valid XHTML 1.0! Valid CSS!
Page created in 0.091 seconds with 21 queries.