[osg-users] Bug in Sequence.cpp

2012-08-15 Thread Sebastian Messerschmidt

Hello,

I've encountered a bug in Sequence.cpp where the update function crashes 
(OSG 3.1.2, VisualStudio 2005)
The problem is the _begin,_end in conjunction with the frameTime list. 
If a setInterval is called with invalid values the update function will 
determine an incorrect index into the _frameTime vector.

Now there are two questions how to fix this.
1. As I don't know the details about the sequence implementation I'm 
wondering if the indices are put in correctly.
It seems that most of the flt-files insert a range of 1,1 and only 
define one frame which later on will access the _frameTime[1].
The question here is, is the frame with number 1 really the index 1? 
Maybe someone can help me out here, as I don't know the exact 
specification for openflight.

2. I see two approaches here.
First is to fix the sequence numbers and insert begin-1 and end-1 
instead of the original values.
Also there should be check before inserting, if the _frameNumber size is 
sufficient. I additionally could add a runtime check before accessing 
the _frameTime vector.


Second option is to look into the openflight importer. Maybe the problem 
is here. Either the source file is not valid at this point, or the 
importer is using the wrong indices.


So any opinions how to fix it?


This is the sequence in question:

 Sequence {
name test
nodeMask 0x
cullingActive TRUE
defaultTime 1
frameTime {
  0
}
lastFrameTime 0
interval LOOP 1 1
duration 1 -1
mode START
sync 0
clearOnStop 0
num_children 1
Geode {
  DataVariance STATIC
  name p3813
  nodeMask 0x0
  cullingActive TRUE
  StateSet {
DataVariance STATIC
rendering_hint DEFAULT_BIN
renderBinMode INHERIT
GL_CULL_FACE ON
GL_LIGHTING ON
Use Material_4
Use CullFace_1
  }
  num_drawables 1
  Geometry {
DataVariance STATIC
useDisplayList TRUE
useVertexBufferObjects FALSE
PrimitiveSets 1
{
  DrawArrays QUADS 0 4
}
VertexArray Vec3Array 4
{
  -2.04065 -7.8943 -5.90435
  5.11647 -6.81152 -5.90435
  2.69813 7.57828 -5.90601
  -5.07137 5.89075 -5.90601
}
NormalBinding PER_VERTEX
NormalArray Vec3Array 4
{
  -2.50113e-005 0.000115154 1
  -2.50113e-005 0.000115154 1
  -2.50113e-005 0.000115154 1
  -2.50113e-005 0.000115154 1
}
ColorBinding OVERALL
ColorArray Vec4Array 1
{
  1 1 1 1
}
  }
}
  }

cheers
Sebastian


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


Re: [osg-users] Bug in Sequence.cpp

2012-08-15 Thread Sebastian Messerschmidt

Okay,

The problem was in one of my visitors, that was setting the wrong indices.
Anyways, any objections introducing a check in the setInterval function?

cheers
Sebastian

Hello,

I've encountered a bug in Sequence.cpp where the update function 
crashes (OSG 3.1.2, VisualStudio 2005)
The problem is the _begin,_end in conjunction with the frameTime list. 
If a setInterval is called with invalid values the update function 
will determine an incorrect index into the _frameTime vector.

Now there are two questions how to fix this.
1. As I don't know the details about the sequence implementation I'm 
wondering if the indices are put in correctly.
It seems that most of the flt-files insert a range of 1,1 and only 
define one frame which later on will access the _frameTime[1].
The question here is, is the frame with number 1 really the index 1? 
Maybe someone can help me out here, as I don't know the exact 
specification for openflight.

2. I see two approaches here.
First is to fix the sequence numbers and insert begin-1 and end-1 
instead of the original values.
Also there should be check before inserting, if the _frameNumber size 
is sufficient. I additionally could add a runtime check before 
accessing the _frameTime vector.


Second option is to look into the openflight importer. Maybe the 
problem is here. Either the source file is not valid at this point, or 
the importer is using the wrong indices.


So any opinions how to fix it?


