Re: [osg-users] [osgPlugins] How to set SWSCALE?

2010-09-20 Thread KSpam
Daryl,

On Monday 20 September 2010 14:07:40 Daryl Lee wrote:
 I am just trying to get OSG installed on Mac OSX 10.6.4 for the first time,
 for evaluation and personal education, and I've run into a problem with
 the ffmpeg plugin.  I get an error with img_convert not being declared
 in scope.  I have tracked the problem down to the FFMPEG_LIBSWSCALE_FOUND
 parameter apparently not being set, but I can't discover how to set it.  I
 installed the ffmpeg library using the configure options
 --enable-libmp3lame --enable-shared --disable-mmx --arch=x86_64, and I
 do see libswscale in the /usr/local/lib directory.
 
 Other than just going into FFMpegDecoderVideo.hpp and cramming #define
 USE_SWSCALE at the top, how should I solve this problem?

ffmpeg does not build the swscale library by default.  If you want to build it, 
you need to configure ffmpeg with --enable-swscale.

Hope This Helps,
Justin
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] Convert paged to non-paged terrain database

2009-08-20 Thread KSpam
On Thursday 20 August 2009 10:53:13 Appolloni, Thomas wrote:
  Of course, I decided to take it a step further and perform texture

 conversions

  as well.  I wanted to convert the .dds texture files to .jpg.  This

 code is

  stubbed in; however, it does not work.  I thought I could simply call
  osgDB::writeImageFile.  Unfortunately, the individual image format

 writer

  plugins do not appear to handle converting from different pixel

 formats or

  packing.  Does OSG contain code for converting osg::Image between

 different

  pixel formats?  Am I missing an easier option?
 
  Thanks,
  Justin

 Justin,

 I didn't see any additional traffic on this thread. Were you able to get
 a
 solution to this image conversion problem. I'm now facing a similar
 situation
 with the .dds image node from generated osgdem tiles and want to convert

 those images into .jpg or other formats.

 Regards,
 Tom

Tom,

It has been a while since I looked into this.  I did not find a solution in 
OSG, and the problem was not important enough to warrant spending more time on 
it.

If I had to revisit this problem today, I would look into using Boost.GIL 
(Generic Image Library) for the conversion.

http://www.boost.org/doc/libs/1_39_0/libs/gil/doc/index.html

GIL is a header-only library that allows you to generically convert between 
different pixel and packing formats.  With this library, you could convert an 
osg::Image object containing .dds data into an osg::Image object containing 
.jpg data.  Alternately, you could create a Boost.GIL image using the .dds 
osg::Image data and use Boost.GIL I/O to output the Boost.GIL image as a .jpg 
file.

Hopefully, someone can chime in with a simple solution.

Respectfully,
Justin

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


[osg-users] Convert paged to non-paged terrain database

2008-11-26 Thread KSpam
I have a paged terrain database that I would like to convert to a non-paged 
model.  Ideally, I would like to remove all level-of-detail switching and 
only keep the highest level of detail.

How might I go about doing this?

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


Re: [osg-users] Convert paged to non-paged terrain database

2008-11-26 Thread KSpam
Robert,

The entire database (.osg files and .dds textures) is under 700 MB.  It is 
possible that I will need to trim some edge tiles off to get to a more 
reasonable size, but I will cross that bridge later :-)

Thanks,
Justin

On Wednesday 26 November 2008 09:46:42 Robert Osfield wrote:
 Hi Justin,

 Just how big is your paged database?  If it's paged database in the
 first pace then there is a good chance that it's big enough to require
 paging, in which case it won't fit in memory without paging so the
 whole journey your are on may well be entirely pointless.

 Robert.

 On Wed, Nov 26, 2008 at 4:26 PM, KSpam [EMAIL PROTECTED] wrote:
  I have a paged terrain database that I would like to convert to a
  non-paged model.  Ideally, I would like to remove all level-of-detail
  switching and only keep the highest level of detail.
 
  How might I go about doing this?
 
  Thanks,
  Justin
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] Convert paged to non-paged terrain database

2008-11-26 Thread KSpam
Paul,

On Wednesday 26 November 2008 09:47:53 Paul Martz wrote:
  I have a paged terrain database that I would like to convert
  to a non-paged model.  Ideally, I would like to remove all
  level-of-detail switching and only keep the highest level of detail.
 
  How might I go about doing this?

 Write a NodeVisitor that overrides apply(PagedLOD) to read in the highest
 LOD and replace the PagedLOD with the loaded subgraph.

