[osg-users] bad cache side-effect from osgDB::readNodeFile() in OSG 3.x

2012-03-10 Thread Jim Brooks
My program has been working fine with OSG 2.x.
First it passes a .osga (archive file containing a large 3D model).

const string pathname =  GoldenGate.osga;
return osgDB::readNodeFile( pathname );

Then later it loads texture files using osgDB::readImageFile().

But OSG 3.x broke the ability, in my program, to load texture directly
from files
(files on the file-system, not inside the .osga archive).

The .osga archive incorrectly sticks in osgDB's state,
which breaks osgDB::readImageFile() for regular file loading.

OSGA_Archive::readObject(obj, data/textures/cloud0.png) failed, file
not found in archive


A kludge was to disable caching then everything just worked:

RefPtrosgDB::ReaderWriter::Options options = new
osgDB::ReaderWriter::Options();
options-setObjectCacheHint( osgDB::ReaderWriter::Options::CACHE_NONE );

return osgDB::readNodeFile( pathname, options );

--
Jim Brooks
jimblist -at- gmail -dot- com
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] bad cache side-effect from osgDB::readNodeFile() in OSG 3.x

2012-03-10 Thread Jim Brooks
Hi Robert,

Could you create a small example problem and dataset that reproduces
this, we can then start homing in on the problem.

You can download my whole program/data.

Search for KLUDGE, commenting-out
these two lines with Options should reproduce the problem.

During debugging, just skipping the loading of the .osga file
also circumvented this problem, HTH.

Edit palomino/src/graph/model_cache.cc

...
// -- KLUDGE:
RefPtrosgDB::ReaderWriter::Options options = new
osgDB::ReaderWriter::Options();
options-setObjectCacheHint( osgDB::ReaderWriter::Options::CACHE_NONE );
return osgDB::readNodeFile( pathname, options );
...

ftp://ftp.palomino3d.org/sim/palomino_src_20120310.txz
ftp://ftp.palomino3d.org/sim/palomino_data_misc_20091027.tar.bz2
ftp://ftp.palomino3d.org/sim/palomino_data_models_20090615.tar.bz2
ftp://ftp.palomino3d.org/sim/palomino_data_sounds_20080704.tar.bz2
This is the .osga file:
ftp://ftp.palomino3d.org/sim/palomino_data_terrain_20080206.tar.bz2


--
Jim Brooks
jimblist -at- gmail
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


[osg-users] finding pivot point of a 3D model as a transform node

2010-07-11 Thread Jim Brooks
I need to write a visitor that finds the transform node
corresponding to the pivot point of a 3D model
(eg the center of a wheel of a car model).

Problem is that the visitor finds a Group node
not a matrix/transform node (from an .ac file).

Not sure if OSG is optimizing away some transform nodes
or if my app needs to construct and splice
a transform node over the Group node (??).
If the latter, the vertex for the pivot point
still must be found or computed somehow.
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


[osg-users] How to apply shaders to parts of models

2010-06-07 Thread Jim Brooks
A visitor can be used to apply specific shaders to the parts of a model.
If names were given to parts of the model by the modeling program,
the visitor can look for substrings _shader_metal, window, etc,
using osg::Object::getName().

A better way is if modeling programs could output .osg format
with GLSL directly but none do AFAIK (??).


Hi, I was wondering how models have shaders applied in OSG. Yes I know normally
+a 3d modeler would know this, but I'm a programmer, not a modeler. More
+specifically I am wondering how shaders are applied to certain parts of 
models.
+An example of this would be applying a shader to say, the metal part of a 
seat,
+and another shader to say, the fabric/leather part of a seat. This is 
something
+which I'm not sure if it directly applies to the programming end of making an
+application, and I would really just like to know how it's done in general 
with
+OSG.
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] basic question on OSG smart pointers

2010-06-04 Thread Jim Brooks
Yes, you're right.

A good OSG coding habit is to just always assign to osg::ref_ptr.


Is it true that if I declare a pointer as follows:

osg::Group* test = new osg::Group;

I would have a memory leak since I can not call a delete on test
object pointer?

So, this is the reason why I should use a ref_ptr instead as follows?

osg::ref_ptrosg::Group test = new osg::Group;