This is the sequence in question:

 Sequence {
name test
nodeMask 0x
cullingActive TRUE
defaultTime 1
frameTime {
  0
}
lastFrameTime 0
interval LOOP 1 1
duration 1 -1
mode START
sync 0
clearOnStop 0
num_children 1
Geode {
  DataVariance STATIC
  name p3813
  nodeMask 0x0
  cullingActive TRUE
  StateSet {
DataVariance STATIC
rendering_hint DEFAULT_BIN
renderBinMode INHERIT
GL_CULL_FACE ON
GL_LIGHTING ON
Use Material_4
Use CullFace_1
  }
  num_drawables 1
  Geometry {
DataVariance STATIC
useDisplayList TRUE
useVertexBufferObjects FALSE
PrimitiveSets 1
{
  DrawArrays QUADS 0 4
}
VertexArray Vec3Array 4
{
  -2.04065 -7.8943 -5.90435
  5.11647 -6.81152 -5.90435
  2.69813 7.57828 -5.90601
  -5.07137 5.89075 -5.90601
}
NormalBinding PER_VERTEX
NormalArray Vec3Array 4
{
  -2.50113e-005 0.000115154 1
  -2.50113e-005 0.000115154 1
  -2.50113e-005 0.000115154 1
  -2.50113e-005 0.000115154 1
}
ColorBinding OVERALL
ColorArray Vec4Array 1
{
  1 1 1 1
}
  }
}
  }

cheers
Sebastian


___
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


[osg-users] change GraphicsWindowIOS

2012-08-15 Thread Laith Dhawahir
Hi,
 is it possible that I change inside without compiling OpenSceneGraph again, 
actually what am looking for us to make changes inside GraphicsWindowIOS to 
support transparent background or there is a better way for doing that ?

Thank you!

Cheers,
Laith

--
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=49266#49266





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


[osg-users] [osgPlugins] flt: using Document::setSubSurfacePolygonOffset()

2012-08-15 Thread We See
Hi,

I want to use userdefined PolygonOffsets per subface-level. This seams to be 
possible with the method Document::setSubSurfacePolygonOffset(). But I didn't 
find any example how to use this method. Is it at all possible to use 
Document::setSubSurfacePolygonOffset() without changing the flt-Code itself?
Can anybody help me?

Thank you!

Cheers,
WeSee

--
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=49267#49267





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


Re: [osg-users] OSG Arrays and custom allocators?

2012-08-15 Thread David Callu
Hi Paul,


2012/8/13 Paul Martz pma...@skew-matrix.com

 Hi all --

 There doesn't seem to be a way to use a custom allocator with an OSG Array
 type. Is that correct, or have I missed something?



 You're right



 I have a large store of array data, and want to create a new instance of
 an OSG Array that references that data store without invoking a data copy
 or per-element constructor. The typical way to do this in C++ is with a
 custom allocator, but as near as I can tell, OSG's Array types don't allow
 an allocator as a template parameter.

 If I can't use a custom allocator, does anyone have any ideas on how to
 create an OSG Array that references a pre-allocated data store?

 Any ideas would be appreciated, thanks.



.
OSG Array use an osg::MixinVectorT template that use a std::vector under
the hood.
I think to some solutions :

1) extend MixinVector template with a second parameter, the CustomAllocator
and pass it to the std::vector used in this template. Then extend
osg::TemplateArray in the same way.
change
typedef TemplateIndexArrayGLbyte,Array::ByteArrayType,1,GL_BYTE ByteArray;
in
template AllocT = defaultAlloc
class  ByteArray :
public  TemplateIndexArrayGLbyte,Array::ByteArrayType,1,GL_BYTE
{
...
};
Then adapt ArrayVisitor, ConstArrayVisitor and all dependency to accept a
template instead of a class

class ArrayVisitor
{
template AllocT = defaultAlloc
virtual void apply(ByteArrayAllocT) {}
...
};

Really big work, and there are some limitations (serialization for example).
(This could be more simple with C++11 new possibility)



2) Change osg::MixinVectorT in your custom OSG implementation then use
Allocator that you need
and create Vec3ArrayMyAlloc and other osg::Array with your allocator,
extend ArrayVisitor for your new
Arrays types, and so on for all Array's dependency that your code
require.