I will try this approach.

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


Re: [osg-users] Convert paged to non-paged terrain database

2008-11-26 Thread KSpam
Thanks to Robert and Paul, I created the attached application to do the 
terrain database conversion.  Perhaps it will be of some use to someone else.

Using this application, my paged database of 655936 kB was converted to a 
non-paged database of 415288 kB.

Of course, I decided to take it a step further and perform texture conversions 
as well.  I wanted to convert the .dds texture files to .jpg.  This code is 
stubbed in; however, it does not work.  I thought I could simply call 
osgDB::writeImageFile.  Unfortunately, the individual image format writer 
plugins do not appear to handle converting from different pixel formats or 
packing.  Does OSG contain code for converting osg::Image between different 
pixel formats?  Am I missing an easier option?

Thanks,
Justin

On Wednesday 26 November 2008 09:26:40 KSpam wrote:
 I have a paged terrain database that I would like to convert to a non-paged
 model.  Ideally, I would like to remove all level-of-detail switching and
 only keep the highest level of detail.

 How might I go about doing this?
#include osg/Texture2D
#include osgDB/FileNameUtils
#include osgDB/ReadFile
#include osgDB/WriteFile

#include iostream
#include string

//
class ConvertTextureFileFormatVisitor : public osg::NodeVisitor
{
public:
struct ConvertCallback : public osg::Referenced
{
virtual bool convertImage(osg::Image image) = 0;
};

ConvertTextureFileFormatVisitor
(
ConvertCallback* convertCallback
)
: osg::NodeVisitor(osg::NodeVisitor::TRAVERSE_ALL_CHILDREN)
, m_ConvertCallback(convertCallback)
{
}

virtual void apply
(
osg::Node node
)
{
if (node.getStateSet())
{
apply(*node.getStateSet());
}
traverse(node);
}

virtual void apply
(
osg::Geode node
)
{
if (node.getStateSet())
{
apply(*node.getStateSet());
}

const unsigned int numDrawables = node.getNumDrawables();
for (unsigned int i = 0; i  numDrawables; ++i)
{
osg::ref_ptrosg::Drawable drawable = node.getDrawable(i);
if (drawable.valid()  drawable-getStateSet())
{
apply(*(drawable-getStateSet()));
}
}

traverse(node);
}

virtual void apply
(
osg::StateSet stateSet
)
{
// Search for any Texture2D object attributes
for (unsigned int i = 0; i  stateSet.getTextureAttributeList().size(); ++i)
{
osg::ref_ptrosg::Texture2D texture2D = dynamic_castosg::Texture2D*(stateSet.getTextureAttribute(i, osg::StateAttribute::TEXTURE));
if (texture2D.valid())
{
osg::ref_ptrosg::Image image = texture2D-getImage();
if (image.valid()  image-valid())
{
m_ConvertCallback-convertImage(*image);
}
}
}
}

protected:
osg::ref_ptrConvertCallback m_ConvertCallback;
};

//
struct MyConvertCallback : public ConvertTextureFileFormatVisitor::ConvertCallback
{
public:
MyConvertCallback
(
const std::string srcDir,
const std::string dstDir,
const std::string desiredExtension
)
: m_SrcDir(srcDir)
, m_DstDir(dstDir)
, m_DesiredExtension(desiredExtension)
{
}

virtual bool convertImage(osg::Image image)
{
const std::string fileName = image.getFileName();
if ((m_SrcDir != m_DstDir) || (osgDB::getFileExtension(fileName) != m_DesiredExtension))
{
std::string srcFileName = fileName;
if (!m_SrcDir.empty())
{
srcFileName = osgDB::concatPaths(m_SrcDir, srcFileName);
}

std::string dstFileName = osgDB::getNameLessExtension(fileName) + . + m_DesiredExtension;
image.setFileName(dstFileName);
if (!m_DstDir.empty())
{
dstFileName = osgDB::concatPaths(m_DstDir, dstFileName);
}

std::cout  Converting   srcFileName   to   dstFileName  std::endl;
if (!osgDB::writeImageFile(image, dstFileName))
{
std::cerr  ERROR : Failure while writing \  dstFileName  \!  std::endl;
}
}

return true;
}

protected:
std::string m_SrcDir;
std::string m_DstDir;
std::string m_DesiredExtension;
};