In this case the smart pointer will take care of the object deletion as
soon as the test variable goes out of scope.
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] Lightness of the ES version

2010-04-10 Thread Jim Brooks
Is it at all possible to leave out features in the sake of library size?

Yes, using cmake, extra modules/plugins can be omitted.

I don't think there is a reduce memory at expense of performance
run-time setting
if you mean that too (?).
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] 2.8.3 testing

2010-03-22 Thread Jim Brooks
Had compile errors on FreeBSD 8.
Fixed with these two lines:

src/OpenThreads/pthreads/CMakLists.txt

IF(HAVE_PTHREAD_SETAFFINITY_NP)
  IF(NOT CMAKE_SYSTEM_NAME MATCHES FreeBSD)   #---fix---
ADD_DEFINITIONS(-DHAVE_PTHREAD_SETAFFINITY_NP)
  ENDIF(NOT CMAKE_SYSTEM_NAME MATCHES FreeBSD)  #---fix---
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] Modifying scenegraph and update

2010-03-05 Thread Jim Brooks
  Is there some lock/unlock mechanism in OSG or I is it happening by magic?

This is done through the method Object::setDataVariance(), setting it to
STATIC or DYNAMIC. In your case, you should mark that object DYNAMIC in
order to prevent OSG accesing it while you are modifying the mesh.

Not exactly, just setting a node as DYNAMIC
doesn't mean the app can safely alter a node at any time.

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


Re: [osg-users] Modifying scenegraph and update

2010-03-05 Thread Jim Brooks
  Is there some lock/unlock mechanism in OSG or I is it happening by magic?

This is done through the method Object::setDataVariance(), setting it to
STATIC or DYNAMIC. In your case, you should mark that object DYNAMIC in
order to prevent OSG accesing it while you are modifying the mesh.

Not exactly, just setting a node as DYNAMIC
doesn't mean the app can safely alter a node at any time.

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


Re: [osg-users] How to run OSG on iPhone(Mobile Device)?

2010-03-01 Thread Jim Brooks
Does any one know that how to run OSG on iPhone(Mobile Device)?

Is iPhone capable of running a moderately complex OSG program?

The thing has limited RAM and persistent memory
...it can't hold too many 3D models, etc.

(Reminds me of trying to write a program for a VIC-20).
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


[osg-users] osgDB::writeImageFile() jpg vs png

2010-02-09 Thread Jim Brooks
Trying to save an osg::Image as a .jpg file malfunctions.
Either false is returned or .jpg file has weird colors.

But .png format works ok.

osg::ref_ptrosg::Image image = mTextureObject-getImage();
//osgDB::writeImageFile( *image, file.jpg );
osgDB::writeImageFile( *image, file.png );

Tried OSG 2.8.1, 2.8.2, 2.9.6 on Linux, FreeBSD, and that thing from Redmond.
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] locking nodes

2010-02-01 Thread Jim Brooks
I have a multithread application which might update an node
(add/remove children etc) at the same time

Safer/easier to have a global lock for the whole entire scene-graph,
rather than trying to lock a particular node.
Even if one node is locked, you might forget to lock its parent or children.
And even if you add more per-node locks, that creates potential for deadlocks.

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


Re: [osg-users] osgDB::writeNodeFile() omits texture objects

2010-01-16 Thread Jim Brooks
Hi Robert,

Yes, running the Optimizer::TextureVisitor
solved this problem, thanks!

It could be that your databases have the UnrefImageAfterApply enabled
on them which is causing the loaded database to release imagery.  You
can run the Optimizer::TextureVisitor to change the value back, just
have a look at the option for it in the include/osgUtil/Optimizer
header.

Another snippet for you is that is you enable the new texture pool
then UnrefImageAfterApply is automatically disabled so no matter what
you set osg::Texture* never releases the imagery.

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


Re: [osg-users] osgDB::writeNodeFile() omits texture objects

2010-01-15 Thread Jim Brooks
Hi Robert,

Yes, the program was first rendering, then dumping, the scene-graph.

Neither pager-setUnrefImageDataAfterApplyPolicy()
nor export OSG_OPTIMIZER=OFF helped.

My program has procedurally-generated textures that are large,
so OSG freeing them makes sense.

The solution I found is to:

1. The app has to write procedural textures to files (.png),
   so that they'll be referenced in the dumped .osg file.

   image-setFileName( textureName );
   osgDB::writeImageFile( *image, textureName );

2. Dump the scene-graph BEFORE rendering it.

   If rendered first, textures will be lost regardless (why?).

   This is why (the texture : file association is lost):

   Texture2D {
  name terrain_texture
 file terrain_texture.png
  ^^
  [line will be omitted if rendered prior]


 Are loading the scene, rendering and then writing out the scene graph?

  If so then it's likely that your scene graph as the Texture
 UnrefImageAfterApply enabled on them so that once the image data is
 downloaded to OpenGL the images get discarded so there's no handle to
 write them out to disk any more.

 By default this feature is off, but the osgUtil::Optimizer in it's
 default settings will enable it, so if you run the Optimzer this is
 probably the culprit.   The DatabasePager also set up to enable this
 feature to help keep memory usage down.

 Robert.

 On Thu, Jan 14, 2010 at 3:46 PM, Jim Brooks wrote:
  I'm trying to dump the scene-graph.
 
  osgDB::writeNodeFile() writes geometry/colors ok,
  but (OSG 2.9.6) omits texture objects.
 
  Eg, when running osgviewer on the dumped .osg file,
  textures don't appear.
 
  Is this behavior of writeNodeFile() intentional?
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


[osg-users] osgDB::writeNodeFile() omits texture objects

2010-01-14 Thread Jim Brooks
I'm trying to dump the scene-graph.

osgDB::writeNodeFile() writes geometry/colors ok,
but (OSG 2.9.6) omits texture objects.

Eg, when running osgviewer on the dumped .osg file,
textures don't appear.

Is this behavior of writeNodeFile() intentional?
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] What are the your favorite free 3d model sites?

2009-12-18 Thread Jim Brooks
I'm planning to put together a test app and would like to be able to
add some new content to OpenSceneGraph-Data such as a vehicle and house(s).

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


[osg-users] CMakeLists.txt for Apple OS X 10.4 Tiger PowerPC

2009-12-03 Thread Jim Brooks
Got an arcane linker error after switching to MacPorts from Fink.
Had to change OSG's top-level CMakeLists.txt:


IF(UNIX)
# Not sure what this will do on Cygwin and Msys
# Also, remember OS X X11 is a user installed option so it may not exist.
FIND_PACKAGE(X11)
# Some Unicies need explicit linkage to the Math library or the build fails.
IF(NOT APPLE)  --- change
FIND_LIBRARY(MATH_LIBRARY m)
ENDIF(NOT APPLE)  --- change
ENDIF(UNIX)


Apple doesn't really have libm but rather has 2 symlinks:


  [j...@mac]:/usr/lib dir libm.*
  lrwxr-xr-x 1 root wheel 15 Apr 12  2009 libm.dylib - libSystem.dylib

  [j...@mac]:/Developer/SDKs/MacOSX10.4u.sdk/usr/lib dir libm.dylib
  lrwxr-xr-x 1 root wheel 15 Aug 16 18:49 libm.dylib - libSystem.dylib


So, for libm, OSG has been linking the UNIX way but not the Apple way
(since UNIX includes APPLE on cmake).

The question is if this change would break compiling
on other Apple configurations (Leopard/SnowLeopard) ??





Linking CXX shared library ../../lib/libosgText.dylib
cd /Users/jimb/tmp/OpenSceneGraph-2.8.2-squareBracketFix-appleMacFix/src/osgText
  /opt/local/bin/cmake -E cmake_link_script CMakeFiles/osgText.dir/link.txt --