3) Change osg::MixinVectorT to don't use std::vector anymore (do the
vector stuff yourself)
and add in the public interface a function that allow user to change
Allocator of array element at runtime.
All element of the vector will be remove if you change the allocator to
avoid any memory corruption.


4) You probably already dig this solution but ...
If you can store your large store of array data in an std::vector,
then just do a std::swap between std::vector and osg::Array.


5) In the same way of 3) define a custom allocator that could change its
behaviours at runtime, but still use a std::vector.

templateclass ValueT
class MixinVector
{
typedef typename std::vectorValueT, MyAdaptableAllocator vector_type;
public:
...
};

Allocator could have a callback mechanism like
osg::Node/osg::NodeCallback.
You can do something like this in allocator to don't hurt performance
in default behaviours (with if/else optimization):

   void MyAllocator::function()
   {
   if (callback == NULL)
  do stuff
   else
  callback()
   }






Anyway there are no really good solution...

HTH
David





 --
   -Paul Martz  Skew Matrix Software
http://www.skew-matrix.com/
 __**_
 osg-users mailing list
 osg-users@lists.**openscenegraph.org osg-users@lists.openscenegraph.org
 http://lists.openscenegraph.**org/listinfo.cgi/osg-users-**
 openscenegraph.orghttp://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] OSG Arrays and custom allocators?

2012-08-15 Thread Peter Hrenka
Hi,

Am 13.08.2012 18:07, schrieb Paul Martz:
 Hi all --
 
 There doesn't seem to be a way to use a custom allocator with an OSG Array 
 type. Is that correct, or have I missed something?
 
 I have a large store of array data, and want to create a new instance of an 
 OSG Array that references that data store without invoking a data copy or 
 per-element constructor. The typical way to do this in C++ is with a custom 
 allocator, but as near as I can tell, OSG's Array types don't allow an 
 allocator as a template parameter.
 
 If I can't use a custom allocator, does anyone have any ideas on how to 
 create an OSG Array that references a pre-allocated data store?

Maybe the osgsharedarray example can give you a hint.
It is not using STL-style allocators but you can
subclass an osg::Array.
 
 Any ideas would be appreciated, thanks.

Hope this helps.

Peter

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


[osg-users] [osgPPU] set new camera pointer

2012-08-15 Thread Daniel Schmid
Hi Art

I create a processor and units and hock to processor to the root scene node.
Then as soon as the viewer is up, I set the processors camera pointer.

Now in my application I have the feature of destroying the view and setting it 
up again (we use composite viewer). 

As soon as I set the processors camera to the new camera that belongs to the 
new view, I have a random checkerboard texture which is rendered. 

What is the correct procedure when the scene graph is not changed, neighter the 
ppus, but the viewer can be added and removed. How can I tell osgPPU to 
completely invalidate its resources?


Thank you!

Cheers,
Daniel

--
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=49270#49270





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


Re: [osg-users] change GraphicsWindowIOS

2012-08-15 Thread Stephan Maximilian Huber
Hi Laith,

Can't you set the opaque-property of the gl-view' layer before realizing
the viewer? (Out of my head:)

osgViewer::GraphicsWindowIOS* win =
dynamic_castosgViewer::GraphicsWindowIOS*(your_context);
if (win) {
UIView* view = (UIView*)win-getView();
CALayer* layer = view.layer;
if (layer) layer.opaque = NO;
}

if this doesn't work I recommend adding a new flag to
osgViewer::GraphicsWindowIOS::WindowData and checking that flag from
inside GraphicsWindowIOS.

For the latter solution you'll have to recompile osg. And please submit
your changes to osg.submission or create a pull request for
https://github.com/stmh/osg/tree/iphone

HTH,
Stephan

Am 15.08.12 12:17, schrieb Laith Dhawahir:

 Hi,
  is it possible that I change inside without compiling OpenSceneGraph again, 
 actually what am looking for us to make changes inside GraphicsWindowIOS to 
 support transparent background or there is a better way for doing that ?
 
 Thank you!
 
 Cheers,
 Laith
 
 --
 Read this topic online here:
 http://forum.openscenegraph.org/viewtopic.php?p=49266#49266
 
 
 
 
 
 ___
 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


[osg-users] Problem using AutoTransform with LOD node