//
class HighestResolutionPagedLODTransformationVisitor : public osg::NodeVisitor
{
public:
struct ReadCallback : public osg::Referenced
{
virtual osg::Node* readNodeFile(const std::string fileName) = 0

Re: [osg-users] You have three guess...

2008-11-17 Thread KSpam
On Monday 17 November 2008 11:03:05 Ed wrote:
 I may sound ignorant by asking this, but it won't be the first time,
 so... What are the uses of this capability?

 Ed

Perhaps this would be a convenient way of providing online help to users of a 
game?  Maybe a way to generate ad revenue from a game?

This may not be something that everyone rushes to include in their OSG 
application, but I have little doubt that someone will do something creative 
with this ... probably something I would never imagine until I see it and 
say Why didn't I think of that? :-)

It's another tool in the tool belt that is OSG!

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


Re: [osg-users] CompositeViewer and event handlers

2008-10-06 Thread KSpam
Robert,

 The Help and StatsHandlers will just be grabbing the first window and
 applying themselves to this.  To support individual placement we'll
 need to add extra controls to these Handlers.  You are welcome to dive
 in a make the required modifications, and post the results of course

Thanks for the info!  The StatsHandler is not critical for my application.  It 
was nice to have for debugging.  It sounds like I can simply workaround this 
by making sure my primary view is always added first.

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


Re: [osg-users] Sharing PagedLOD node in multiple osgViewer::Viewer windows

2008-10-06 Thread KSpam
Robert,

 Could you please switch to using a CompositeViewer with multiple
 Views, rather than multiple Viewers, as you usage model is intended to
 be supported by CompositeViewer, you are much more likely to find
 success/stability when using the OSG in the way it's intended.

I took your advice and converted my application over to using CompositeViewer.  
It required quite a bit of work to my codebase, but I am very happy with the 
results.  In addition to having working paged terrain across multiple views, 
I also got a significant improvement in the framerate!

 Also try moving up to OSG 2.6, 2.7.x or SVN/trunk as there are plenty
 of improvements across the board, including to paging and multiple
 window work, I can't say for certain this will fix you problem, but
 there it's definitely worth a try.

I am still using OSG 2.4, as I do not have the option to upgrade at this time.

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


[osg-users] CompositeViewer View-specific visitor

2008-10-04 Thread KSpam
I am attempting to switch my application over from Viewer to CompositeViewer.  
My application has multiple views, and each view has independent control over 
scaling entities and turning individual entities on or off.  I would like to 
know how I can accomplish this.

My first thought was to add a pre draw callback to the camera of each View and 
call my visitor from the callback.  Unfortunately, this does not seem to 
work.

Any help would be greatly appreciated.

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


[osg-users] CompositeViewer and event handlers

2008-10-04 Thread KSpam
I am in the process of converting my application from Viewer to 
CompositeViewer.  I am having a strange problem with event handlers, 
specifically osgViewer::HelpHandler and osgViewer::StatsHandler.  When I 
request one of the event handlers from one view, it displays in a different 
view.  The view that actually displays the event handlers does not have any 
event handlers assigned to it.

Are there any ideas as to what I am doing wrong?

Any help would be greatly appreciated.

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


Re: [osg-users] CompositeViewer View-specific visitor

2008-10-04 Thread KSpam
J-S,

Thank you for the response.

  I am attempting to switch my application over from Viewer to
  CompositeViewer. My application has multiple views, and each view has
  independent control over scaling entities and turning individual entities
  on or off.  I would like to know how I can accomplish this.

 The classic way to do this is to use different node masks to nodes which
 you want to see in different views, and then use
 osg::Camera::setCullMask(NodeMask nm) (actually inherited from the
 osg::CullSettings base class) to set what a given camera (of a given
 view) can see. So for example, if you have 2 views and 3 nodes:

I am using node masks for some node types; however, my application contains 
hundreds of entities, and I need the ability to turn each one on or off 
individually.  There are simply too many instances to do this with a node 
mask.

Also, the node mask does not help me with scaling the entities.

I think I need a view-specific visitor that would be called on the scene right 
before rendering the scene.  Is there a way to do this?

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


[osg-users] Sharing PagedLOD node in multiple osgViewer::Viewer windows

2008-09-26 Thread KSpam
My application utilizes a osg::PagedLOD node for terrain that is shared across 
multiple osgViewer::Viewer instances.  The terrain paging works beautifully 
when I only have a single window open; however, there are issues whenever I 
open a second window.

Some of the issues I see are:
1) Window 1 appears to revert to the lowest LOD
2) Window 1 and 2 seem to flicker as if fighting over which texture or tile 
should be visible
3) Sometimes window 2 textures are missing for some tiles (i.e. white 
background)