verbose=1
/usr/bin/c++   -arch ppc -isysroot /Developer/SDKs/MacOSX10.4u.sdk -mmacosx-vers
ion-min=10.4 -O2  -mmacosx-version-min=10.4 -ftree-vectorize -fvisibility-inline
s-hidden -dynamiclib -headerpad_max_install_names -compatibility_version 55.0.0
-current_version 2.8.2 -o ../../lib/libosgText.2.8.2.dylib -install_name /Users/
jimb/tmp/OpenSceneGraph-2.8.2-squareBracketFix-appleMacFix/lib/libosgText.55.dyl
ib CMakeFiles/osgText.dir/DefaultFont.cpp.o CMakeFiles/osgText.dir/Font.cpp.o CM
akeFiles/osgText.dir/Font3D.cpp.o CMakeFiles/osgText.dir/String.cpp.o CMakeFiles
/osgText.dir/FadeText.cpp.o CMakeFiles/osgText.dir/TextBase.cpp.o CMakeFiles/osg
Text.dir/Text.cpp.o CMakeFiles/osgText.dir/Text3D.cpp.o
CMakeFiles/osgText.dir/Version.cpp.o ../../lib/libosgDB.2.8.2.dylib
../../lib/libosg.2.8.2.dylib ../../lib/libOpenThreads.2.4.0.dylib -framework AGL
-framework OpenGL /usr/lib/libm.dylib
-lpthread -framework Carbon -framework AGL -framework OpenGL
ld: Undefined symbols:
_acl_copy_ext_native referenced from CarbonCore expected to be defined in libSys
tem
_acl_copy_int_native referenced from CarbonCore expected to be defined in libSys
tem
_task_name_for_pid referenced from CarbonCore expected to be defined in libSyste
m
/usr/libexec/gcc/powerpc-apple-darwin8/4.0.1/libtool: internal link edit command
 failed
make[2]: *** [lib/libosgText.2.8.2.dylib] Error 1
make[1]: *** [src/osgText/CMakeFiles/osgText.dir/all] Error 2
make: *** [all] Error 2
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] normal vectors aren't causing culling

2009-11-28 Thread Jim Brooks
normal vectors aren't causing culling

I had a misunderstanding that a scene-graph
would do back-face culling by normal vectors.

OSG does NOT.  Neither does OpenGL.

So:
  geom-getOrCreateStateSet()-setMode( GL_CULL_FACE, osg::StateAttribute::ON );
  glEnable( GL_CULL_FACE );

GL_CULL_FACE does back-face culling by VERTEX ORDER (without normal vectors).

Sorry, nevermind.

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


[osg-users] normal vectors aren't causing culling

2009-11-26 Thread Jim Brooks
This is very basic

This test-code snippet is supposed to create a simple square with a
normal vector (or vectors).
After rotating it around with the trackball manipulator, the square is
never culled.
Same behavior on OSG 2.6 and 2.8.

Also, having trouble with with a dome composed of squares constructed similarly.
No matter how the normal vectors are assigned, every square is culled
when the viewpoint is inside the dome (the opposite is needed).
Is OSG computing normal vectors after the app sets them?

void
MakeModelSquare( void )
{
osg::ref_ptrosg::Geometry geom = new osg::Geometry;

// Vertexs.
osg::ref_ptrosg::Vec3Array vertexs = new osg::Vec3Array;
const fp x =  10.0f;
const fp y = -50.0f;  // Z (viewplane depth)
const fp z =  10.0f;
vertexs-push_back( osg::Vec3f(  x, y,  z ) );
vertexs-push_back( osg::Vec3f( -x, y,  z ) );
vertexs-push_back( osg::Vec3f( -x, y, -z ) );
vertexs-push_back( osg::Vec3f(  x, y, -z ) );
geom-setVertexArray( vertexs.get() );

// Colors.
osg::ref_ptrosg::Vec4Array colors = new osg::Vec4Array;
colors-push_back( osg::Vec4f( 1.0f, 1.0f, 0.0f, 1.0f ) );
geom-setColorArray( colors.get() );
geom-setColorBinding( osg::Geometry::BIND_OVERALL );

// Normal vectors.
const osg::Vec3f crossProduct = ((*vertexs)[0]) ^ ((*vertexs)[1]);
osg::ref_ptrosg::Vec3Array normals = new osg::Vec3Array;
#if 0
normals-push_back( crossProduct );
geom-setNormalArray( normals.get() );
geom-setNormalBinding( osg::Geometry::BIND_OVERALL );
#else
normals-push_back( crossProduct );
normals-push_back( crossProduct );
normals-push_back( crossProduct );
normals-push_back( crossProduct );
geom-setNormalArray( normals.get() );
geom-setNormalBinding( osg::Geometry::BIND_PER_VERTEX );
#endif

// Compose geode.
osg::ref_ptrosg::Geode geode = new osg::Geode;
geom-addPrimitiveSet( new osg::DrawArrays( GL_QUADS, 0, 4 ) );
geode-addDrawable( geom.get() );

// Attach to scene-graph.
mRootGroup-addChild( geode.get() );
}
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] keyboard differences between OSG 2.8.2 vs 2.8.1 [patch]