2012-08-15 Thread Michael Schanne
Hi,

I am trying to create a scene for a CAD-type app where I have objects that 
should be a constant screen size as I zoom in and out, but when I cross a 
certain zoom threshold it should change to a different size (for example half 
its original size).  I tried to implement this using a combination of 
AutoTransform and LOD nodes.  Here is a sample graph of two objects:

AutoTransform AutoTransform
 \   /
   LOD
  / \
MatrixTransform  MatrixTransform
 \   /  
 Geode

The problem I have is that when I have the AutoTransforms set to 
autoScaleToScreen=true, then the level of detail does not change when it 
should.  It always stays at whatever level it started at regardless of how much 
I move the camera in or out.  If I set autoScaleToScreen to false, then the LOD 
behaves as I expect (meaning it changes when I move the camera from one range 
to another).

What might be causing this to happen?  Is there another way to get the effect I 
want?
... 

Thank you!

Cheers,
Michael

--
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=49272#49272





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


Re: [osg-users] OSG Arrays and custom allocators?

2012-08-15 Thread Paul Martz
Hi David. Thanks for the many suggestions. Unfortunately, the code I'm working 
on needs to work with a released version of OSG, so mods to OSG itself are not 
an option.


Apparently I overlooked the obvious swap() solution. I've done a quick test and 
I believe this will work for me.


And thanks, Peter, for the pointer to the mysharedarray example. This is also a 
workable solution, if I encounter problems with swap().

   -Paul


On 8/15/2012 5:29 AM, David Callu wrote:

Hi Paul,


2012/8/13 Paul Martz pma...@skew-matrix.com mailto:pma...@skew-matrix.com

Hi all --

There doesn't seem to be a way to use a custom allocator with an OSG Array
type. Is that correct, or have I missed something?


  You're right

I have a large store of array data, and want to create a new instance of an
OSG Array that references that data store without invoking a data copy or
per-element constructor. The typical way to do this in C++ is with a custom
allocator, but as near as I can tell, OSG's Array types don't allow an
allocator as a template parameter.

If I can't use a custom allocator, does anyone have any ideas on how to
create an OSG Array that references a pre-allocated data store?

Any ideas would be appreciated, thanks.



.
OSG Array use an osg::MixinVectorT template that use a std::vector under the 
hood.
I think to some solutions :

1) extend MixinVector template with a second parameter, the CustomAllocator
and pass it to the std::vector used in this template. Then extend
osg::TemplateArray in the same way.
change
typedef TemplateIndexArrayGLbyte,Array::ByteArrayType,1,GL_BYTE ByteArray;
in
template AllocT = defaultAlloc
class  ByteArray :
public  TemplateIndexArrayGLbyte,Array::ByteArrayType,1,GL_BYTE
{
...
};
Then adapt ArrayVisitor, ConstArrayVisitor and all dependency to accept a
template instead of a class

class ArrayVisitor
{
 template AllocT = defaultAlloc
 virtual void apply(ByteArrayAllocT) {}
 ...
};

Really big work, and there are some limitations (serialization for example).
(This could be more simple with C++11 new possibility)



2) Change osg::MixinVectorT in your custom OSG implementation then use
Allocator that you need
 and create Vec3ArrayMyAlloc and other osg::Array with your allocator,
extend ArrayVisitor for your new
 Arrays types, and so on for all Array's dependency that your code require.



3) Change osg::MixinVectorT to don't use std::vector anymore (do the vector
stuff yourself)
 and add in the public interface a function that allow user to change
Allocator of array element at runtime.
 All element of the vector will be remove if you change the allocator to
avoid any memory corruption.


4) You probably already dig this solution but ...
 If you can store your large store of array data in an std::vector, then
just do a std::swap between std::vector and osg::Array.


5) In the same way of 3) define a custom allocator that could change its
behaviours at runtime, but still use a std::vector.

templateclass ValueT
class MixinVector
{
 typedef typename std::vectorValueT, MyAdaptableAllocator vector_type;
public:
...
};

 Allocator could have a callback mechanism like osg::Node/osg::NodeCallback.
 You can do something like this in allocator to don't hurt performance in
default behaviours (with if/else optimization):
void MyAllocator::function()
{
if (callback == NULL)
   do stuff
else
   callback()
}