I suspect that I might be using osgDB::DatabasePager improperly.  I have tried 
sharing the same osgDB::DatabasePager across all osgViewer::Viewer instances, 
and I have also tried using a unique osgDB::DatabasePager for each 
osgViewer::Viewer instance.  What is the correct approach?

Any ideas as to what I am doing wrong?  Any suggestions for me to try?

I am using OSG 2.4.

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


Re: [osg-users] Sun, moon, clouds. Any recommendations?

2008-07-22 Thread KSpam
Alberto,

I am able to build osgEphemeris with OSG 2.4.  I only build the osgEphemeris 
library and plugin (That's all I need).  I have a Python build script that 
does the work.  Hopefully, the function calls are descriptive enough.

# Make a small fix for compilation errors
replaceInFile(src/osgEphemerisLib/StarField.cpp, [(= 
cv-getModelViewMatrix(), = *cv-getModelViewMatrix())]);
os.environ[OSG_ROOT] = osgDir;
changeDir(os.path.join(unbundleDir, VC7, osgEphemeris));
runVcbuild(osgEphemeris.vcproj, configs = [RELEASE, DEBUG]);
changeDir(os.path.join(unbundleDir, VC7, osgPlugin_ephemeris));
replaceInFile(osgPlugin_ephemeris.vcproj, 
[($(OSG_ROOT)\lib\win32, $(OSG_ROOT)\lib)]);
runVcbuild(osgPlugin_ephemeris.vcproj, configs = [RELEASE, DEBUG]);

Hope This Helps,
Justin

On Tuesday 22 July 2008 00:58:44 Alberto Luaces wrote:
 Did you manage to build osgephemeris with OSG 2.4? A few weeks ago I tried
 to compile it but gave up because it seems it depends on Producer.

 I you have a patch available, I think it would be of interest for us osg
 users. Maybe you upload it to the wiki, it would be very useful. Another
 possible place to post it would be on the producer-users mailing list, or
 send it to the osgephemeris project page.

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


Re: [osg-users] Moving to Unix: WAS Re: VirtualPlanetBuilder and pagedLOD chalengesmyTargeting pod camera

2008-05-16 Thread KSpam
Brett,

On Friday 16 May 2008 19:51:15 Brett wrote:
 I am ready to move to Linux and have been for a long time, but am unsure
 which version to use, etc.  I have Unix experience from back before, but
 still unsure of the curve to choose the right version / tools.  Are
 Linuxes all the same, is there one better suited for developers.  What
 are the nice development tools for 3d, ie. image editing, model creation
 / editing and visual development environment with debugging? Thanks.

This is one of those questions that you could get a hundred different answers 
to :-)

I have used quite a few different Linux variants (Gentoo, Red Hat, Fedora, 
Mandrake, SuSE, etc), and I settled on Kubuntu a couple years ago.  A Linux 
distribution is mostly just a matter of personal taste.  To make a 
distribution suitable for developers, simply install the desired developer 
packages.  For me, Kubuntu keeps me maximally productive with minimal 
overhead.  YMMV.

You might want to set up your machine as dual boot.  This will allow you to 
boot into Windows or Linux.

For image editing, I personally like to use Gimp, but I also use Krita from 
time to time.  Gimp is quite powerful.  Many people complain about the 
interface (multiple discrete windows).  I have never found this to be a 
problem, as I use Focus Follows Mouse instead of Click To Focus.  Gimp 
can also be used on Windows.

Blender is a very nice 3D modelling tool.  Again, there are many complaints 
about the interface.  Most users that get used to Blender's interface will 
tell you that it makes them very efficient once they got over the learning 
curve.  Blender is also available on Windows.

As for IDEs, you have the option of KDevelop or Eclipse CDT.  I personally 
like to use Kate.  Kate is simply a nice source code editor, and it doesn't 
have all of the features of an IDE.  I like to work with a command prompt 
though.  I use kdbg for a visual debugger.

One extremely powerful tool that you will not get on Windows is valgrind.  
This is a memory checker and source code profiler.  Once you have used this 
tool, you will never again want to use a platform that doesn't have it. (Of 
course, you can always pay BIG bucks for Purify on Windows)

All of these wonderful tools are FREE (in multiple ways).

Another benefit you will notice is the significant difference in filesystem 
performance between Linux and Windows.  Paged terrains will load much faster 
on Linux.  In some of my applications, I see nearly double the framerate in 
Linux than I do on Windows.