2009-10-10 Thread Jim Brooks
Hi Robert,

Yes, it's resolved.
I saw the same keyboard fix already in the svn trunk.

I believe this issue has already been tackled so could you please test
svn/trunk and let me know.

Also for future reference could you provide whole modified files
rather than copy and paste entries as whole files is most reliable way
for me to review changes.

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


[osg-users] keyboard differences between OSG 2.8.2 vs 2.8.1

2009-09-24 Thread Jim Brooks
Hi,

On OSG 2.8.2, square brackets [] and parentheses() return the same values.
OSG 2.8.1 returns different values as expected.
Confirmed using my program and osgkeyboard.
I'm using a USA keyboard on Debian 5 Lenny.

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


Re: [osg-users] keyboard differences between OSG 2.8.2 vs 2.8.1 [patch]

2009-09-24 Thread Jim Brooks
Hi,

Here's a fix for the keys '[' ']' never reaching a keyboard handler:

src/osgViewer/GraphicsWindowX11.cpp
 _extendedKeymap[XK_bracketleft  ] = '(';
 _extendedKeymap[XK_bracketright ] = ')';
 _extendedKeymap[XK_bracketleft  ] = '[';
 _extendedKeymap[XK_bracketright ] = ']';

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


Re: [osg-users] nodemask or switch

2009-08-25 Thread Jim Brooks
When do I need a switch node if I have a nodemask?
[..]
Why - is there extra functionality from the switch, is there a limitation of 
the nodemask?


The difference is in traversal of nodes.

Switch nodes affect ALL traversals.
Node/cull masks affect certain kinds of traversals.

For example, if a model should only be rendered by the main camera
mSecondCamera-setCullMask( 2 );
model-GetNode()-setNodeMask( 1 );
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] Can't write to ALPHA component with custom fragment shader in RTT pass

2009-03-09 Thread Jim Brooks
.
// activate blending to be able to write to gl_FragColor.a
stateset-setMode(GL_BLEND, osg::StateAttribute::ON);
..

No, this comment has a misunderstanding.

Writing to gl_FragColor.a in the fragment shader does work of course
but it isn't the final RGBA value as the pipeline has
a hardware stage AFTER the fragment shader.
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] Can't write to ALPHA component with custom fragment shader in RTT pass

2009-03-09 Thread Jim Brooks
I agree that whatever is put in gl_FragColor.a will not be the final
alpha value in the framebuffer, but at least if we put gl_FragColor.a =
0.0 then the current fragment shader's output color should be
transparent, and so anything behind should be completely visible, right?

Not necessarily.  If the object-that-is-supposed-to-be-transparent
still has depth writing enabled, it will overwrite more distant objects.
Then there's which blend functions are enabled which
can alter the output of the fragment shader.

If not, then is there some other
way to kill a fragment we don't want to show up once we're at the
fragment shader stage?

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


Re: [osg-users] Can't write to ALPHA component with custom fragment shader in RTT pass

2009-03-09 Thread Jim Brooks
OK, but I'm talking about a pre-render pass to an FBO though. The FBO is
attached to an RGBA texture, and we want to be able to store some data
in the alpha channel... So we want what we write to gl_FragColor.a to
make it into the texture directly. Is there a way to do that?

Never used FBO, but guessing it simply switches the destination address,
and the pipeline still operates the same way  (??).
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] modifying vertexs

2009-03-06 Thread Jim Brooks
.
osg::ref_ptrosg::Vec3Array  mVertexs;
mDrawArray = new osg::DrawArrays(osg::PrimitiveSet::POINTS,0,0);

// Modify vertex array (mVertexs is in app side).
mVertexs-push_back( vertex );

// Tell OSG geometry was modified.
mGeometry-setVertexArray( mVertexs.get() );
mGeometry-dirtyDisplayList();
mDrawArray-setCount( mVertexs-size() );
.

Nevermind.