Anyway there are no really good solution...

HTH
David



--
   -Paul Martz  Skew Matrix Software
http://www.skew-matrix.com/
_
osg-users mailing list
osg-users@lists.__openscenegraph.org 
mailto:osg-users@lists.openscenegraph.org
http://lists.openscenegraph.__org/listinfo.cgi/osg-users-__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

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


[osg-users] Animation of shared model

2012-08-15 Thread Thilo Weigel
Hi,

I'd like to place several instances of the same model in a scene and play the 
model's animation individually on each instance - just like having several 
nathans standing around and letting each one scratch his head asynchronously to 
the others.

The model is loaded once and assigned  to a osg::Group. The model's instances 
are placed by attaching the osg::Group  to different 
PositionAttitudeTransforms. Similar code as in the osganimationviewer is used 
to retrieve the model's osgAnimation::BasicAnimationManager which is then added 
as an UpdateCallback for each PositionAttitudeTransform.

Obviously, the animations can now only be played synchronously on all 
instances. How could I achieve being able to start the animation of each 
instance individually - for example to let each nathan start scratching its 
head for a few seconds after clicking on it?

Thanks a lot for any hints,

Cheers,
Thilo

--
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=49274#49274





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


[osg-users] Siggraph 2012 OSG BOF Summary

2012-08-15 Thread John Richardson
Greetings and Salutations to the OSG community,

 

The SIGGRAPH 2012 OSG BOF was a resounding success.

 

Why

 

Because

1)  The presenters were excellent [thanks Luis, Alejandro, Eric, Art and
Robert]

They showed up [even for the pre BOF planning meeting on Monday], put up
with my jokes, were professional and most likely could all sing [see
below]...:) 

2)  The presentations were excellent [thanks Luis, Alejandro, Eric, Art
and Robert]

The quality of the research / applications presented was excellent. Luis
had a presentation in other BOF's. VICOMTECH [Luis / Tassilo and colleagues]
is a Spanish research consortium and will host next year's Web3D symposium.
Art, I believe had a paper accepted at SIGGRAPH which is very prestigious.
Some of Luis's colleagues had some posters at SIGGRAPH. Eric had some great
comments on OSG and video walls. Alejandro had an excellent presentation on
plate tectonics research at the National University of Mexico.

Luis's presentation also complemented a presentation by ESRI in the CG for
Simulation BOF. The crowd seemed enthused with Robert's DICOM and shadow and
scripting future for OSG.

 

An extremely impressive showing by the group of presenters. I really hit the
jackpot on presenters this year. [and previous years of course].

 

3)  The room was the same room that the SIGGRAPH educator's program used
on Monday Aug 6. Thus it had an industrial grade screen, projector and
professional sound system. It also had water bottles with the Los Angeles
Convention Center logo on the bottles for all the presenters.

I brought along a projector and Karaoke machine [powered microphone] and was
planning on singing while I presented Robert's slides. However, since the
A/V setup for the educator's was very loud and professional, I just spoke
Robert's slides using the supplied sound system. Hopefully, in a not quite
monotonic voice but with true feeling.

 

The goddess of OSG sound must have been protecting the BOF room.

 

4)  There was probably 50 people in the room. Maybe more.

5)  There were a few wish list features fantastically enunciated by
the crowd. I'll dig it up and send to Robert.

6)  The community. No matter where the BOF is held, the room always has
a good crowd. Pay attention to Art's presentation on the need for more forum
moderators and volunteers.

7)  I got a walking teapot from Pixar after the BOF.

 

There was no BOF scheduled after the OSG BOF. So, the presenters and true
believers had a bit of extra post BOF time to pontificate, mull, conduct
deep thoughts,.. I thought deep thoughts about singing but realized that I
left the Karaoke CD's at home. Bummer.

 

I'll send the presentations to Robert soon. All the presenters really wanted
their presentations posted and read by the community. So, have fun.

 

I have a few pictures that I will send to Robert to be posted.

 

Note: In a few weeks I may post some questions related to next year's BOF
for the community to consider [time, day,...]

 

John F. Richardson



smime.p7s
Description: S/MIME cryptographic signature
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org