Hope This Helps,
Justin

P.S. If you would like more information on making the switch, you are 
welcome to contact me outside of the mailing list.
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] Looking towards 2.4, and what might go into it.

2007-12-08 Thread KSpam
 My own short list for contenders for integration are:

   osgOQ - Occlusion Querry support
   osgCal - Cal3D integration
   osgAL - OpenAL integration

osgEphemeris would be a nice node kit to integrate for 2.4 as well.
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] how to manage different model types

2007-12-06 Thread KSpam
Stephane,

On Thursday 06 December 2007 09:13:08 Stephane DUGUET wrote:
 For instance, I'm working today with a plane and a copter.

 If I place these two models at origin one is pointing head to north and
 the second is pointing head to east.

 Meaning that the views, position and transformations for plane and
 copter have to be different. Is it possible to make it generic (at least
 linked to a terrain)?

I use a small XML configuration to tie a model to some additional parameters.  
For instance, when I request a tank model, the XML configuration includes 
the model file to load, along with a top-level rotation, translation, and 
scale for that model.  When loading the model, I add the model node as a 
child of a matrix transformation node if the configuration says that a 
rotation, translation, or scale is required.

Having such a configuration file allows a client to add their own models 
without needing special tools or an expert to preprocess the model.

Hope This Helps,
Justin
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


[osg-users] Using osgSim::OverlayNode

2007-12-06 Thread KSpam
My application utilizes a large terrain database, and it relies heavily on 
osgSim::OverlayNode.

Originally, I used OBJECT_DEPENDENT_WITH_ORTHOGRAPHIC_OVERLAY for the overlay 
technique.  With this technique, my application works properly; however, it 
is very resource intensive, and the overlay shapes are noticeably pixelated.

Ideally, I would like to switch to using 
VIEW_DEPENDENT_WITH_ORTHOGRAPHIC_OVERLAY as the overlay technique.  With this 
technique, the overlay shapes look much better (no noticeable pixelation).  
Additionally, this technique significantly reduces the memory footprint and 
increases the frame rate of my application.  Unfortunately, my application 
does not work properly.  It appears that many of the overlay shapes are 
getting partially or completely clipped, which results in an incomplete 
overlay.

VIEW_DEPENDENT_WITH_ORTHOGRAPHIC_OVERLAY appears to be highly-dependent on the 
value of the overlay base height.  This is a problem, as the terrain 
elevation of my database is variable, and I am not able to find a value that 
works well from all viewing angles.

What can I do to allow the VIEW_DEPENDENT_WITH_ORTHOGRAPHIC_OVERLAY technique 
to work better in my environment?

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


Re: [osg-users] STLport and OSG on windows?

2007-11-21 Thread KSpam
On Wednesday 21 November 2007 02:49:18 Robert Osfield wrote:
 It might be easier just to dual boot linux and then use linux as a way
 of testing things with a totally different environment.  Testing on
 multiple OS with multiple compilers is a good way to shake down bugs.

I have found that given the same hardware, the load time for files is 
literally double on Windows what it is on Linux.  In my case, I am running a 
64 bit Linux system and a 32 bit Windows system, which might account for some 
of the speed difference.  However, I truly believe that the performance 
difference between Windows and Linux is primarily due to differences in the 
STL implementations, and I believe that STLport is the best way to fix that 
on Windows.

I have put together some test projects (non-OSG) with STLport that show an 
approximate 30% improvement in load speed on Windows.  STLport does provide a 
slight speed advantage on Linux as well, but the improvement is only a few 
percent.  It is important to note that these results are based on release 
mode performance.  Debug mode is much harder to characterize, as Microsoft 
STL and STLport both use checked STL implementations (a very good thing), and 
gcc does not (unfortunately).  The STLport checked STL implementation seems 
to be more thorough, but it also runs slower than the Microsoft STL.

Most of the STL is a header-only library.  Many implementations allow setting 
defines to configure the implementation.  Libraries and executables that rely 
on the STL and include STL types in the interface should be compiled with the 
same configuration.  The checked STL configuration is not compatible with the 
optimized configuration.  This is the reason why debug libraries are 
specifically required to link to debug executables in Windows.  On Linux with 
the gcc STL, it is not a problem to link release libraries to a debug 
executable.

A change in STL implementation (on any platform) will require rebuilding all 
libraries that utilize an interface with STL types.  For instance, OSG passes 
std::string as part of its interface; therefore is has a STL interface.  On 
the other hand, QT has its own string class.  As far as I can tell, QT would 
not have to be recompiled with STLport support, but OSG would.