So this code is doing a component-by-component update
after vertexs were modified.  This is correct afterall.

Was wondering why OSG has no higher-level osg::Geometry::dirty().
But since Geometry is composed of PrimitiveSets/DrawArrays
with APP-DEFINED indexs/count into the vertex array,
of course the app (not OSG) has to update components.
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


[osg-users] modifying vertexs

2009-03-05 Thread Jim Brooks
Found two different ways to tell OSG that vertexs were modified.
Maybe these are circumventions that aren't proper (?).

What is the one right way?
Call dirtyDisplayList() ?

ctor()
:   mVertexs(new osg::Vec3Array),
mDrawArray(new osg::DrawArrays( osg::PrimitiveSet::POINTS,0,0))
{
}

void AddParticle( const osg::Vec3 v )
{
mVertexs-push_back( v );

#if REGULAR_OPENGL_POINTS
mDrawArray-setCount( mVertexs-size() );
#endif

#if POINT_SPRITES
// Passing same vertex array causes update.
mGeom-setVertexArray( mVertexs.get() );
#endif

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


Re: [osg-users] principle of Light and LightSource

2008-12-17 Thread Jim Brooks
So, when I want to use more lights I see only the first light.

Thats the graph with two lights:


To render with multiple lights,
arrange the LightSource group nodes vertically:


root
|
V
lightSource 0
|
V
lightSource 1
|
V
  geodes
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] Smoothing camera movements from HMD's input

2008-09-30 Thread Jim Brooks
In order to solve this problem, I was thinking about creating an animation
path (on the fly) from a previously stored orientation to current head
orientation. Is this the correct way to proceed? Or there is some other
technique to smooth the resulting camera movements?

osg::AnimationPath interpolates across rotations and positions (for smoothing).
See examples/osganimate.
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] Shadow techniques status

2008-07-30 Thread Jim Brooks
  ShadowMap does suffer from bad aliasing when the viewpoint is very
  near the shadow.
  The Orange book (GLSL shader) describes how to super-sample
  the depth buffer to mitigate aliasing.

Indeed, aliasing is a big problem with vanilla shadow mapping in
almost all real-world cases.

What you describe can easily be done by client code, using the
osgShadow::ShadowMap::clearShaderList() and
osgShadow::ShadowMap::addShader() methods with the appropriate shaders.
One thing that you need to be careful about when replacing the default
shaders is to use the same uniform names to access the shadow map
sampler and other variables.

Doh!  I wrote shadow map code from scratch but was based on osg::ShadowMap.
My shader used 9x9 sampling (IIRC) which produced little aliasing with
a slight loss of speed.
Of course, 1x1 sampling can be used if the VP isn't near the shadowed object.
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] Shadow techniques status

2008-07-29 Thread Jim Brooks
ShadowMap does suffer from bad aliasing when the viewpoint is very
near the shadow.
The Orange book (GLSL shader) describes how to super-sample
the depth buffer to mitigate aliasing.
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] Only intersecting certain nodes in the scene graph

2008-07-04 Thread Jim Brooks
Or organize the scene graph into intersectable and non-intersectable groups
(faster intersection traversal).
osgUtil::IntersectionVisitor visitor( intersectorGroup.get() );
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] How to document osgShadow?

2008-05-15 Thread Jim Brooks
I could submit modifications to the osgshadow source code
with appropriate comment paragraphs explaining how to use each class.

Sprinkling comments in the example code would help a lot.
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] NodeVisitor won't visit TerrainTile

2008-04-13 Thread Jim Brooks
Yes, that's a pitfall and disadvantage of the Visitor pattern itself
when adding new node types.
The traversal is actually executing code compiled for
the base NodeVisitor (not your derived one) so your
virtual void DerivedVisitor:apply(NewDerivedNode)
doesn't even exist in that context.
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


[osg-users] Collision detection for aircraft

2008-03-04 Thread Jim Brooks
IntersectionVisitor can be used for collision-detection.

But determining whether the collision is fatal or not
(safely sitting on runway vs. crash-dive)
then requires consulting a physics model.
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] Recurse on a private mutex (FreeBSD)

2008-01-28 Thread Jim Brooks
This had me fooled.
The call stack seemed to indicate an Nvidia OpenGL bug
But it wasn't.

