[ playerstage-Patches-3071940 ] Stage 3: Drag & Drop not detecting model (Canvas::getModel)

"SourceForge.net" <[email protected]>
Newsgroups gmane.science.robotics.playerstage
Message-ID <[email protected]>
Patches item #3071940, was opened at 2010-09-20 16:30
Message generated for change (Tracker Item Submitted) made by f0k
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=433166&aid=3071940&group_id=42445

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: Stage
Group: None
Status: Open
Resolution: None
Priority: 5
Private: No
Submitted By: Jan Schlüter (f0k)
Assigned to: Richard Vaughan (rtv)
Summary: Stage 3: Drag & Drop not detecting model (Canvas::getModel)

Initial Comment:
Both Stage 3.2.2 and the git version did not allow me to drag and drop objects around when running it in my Ubuntu 10.04 virtual box with 3D acceleration enabled. Instead, Stage always grabbed some invisible ground model. When disabling 3D acceleration and resorting to the MESA Software Rasterizer, it worked.

I enabled the debugging printouts in Canvas::getModel (thank you for leaving them in the file), which finds the clicked model by rendering the scene in special colors and then reading back the pixel color under the mouse cursor. With 3D acceleration enabled, it always read zero values for red, green and blue (but FF for alpha), so it thought I clicked the model of id zero. The debugging screenshot, however, was fine and showed exactly the same rendering both with and without 3D acceleration.
Checking the Canvas::Screenshot code I noticed two differences to Canvas::GetModel: glFlush() is called first to make sure the drawing is done, and glReadPixels reads the RGBA values at once instead of separately.
So I copied the glFlush() call over to Canvas::GetModel, which did not solve the problem, but I think is wise anyway, and then changed the four glReadPixels calls into a single glReadPixels call reading all four values at once. With this change, Canvas::getModel works correctly on my machine.

It seems to be more of a bug in my host's or VirtualBox's graphics driver than a bug in Stage, but the attached patch solves the problem and will not break existing systems (at least any system for which the screenshot feature works will also work with this patched Canvas::GetModel). Plus it is a little more efficient than the former version.
The patch is against Stage 3.2.2 - sorry, I don't have the git version at hands any more.

----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=433166&aid=3071940&group_id=42445

------------------------------------------------------------------------------
Start uncovering the many advantages of virtual appliances
and start using them to simplify application deployment and
accelerate your shift to cloud computing.
http://p.sf.net/sfu/novell-sfdev2dev
_______________________________________________
Playerstage-developers mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/playerstage-developers
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.