I am still trying to get funding in order to do a porting effort to STLport in 
our software.  If that happens, I will be able to provide better numbers.

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


[osg-users] osgconv and missing textures

2007-11-20 Thread KSpam
When running osgconv, textures that are not found or that are missing plugins 
will not be added to the resulting OSG file.  Is there a way to force the 
writer to add the texture name into the output file?

Often times, I receive models with incorrect texture names.  In one case, I 
have a 3DS file with textures that are missing extensions (i.e. filename 
instead of filename.jpg or filename.JP instead of filename.JPG).  Since OSG 
plugins are used based on the file extension, there are no plugins that will 
match the texture file.  If there is a way to force the texture names to the 
output file, I could easily hand-edit the OSG file to fix the texture names.

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


Re: [osg-users] paged database with height above terrain (HAT)

2007-11-09 Thread KSpam
Mark,

I have very similar requirements as you.  In order to keep the model HAT in 
sync with the terrain, I use a ReadFileCallback.

class MyReadFileCallback
: public osgDB::Registry::ReadFileCallback
{
public:
virtual osgDB::ReaderWriter::ReadResult
readNode
(
const std::string fileName,
const osgDB::ReaderWriter::Options* options
)
{
osgDB::ReaderWriter::ReadResult result =

osgDB::Registry::instance()-readNodeImplementation(fileName, options);
if (result.validNode())
{
const osg::BoundingSphere 
bs(result.getNode()-getBound());
MySceneManager::instance().updateHeights(bs);
}

return result;
}
};

// Register the callback
osgDB::Registry::instance()-setReadFileCallback(new MyReadFileCallback());

The ReadFileCallback is called everytime a file is read by OSG.  This includes 
paged terrain files.  In MyReadFileCallback, I pass the newly-loaded file's 
bounding sphere into a scene manager.  In my case, I have a singleton that 
manages the scene graphs.

The scene manager is responsible for knowing which models are tied to the 
ground.  The following pseudocode describes what updateHeights does:

// Quick filter
// See if the latest loaded file is likely to be a terrain file
// (i.e. small models need not apply here)
if (bounding sphere radius  100)
return;

// See if any models are within range of the latest loaded file
foreach model that is tied to the ground
calculate horizontal distance from model to bounding sphere 
center
if (horizontal distance  bounding sphere radius)
queue a line segment for the IntersectionVisitor

// Update the model heights
if (at least one line segment was queued to the IntersectionVisitor)
apply the intersection visitor to the terrain to obtain heights
foreach line segment
get the intersection point
update the height for the appropriate model

With large terrains, the intersection visitor can be time-consuming; 
therefore, we want to minimize the number of times an intersection visitor is 
applied to the terrain.  This process should only update heights for models 
that are specifically affected by the newly-loaded file.

Hope This Helps,
Justin

On Friday 09 November 2007 19:54:27 Mark Hurry wrote:
 I’m trying to position 30 - 40 models on a large terrapage (.txp)  terrain
 database, approximately 300miles x 500miles.

 All the models are scattered around the terrain.  The terrain is obviously
 not present all at one go for me to get all the HAT values I need.

 What I have done is move to each model position and wait for the HAT test
 to return a valid result. However my problem is that I think I am probably
 picking up a low level LOD intersection, so that when I eventually go and
 view the positioned model it can sometimes float above, sink below, or sit
 on the terrain.
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


[osg-users] OverlayNode enhancement

2007-11-07 Thread KSpam
I require the use of osgSim::OverlayNode in my project; however, I require 
that the textures use NEAREST filters instead of LINEAR.  This is not 
possible to do in the current framework.

One thought I have would be to add a prototype texture in the constructor, 
which would default to NULL.  If the prototype texture is not NULL, then 
overlayData._texture could use a clone of the prototype.  Otherwise, we would 
resort to the current process for setting overlayData._texture.

Does this sound reasonable?  If so, would you like me to submit a patch?

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


Re: [osg-users] Is text thread safe in 2.0.0?

2007-08-27 Thread KSpam
Robert,

On Monday 27 August 2007 10:39:41 Robert Osfield wrote:
 Another user recently reported problems with loading text in a
 background thread, which fits your problem too.  This was recently and
 with the SVN version of the OSG so it looks like the problem persists.

 I suspect the problem is either in src/osgText/Font.cpp or the
 freetype plugin, or freetype itself.  If we can pinpoint where the
 problem it should be easy to fix - something like adding a mutex to
 serialize the freetype API access.

 I don't have an app that recreates this problem with rather limits my
 ability to reproduce and fix it.  So I either need an example that
 reproduces the problem or for others to dig into the relevant code and
 fix it.