#2  0x28913b78 in abort () from /lib/libc.so.6
#3  0x2895bc6f in pthread_testcancel () from /lib/libpthread.so.2
#7  0x28a0314d in _nv07gl () from /usr/local/lib/libGL.so.1
#8  0x28a725e4 in ?? () from /usr/local/lib/libGL.so.1
#19 0x28fd1937 in _nv000486gl () from /usr/local/lib/libGLcore.so.1

FreeBSD has different thread libs.
Mixing them was the real cause.

Solution was to add pthread to TARGET_LINK_LIBRARIES
in CMakeLists.txt (of my app).
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] Recurse on a private mutex (FreeBSD)

2008-01-26 Thread Jim Brooks
Could you provide a stack trace and a few more details about when and
where this problems occurs i.e. which examples and data etc.

Hi Robert,

abort() was called in pthreads before main() was ever reached.
Happens on two different OSG programs (run fine on Linux/Mac/M$).
OSG 1.2 runs fine on the same FreeBSD system.

[New LWP 100101]
[New Thread 0x80ae000 (LWP 100134)]
Fatal error 'Recurse on a private mutex.' at line 986 in file
/usr/src/lib/libpthread/thread/thr_mutex.c (errno = 0)
[New Thread 0x80ae200 (LWP 100132)]

Program received signal SIGABRT, Aborted.
[Switching to Thread 0x80ae200 (LWP 100132)]
0x289085b7 in pthread_testcancel () from /lib/libpthread.so.2
(gdb) bt
#0  0x289085b7 in pthread_testcancel () from /lib/libpthread.so.2
#1  0x288f5c01 in sigaction () from /lib/libpthread.so.2
#2  0x288f5eed in sigaction () from /lib/libpthread.so.2
#3  0x288f66cc in sigaction () from /lib/libpthread.so.2
#4  0x288f6878 in sigaction () from /lib/libpthread.so.2
#5  0x28900ec8 in pthread_mutexattr_init () from /lib/libpthread.so.2
#6  0x294b0470 in ?? ()
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


[osg-users] Recurse on a private mutex (FreeBSD)

2008-01-25 Thread Jim Brooks
Occurs on OSG 2.x on FreeBSD 6.2.
Definitely a FreeBSD-specific problem.
Already tried single-threading.

Fatal error 'Recurse on a private mutex.' at line 986
 in file /usr/src/lib/libpthread/thread/thr_mutex.c (errno = 0)
Abort trap: 6
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] ugly text, Nvidia vs. ATI

2008-01-07 Thread Jim Brooks
Indeed, osgText looks horribly jagged on ATI Radeon 9xxx
but nice/smooth on Nvidia 55/76xx.
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] Crash on exit, Mac Os X

2007-12-19 Thread Jim Brooks
My program crashed on exit every time, on Mac OS X only (OSG 2.2 DMG),
but works reliably on Mac without multi-threading.

export OSG_THREADING=SingleThreaded
mViewer-setThreadingModel( osgViewer::Viewer::SingleThreaded );
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] VTP height field issue

2007-11-28 Thread Jim Brooks
how would i flip it? i suspect i need to change the
transform somehow:

Transform {
  360 0 0 0
  0 180 0 0
  0 0 1 0

You're on the right track, but the matrix elements
are unit float {0.0,..,1.0} values, not degrees.
These 3 rows are 3D unit vectors that
define the 3 orthogonal axises.

-1 0 0   # -1 = 180' rotation
0 1 0
0 0 1

  -180 -90 0 1

No, the last row is the origin of the matrix
(coordinate space).
Changing them results in translation, not rotation.



  

Never miss a thing.  Make Yahoo your home page. 
http://www.yahoo.com/r/hs
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] OSG + sky

2007-10-31 Thread Jim Brooks
I want to integrate enviroment in my application,
for example clouds and sky. As far as my knowledge
is concerned this is not possible in OSG
currenly. Can someone tell me the alternatives.

OSG can be used to render a sky dome/box and clouds
(I've done it).

For cumulus clouds, used libnoise to
procedurally-generate textures and
and a custom sprite node that rendered
a set of viewplane-aligned blended quads
(OSG::Billboard has/had problems staying rotated to
viewplane).


__
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org