On Tue, 2008-11-11 at 11:14 -0500, Jean-Sébastien Guay wrote:
> Hi Jeremy,
> 
> > Merging now!
> 
> I haven't updated from your SVN yet to see if anything has changed, but 
> compiling osgPango with the osgWidget branch of OSG has revealed a few 
> more changes needed for the osgpangoguiviewer and osgpangoanimation 
> examples. I've attached the patch file (without the other changes, so 
> they're separate). Both examples were missing some libraries in the 
> CMakeLists.txt files, and I had to make some small changes to 
> osgpangoanimation.cpp :

These will be in shortly; osgCairo is done, the osgPango patch was
harder because I had an ungodly amount of changes in the works. :)

> 1. to use osg::round instead of round()
> 2. for random(), I think using the more standard rand() defined in 
> stdlib.h would be better.
> 
> Also, osgpangoguiviewer tries to load osgWidget/frame-theme.png which it 
> can't find, and instead of printing an error and exiting as it should, 
> it crashes when it tries to do image->s() in 
> osgWidget::Frame::createSimpleFrameWithSingleTexture(). The 
> osgDB::readImageFile should be taken out of the 
> createSimpleFrameWithSingleTexture() call at osgpangoguiviewer.cpp line 
> 23 and its return value tested, and 
> osgWidget::Frame::createSimpleFrameWithSingleTexture() should test that 
> image is not NULL/0.
> 
> Because I don't have this image, I can't tell if osgpangoguiviewer's 
> result is correct... I replaced it with osgWidget/theme.png (which is in 
> OSG-Data) but the result looks bad, so it's probably not the right image :-)

A lot of this is already fixed and just uncommitted; the guiviewer isn't
complete yet, though--it's purpose is to get a list of every available
font and provide a drop-down box to chose from them. It'll be a few more
days before this is finished.

> I will again make the comment that your screen settings in 
> osgpangoanimation.cpp are pretty bad. For one, not everyone has a screen 
> of 1920x1200 (I'm at 1280x1024 myself), and also, you position the 
> window at 0,0 (again!) which puts the title bar outside the screen on 
> Windows. Please let osgViewer position the window how the user wants 
> it... Your arguments from last week make sense, but there are ways of 
> getting the window size and then passing it wherever it's needed instead 
> of locking the example to a set resolution and window placement.

I just set it to 1920x1200 (my res on my laptop) for a test and forgot
to change it to something sensible. As far as getting the OSG viewer
resolution is concerned, I'm probably more prone to just fixing the bug
outright rather than working around it. To be honest, I don't really
even know of any way to get this data--it's abstracted somewhere deep in
OSG. If you know of an example bit of code that does it, please let me
know.

> Other than that, osgpangoanimation's result looks good (looks like the 
> video on the osgPango site, to be specific) so osgPango's grade goes up 
> from 3/5 to 4/5. :-)
> 
> Thanks for your hard work, and please excuse my ranting...

Haha, it's all good. :) Thanks for everything so far!

> J-S
> plain text document attachment (osgPango-2.patch)
> Index: examples/osgpangoanimation/CMakeLists.txt
> ===================================================================
> --- examples/osgpangoanimation/CMakeLists.txt (revision 23)
> +++ examples/osgpangoanimation/CMakeLists.txt (working copy)
> @@ -1,7 +1,14 @@
>  PROJECT(osgpangoanimation)
>  
> -LINK_LIBRARIES(osgPango)
> +# osgPango gets the proper debug postfix automatically since it's part of the
> +# current project, but we need to add the postfix for the other libs.
> +LINK_LIBRARIES(osgPango
> +               debug     OpenThreads${CMAKE_DEBUG_POSTFIX}
> +               optimized OpenThreads
> +               debug     osgGA${CMAKE_DEBUG_POSTFIX}
> +               optimized osgGA)
>  
>  ADD_EXECUTABLE(osgpangoanimation osgpangoanimation.cpp)
>  
>  INSTALL(TARGETS osgpangoanimation DESTINATION ${CMAKE_INSTALL_PREFIX}/bin)
> +SET_TARGET_PROPERTIES(osgpangoanimation PROPERTIES DEBUG_POSTFIX 
> ${CMAKE_DEBUG_POSTFIX})
> Index: examples/osgpangoanimation/osgpangoanimation.cpp
> ===================================================================
> --- examples/osgpangoanimation/osgpangoanimation.cpp  (revision 23)
> +++ examples/osgpangoanimation/osgpangoanimation.cpp  (working copy)
> @@ -9,6 +9,8 @@
>  #include <osgAnimation/EaseMotion>
>  #include <osgPango/Text>
>  
> +#include <stdlib.h>
> +
>  // const unsigned int WINDOW_WIDTH  = 720;
>  // const unsigned int WINDOW_HEIGHT = 480;
>  
> @@ -56,7 +58,7 @@
>                               
>                               _motions[i] = MyMotion(0, duration, 3.14, 
> osgAnimation::Motion::LOOP);
>                               
> -                             float offset = (random() * 1.0 / (1.0 * 
> RAND_MAX)) * duration;
> +                             float offset = (rand() * 1.0 / (1.0 * 
> RAND_MAX)) * duration;
>                               
>                               _motions[i].setTime(offset);
>                       }
> @@ -141,8 +143,8 @@
>       const osg::Vec2& size = t->getSize();
>  
>       osg::MatrixTransform* mt = new 
> osg::MatrixTransform(osg::Matrix::translate(
> -             round((WINDOW_WIDTH - size.x()) / 2.0f),
> -             size.y() + round((WINDOW_HEIGHT - size.y()) / 2.0f),
> +        osg::round((WINDOW_WIDTH - size.x()) / 2.0f),
> +        size.y() + osg::round((WINDOW_HEIGHT - size.y()) / 2.0f),
>               0.0f
>       ));
>  
> Index: examples/osgpangoguiviewer/CMakeLists.txt
> ===================================================================
> --- examples/osgpangoguiviewer/CMakeLists.txt (revision 23)
> +++ examples/osgpangoguiviewer/CMakeLists.txt (working copy)
> @@ -1,7 +1,14 @@
>  PROJECT(osgpangoguiviewer)
>  
> -LINK_LIBRARIES(osgPango)
> +# osgPango gets the proper debug postfix automatically since it's part of the
> +# current project, but we need to add the postfix for the other libs.
> +LINK_LIBRARIES(osgPango
> +               debug     OpenThreads${CMAKE_DEBUG_POSTFIX}
> +               optimized OpenThreads
> +               debug     osgDB${CMAKE_DEBUG_POSTFIX}
> +               optimized osgDB)
>  
>  ADD_EXECUTABLE(osgpangoguiviewer osgpangoguiviewer.cpp)
>  
>  INSTALL(TARGETS osgpangoguiviewer DESTINATION ${CMAKE_INSTALL_PREFIX}/bin)
> +SET_TARGET_PROPERTIES(osgpangoguiviewer PROPERTIES DEBUG_POSTFIX 
> ${CMAKE_DEBUG_POSTFIX})
> _______________________________________________
> 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

Reply via email to