I had a crashing problem related to osgText::Text.  The stack showed that the 
crash was happening in osgText::Text::setText.  This crash did not seem to 
happen when the freetype plugin was missing.  I was using the arial.ttf font, 
and I had the same problem on both Windows and Linux.

My code was creating a HUD compass tape along the bottom of the window.  The 
compass used the osgText::Text nodes to label the tape marks.  I was 
dynamically allocating the osgText::Text objects every time the view heading 
changed.

When I replaced the dynamic allocation with a preallocated pool of objects, 
the crash went away (i.e. I was not able to produce a crash ... it might 
still be dormant in threading issues).

To Summarize:
- The crash happened when using the freetype plugin
- The crash was triggered during calls to setText
- I did not change any of my setText calls
- Replacing the dynamic osgText::Text allocations fixed the crash

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


Re: [osg-users] CMake instructions for OSG 2.0 don't work on Windows

2007-08-26 Thread KSpam
Ben,

Where is the source code should point to the top-level directory that 
contains the top-level CMakeLists.txt file.

For step two, you need to browse to the directory that contains the 
CMakeLists.txt file instead of the CMakeLists.txt file itself (just as the 
CMake error indicates).  It sounds like a very minor glitch in the 
documentation.

Anyone who has used CMake on Windows is familiar with this process; therefore, 
they probably did not scrutinize the documentation.

Hope this helps!

Justin

On Saturday 25 August 2007 23:13:27 Ben Discoe wrote:
 Figuring that 2.0 has been out long enough now that it must be time to
 upgrade from 1.2, i tried to build OSG 2.0 this evening.

 The file VisualStudio/MUST_READ_ME.txt says to follow the instructions at
 http://www.openscenegraph.org/osgwiki/pmwiki.php/PlatformSpecifics/VisualSt
udio

 Those instructions say:

 1. Install CMake.  (I installed the current version, 2.4.)

 2. Start the CMake GUI, and open the CMakeLists.txt from the root
 OpenSceneGraph directory in the Where is the source code field.

 However, the 'Browse' button in the CMake GUI selects a directory, not a
 file.  So, selecting CMakeLists.txt is not possible.  If one does directly
 paste the full path to CMakeLists.txt into the 'Where is the source' field,
 then CMake reports this error on Configure:

   Error: CMake Error: The source directory
 C:/OpenSceneGraph-2.0/CMakeList.txt is a file, not a directory.

 I can only guess that either the CMake GUI has changed since OSG 2.0 was
 released (?) or the OSG build instructions are just wrong.

 Has anyone else gotten 2.0 to build?  I realize that it is a relatively
 fresh release.

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


Re: [osg-users] Threading Issue: DatabasePager on SingleCore Win32 ...

2007-08-21 Thread KSpam
Robert,

I know the feeling.  My productivity drops significantly on Windows.  
Compiling with -j 3 on Linux still leaves me with a usable system for 
checking email and surfing the internet.  Compiling with 2 processes on 
WIndows pretty much locks out my system for any other use.  What is a 
dual-core processor for anyway?  I really dislike Windows!

Unfortunately, I do not have the luxury of ignoring Windows.  In fact, my 
application is specifically intended for use on Windows ... I just do all of 
the development on Linux.

Anyway, we will help battle the WIndows dragon :-)

Thanks,
Justin

On Tuesday 21 August 2007 07:20:34 Robert Osfield wrote:
 My mood generally takes a turn for the worst when trying to battle Windows,
 along with my productivity, its really not good my mental health, so
 sticking to unix platforms keeps me sane and productive.

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


Re: [osg-users] Threading Issue: DatabasePager on SingleCore Win32 ...

2007-08-20 Thread KSpam
Robert,

On Monday 20 August 2007 12:07:05 Robert Osfield wrote:
 Curious, no one else as been complaining that its this slow.  Perhaps
 they think its normal...  perhaps there is something else particular
 with your system/OS.

 What is the hardware and OS version you have?

I must admit that I see a significant performance difference between Linux and 
Windows (on the same hardware) when it comes to database paging.  The paging 
on Linux is very snappy compared to the paging on Windows.

