Re: [osg-users] Placing Text Labels in Geodetic Projection

2008-03-18 Thread Jason Beverage
Hi Robert,

I've been using the 2.x branch in personal projects and test projects and
have kept up to date with the SVN version for the most part (it's tough with
so much going on so fast!) and I'm REALLY happy with the way 2.x has
progressed.  It's much easier to use and feels *right* to me in nearly every
aspect.  The osgViewer project has made things much easier in 2.x and things
are much more consistent.

The issue with us moving to 2.x is that our application is in C# and is
based on hand rolled Managed C++ OSG 1.2 wrappers.  I don't want to hand
update these wrappers as I feel this really adds an uneeded layer of
maintainance.  Sadly, the osgDotNet project started off great, but still has
unresolved crashes that keep us from using it and it appears that
development has all but stopped on it.  The recent discussions on the
mailing list about using C++/CLI directly with OSG by hesicong and others
seem extremely promising though.

Overall though, does the approach I'm suggesting with using the
UpdateCallback and the Hud Camera to get around my intersection problems
sound reasonable or am I overcomplicating things?

Thanks!

Jason



On Tue, Mar 18, 2008 at 12:03 PM, Robert Osfield [EMAIL PROTECTED]
wrote:

 Hi Jason,

 2.x is generally more consistent w.r.t use of doubles internally so
 will tend to suffer less from precision issues.  However, without
 testing you exact setup I can't say whether these general improvements
 will help with this specific problem you have.

 W.r.t. porting from OSG-1.x to OSG-2.x, it might not actually be as
 bad as you feel, in you are using osgUtil::SceneView you'll find the
 majority of the OSG will just recompile with no changes.   There is a
 few changes in API that might catch you out, but substantially the OSG
 is still the same scene graph.

 The biggest change between OSG-1.x and OSG-2.x is the osgProducer
 replaced by osgViewer  and the new CMake build system, since you don't
 use osgProducer then the build system is the biggest change.  It is
 however, a big improvement in terms of cross platform support, so
 while a bit of learning curve is well worth it.

 Robert.

 On Tue, Mar 18, 2008 at 3:54 PM, Jason Beverage [EMAIL PROTECTED]
 wrote:
  Hi all,
 
  I've written a 2D viewer that displays geospatial imagery in an
 orthographic
  projection using a WGS-1984 geodetic projection so the units are in
 degrees.
 
  I am placing text labels with their character size specified in
  SCREEN_COORDS.  When I zoom in very close, the quality of the text
 starts to
  suffer b/c the glyph quads are so small that they are losing precision
 when
  rendering.  Placing a MatrixTransform above the text to position it
 locally
  reduces the visual problems but there are still some present.
 
  The main problem I have is that the text cannot be selected if I zoom in
  close.  I can see the text fine, but clicking on it doesn't result in a
 hit
  b/c the intersections are all done using floats and the text glyphs are
  extermely small because of the autosizing.
 
  I found a potential solution using the latest version of OpenSceneGraph
  which places the text in an orthographic HUD camera and positions it at
 the
  correct space on the earth using the callback at the end of this email.
  Intersections work well and the text looks very crisp.
 
  We are currently using OpenSceneGraph 1.2 and are rolling our own viewer
  using SceneView and IntersectVisitor (NOT IntersectionVisitor) in our
  application and cannot update this spiral due to time constraints.
  IntersectVisitor does not seem to work correctly in picking items placed
 in
  a CameraNode in the 1.2 version.
 
  Does anyone have any suggestions on how I could fix this issue using
  OpenSceneGraph 1.2 and does the solution I found for using the latest
  version of OSG make sense or I am missing something painfully obvious?
 
   Thanks!
 
  Jason
 
  struct HudTextUpdateCallback : public osg::Drawable::UpdateCallback
  {
  public:
HudTextUpdateCallback(double lon, double lat, Viewer* viewer)
{
  _viewer = viewer;
  _lon = lon;
   _lat = lat;
}
 
virtual void update(osg::NodeVisitor* nv, osg::Drawable* drawable)
{
  Text* text = dynamic_castText*(drawable);
  if (text)
  {
CameraHelper h;
h.setCamera(_viewer-getCamera());
 
osg::Vec3 object(_lon,0,_lat);
osg::Vec3 window;
 
h.projectObjectIntoWindow(object, window);
text-setPosition(osg::Vec3(window.x(), window.y(), 0.0));
  }
}
 
double _lon;
 double _lat;
Viewer *_viewer;
  };
 
  ___
   osg-users mailing list
   osg-users@lists.openscenegraph.org
 
 http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
 
 
 ___
 osg-users mailing list
 osg-users@lists.openscenegraph.org
 http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] Placing Text Labels in Geodetic Projection

2008-03-18 Thread Robert Osfield
On Tue, Mar 18, 2008 at 4:42 PM, Jason Beverage [EMAIL PROTECTED] wrote:
 Overall though, does the approach I'm suggesting with using the
 UpdateCallback and the Hud Camera to get around my intersection problems
 sound reasonable or am I overcomplicating things?

It sounds like overcomplicating to me, the more complicated the more
difficult it'll be to debug, and even harder for anyone else to be
able to try and get their head around what you are doing.  Given you
are using an older version of the OSG it makes it a next to impossible
task to support.

OSG-1.2 does support double Matrices by default, so I would have
though  as MatrixTransform above the text labels
would get you most of the way.  You could try look for where the
precision issue is arising and tweaking the OSG to use doubles to help
out.

Robert.
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org