Hi Andreas,

Implementing picking using OpenGL is typically very inefficient as it
forces a round trip to the GPU and stalls the CPU and GPU while they
wait for each other.  Is there a reason why you can't do the picking
using a CPU operation?

As for doing custom Camera traversals, there is no need to add/remove
from the GraphicsContext, simply assign a Camera and toggle it on/off
using the Camera::NodeMask, do camera->setNodeMask(0x0) to turn off
and camera->setNodeMask(0xffffffff) to switch on.

On 22 January 2014 23:00, Andreas Henne <[email protected]> wrote:
> Hi,
> I implemented picking by rendering each object with a unique color ID to a 
> texture. A lookup in the texture on the mouse cursor position then gives the 
> color id of the selected object. When the user performs a mouse click, I need 
> to update the picking texture. To avoid unnecessary rendering, I want to 
> update only the picking texture and not all other cameras. I found that this 
> simple task (taking a picture with one RTT camera without updating the 
> others) is difficult to implement in OSG, because 
> GraphicsContext::runOperations renders images for all cameras attached to the 
> context. Of course I could use a seperate context for the picking, but that 
> shouldn't be necessary in my opinion.
> I managed to implement what I want by adding and removing cameras to the 
> context on the fly, but is this a good way to do this? For example, in 
> GraphicsContext::removeCamera the function releaseGLObjects is called and I'm 
> not sure how this could impact performance.
>
> Thank you!
>
> Cheers,
> Andreas
>
> ------------------
> Read this topic online here:
> http://forum.openscenegraph.org/viewtopic.php?p=57958#57958
>
>
>
>
>
> _______________________________________________
> osg-users mailing list
> [email protected]
> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to