My Specifications:
Windows OS : XP64 with the latest service pack and updates
Windows applications are compiled 32 bit
Linux OS : Kubuntu amd64
Linux applications are compiled 64 bit
Processor : Intel(R) Pentium(R) D 950 Dual-Core CPU @ 3.4GHz 800FSB 2x2MB 
Cache 64-Bit
Memory : 2GB (4x512MB) PC5300 DDR2/667 Dual Channel Memory
Graphics Card : NVIDIA Geforce 7900 GTX 512MB 16X PCI Express Video Card

I will be happy to help with any profiling if I can be of assistance.

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


Re: [osg-users] Poll for OpenVRML plugin users

2007-08-13 Thread KSpam
Jan,

I just wanted to chime in with my $0.02 regarding Boost as a dependency.

 a) The dependency on Boost is acceptable for you. Boost is quite complex
 to build and a large library.

Boost is a collection of many very high quality libraries.  I would agree that 
building all of the libraries can be complex (mainly because the build tool 
is not as familiar as the standard build tools); however, I doubt that 
OpenVRML uses more than a small percentage of the Boost libraries.  
Additionally, many (most?) Boost libraries are header-only libraries.  This 
means that integrating them is as easy as specifying an include path.

Whenever I look for a third-party library for use in my applications, the 
first thing I look for is a Boost dependency.  I believe that packages using 
Boost dependencies tend to be of a higher quality than those that do not.  
For the most part, I have found this to be the case.

BTW, Boost has an active project for integrating CMake as a build tool.  This 
removes the difficulties of building Boost IMHO.  I am very hopeful that 
CMake becomes the defacto standard for building Boost in the future.

FWIW, I used to think that OSG was more complicated than Boost to build.  With 
the switch to CMake, building OSG is now incredibly easy (and consistent 
across platforms).  Thanks Robert!

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


Re: [osg-users] osgDB::appendPlatformSpecificLibraryFilePaths on Windows

2007-08-10 Thread KSpam
Roger,

I have run into the exact same problem with a customer install.  Thanks for 
submitting your workaround!

Justin

On Friday 10 August 2007 04:23:41 Roger James wrote:
 Robert,



 I have come across an issue with the current implementation of
 osgDB::appendPlatformSpecificLibraryFilePaths on Windows platforms.



 It is common practice on windows to place copies of the supporting dlls
 that your program loads in the same directory as the executable. The
 standard Win32 LoadLibrary function will look for dlls in the directory
 from which the program executable was loaded before searching in other
 standard places which will include the directories on the PATH environment
 variable. This behaviour allows an implementer to ensure that if dlls of
 the same name exist in places such as those on the PATH list that the
 version that is placed in the executable directory is used in preference,
 this is especially important if the dlls are unversioned as is the case
 with the standard build of osg plugins.



 The current implementation of appendPlatformSpecificLibraryFilePaths for
 windows populates the osg library file path with the contents of the PATH
 environment variable. The current implementation of
 osgDB::DynamicLibrary::LoadLibrary searches for the dll on this path and if
 it finds it, it passes the full path name to the windows LoadLibrary
 functions. This defeats that functions searching behaviour and in our case
 causes someone else's version of a plugin dll to be loaded because they had
 put an entry in the PATH environment variable. We have hit this problem in
 real life on user installations. The results can be messy. Curse the
 popularity of OSG :-).



 We have temporarily resolved this by explicitly setting the osg library
 path to empty in our applications.



 I would suggest that this should be the default behaviour for
 appendPlatformSpecificLibraryFilePaths on windows as appending the PATH
 contents and some system directories is in some cases wrong, as described
 above, and in most cases superfluous as osgDB::DynamicLibrary::LoadLibrary
 will call windows LoadLibrary with the bare file name if it cannot be found
 on the osg paths, windows LoadLibrary will then run its own search
 algorithm which will include the PATH environment variable and system
 directories.



 Comments anyone?



 I no one disagrees I will submit a patch.



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


[osg-users] Paged Terrain and ground-tied entities

2007-08-03 Thread KSpam
My application used paged terrain, and I require some entities to be tied to 
the ground.

I am currently using an update callback in order to poll the current terrain 
height (osgUtil::IntersectVisitor) to ensure that the ground-tied entities 
are at the correct altitude.  Unfortunately, this is a waste of processor 
resources (and framerate).

I would like a way to determine that new terrain nodes have been loaded in 
order to minimize extraneous terrain polling.  Is there a on new terrain 
callback?

Can someone point me to an efficient strategy?

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