I’m doing my own ‘how to pick object with the mouse’ thread
Since I’ve used deferred lighting ( similar to the fireflies demo), I thought that I could create a easier ( and faster ?) solution to pick element than creating collision box for every object and casting a collisionRay.
I don’t need to know which object I picked, only its location.
So since I’ve got a depth Texture created for my rendering, I suppose than I can just look the value of my mouse position ( switched from (-1)-1 to the 0-1 range) inside the depth texture. from that, a little math give me the position.
first problem: how can I access a particular pixel inside my texture ? I’ve try a texture.pick() but it don’t give me anything.
In order for Texture.peek() to work, you will need to copy the texture to RAM, rather than the default behavior of leaving it on the graphics memory. You can do this by setting the appropriate parameters when you bind the texture to the offscreen buffer. However, this will be really slow.
if you investigate, here another precision: In fact with RTMCopyRAM, my depth texture doesn’t ‘works’, it’s fully blank,
I suppose the problem is linked to this post: panda3d.org/forums/viewtopic … 5b3375cb4a
(except I’m on linux right now ( ubuntu 10.4, panda3d 1.7.0, 8600gt))