Re: [osg-users] Implementing clone() on class derived from osg::Geometry and osg::MatrixTransform

2011-12-12 Thread Filip Arlet
Hi,

clone method is virtual and should return osg::Object*. you can dynamic cast 
(or even static cast if you are sure) to PiGeometry*.

How can I force the program to call PiFaceGeometry::clone() if this is only a 
child of object, on which I called clone()? 
 I am sorry If this question is silly, I am not a good C++ programmer and I 
hate C++
Learn something about virtual functions and polymorphism. Virtual functions 
does the magic for you and calls appropriate functions, if it's called from 
parent class.

About DEEP and SHALLOW copy: shalow copy makes memberwise clone, so every 
variable in original object copies to new one. Only problem there is pointer, 
new object have same value and points to same objects. For example with shalow 
copy MatrixTransform, new one will have shared children with original. But deep 
copy (there are several types - deep copy all, deep copy children etc.) copies 
them too.
What this does mean for your: you can simply call osg::Geometry::clone() and 
then do your job: copy variables edges and surfType, according to copyop (share 
array in shalow copy).

Cheers,
Filip

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





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


Re: [osg-users] Updated to OSG 3.0.0 - asGroup() returning zero.

2011-12-12 Thread Alberto Luaces
Shawn Kennedy writes:

 Hi,

 We use OSG for one of our products, and I recently upgraded it from
 2.6.0 to 3.0.0.  We are now running into a problem where a
 Node-asGroup call which once returned non-zero is now returning zero.
 I'm having difficulty debugging the issue and I'm wondering if anyone
 can shed some light on why this may be happening.

 Little more detail:

 I have a Switch, which I add two children (Nodes) to using
 readNodeFile.  I then try to add a child to one of those children
 using Node-asGroup-addChild, but asGroup is returning zero.

Hi Shawn,

could it be that the plugin you are using for loading your data has
changed a little its behaviour and now it creates a slightly different
graph? You can check this by loading the data in OSG and then exporting
it to a format you can easily read. If the files are small, .osg will
do. Otherwise, you can use osgconvert to do convert it to .dot file and
then process it with the `dot' program in the Graphviz suite
(http://www.graphviz.org/) in order to have a diagram for you to peruse.

Once you solve this, you can go into more robust ways of locating
elements in the graph. Usually the NodeVisitor pattern can locate
specific nodes in it even when the graph suffered changes.

-- 
Alberto

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


Re: [osg-users] Texture image memory leak issue

2011-12-12 Thread Filip Arlet
Hi,

if you check your program on memory leaks (for example with visual leak 
detector) and don't find any leaks, it's probably fine.

The problem is in memory management. There are many things that can cause 
increasing memory:
1) Creating any type of object or buffer on GPU is slow operation, so osg 
recyclates them.
2) Acquiring memory from OS is slow operation. c++ library is usually very 
hungry and call of delete doesn't have to return memory to OS.
3) fragmentation - you can only get whole memory pages. If you allocate 
something persistent in page, you cannot return it and this is something you 
can't solve without custom heap only for your 3D texture.
4) when you do huge allocation request, it's very likely that you can do it 
again, so OS or C++ library can optimalize next request.

Cheers,
Filip

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





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


Re: [osg-users] Building

2011-12-12 Thread Marius Kintel
On Dec 10, 2011, at 23:01 PM, Michael W. Hall wrote:

 I have taken the OSGViewerQT example program and have tried to break it
 into a nice example for myself.

I did something similar and put it here: https://github.com/kintel/QOsgWidget
Since it's a Qt app, it uses qmake, but apart from that I assume it's similar 
to yours.

Feel free to post links to code and error messages. Anything which is 
self-contained enough to just cmake .  make is easy to give a quick spin.

 -Marius

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


Re: [osg-users] OSG and OpenGL rendering does not coincide

2011-12-12 Thread Sergey Polischuk
Hi

IIRC osg by default tweaks projection matrix depending on window aspect ratio, 
you can set desired behavior with camera-setProjectionResizePolicy(...)
Also you can check if viewport is actually same (there can be some difference 
because of window decoration or something)

01.12.2011, 23:33, Juan Herrera juan...@gmail.com:
 Hi,

 I'm reframing my AR question like this:

 Given same projection matrices and model view matrices in OpenGL and OSG, my 
 rendering results do not coincide exactly. The OSG ones are slightly 
 displaced, but the on-screen rotation coincide. There is no skewness in 
 either.

 I think the OpenGL results are the correct ones.

 Where are the places this error could be? My windows size coincide, so I 
 think the viewport is fine. (640x480).

 Thank you!

 Cheers,
 Juan

 PS: Note to moderator: replies to my posts are not being approved. See 
 http://forum.openscenegraph.org/viewtopic.php?t=9485 .

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

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


Re: [osg-users] (no subject)

2011-12-12 Thread Sergey Polischuk
Hi,
Short answer: there are no simple way,
You should get all drawables, grab all primitivesets and set instance count for 
them, write shaders that make use of instanceID to calculate vertex position.
also with instanced drawing you should disable display lists, so for 
performance reasons make sure that your drawables have low primitivesets count 
(single primitiveset is good goal), i'd recommend to use osg optimizer with 
INDEX_MESH | VERTEX_PRETRANSFORM | VERTEX_POSSTRANSFORM on models you gonna 
draw instanced.

03.12.2011, 07:03, michael.a.bo...@l-3com.com:
 Hi Everyone,
 I'm trying to implement a fairly dense forested area and simply adding
 in a bunch of osg::MatrixTransform nodes predictably causes the cull to
 crash. I could try reorganizing the scene around an oct-tree as was
 suggested by a previous discussion on this topic, but for draw
 performance reasons, since each tree is the same model, I would like to
 use the new draw instanced arb. I see that osgdrawinstanced has been
 referenced in many similar threads, but osgdrawinstanced creates its
 geometry on the fly, and in doing so can quite easily use the command
 syntax for instancing. I am trying to apply the technique to a loaded
 model and there is no obvious easy method.

 My question is this, if I load a file using

 osgDB::readNodeFile(somefile.osg);

 How would I set it up for instanced drawing?

 My guess is that I would need to write a node-visitor that collects all
 of the geometry - drawables and sets them up to use the instanced call
 overload instead of the default. I have tried doing this, but my
 implementation has gotten pretty complex, and I want to make sure there
 isn't a more simple way I have overlooked.

 Thank you very much for your time.

 Michael A Bosse'

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


Re: [osg-users] User clip planes and shaders

2011-12-12 Thread Sergey Polischuk
Hi

If you need to get same result as opengl FFP, you should add following line in 
your vertex shader: gl_ClipVertex = gl_ModelViewMatrix * gl_Vertex;
IIRC you need #version 120 to use this. Then all clip planes enabled via 
glEnable would work with shaders

07.12.2011, 22:36, Dave Jones dave_ita...@hotmail.com:
 Hi,

 I have some code that uses osg::ClipPlane to clip a hierarchy of meshes. All 
 I do is create some plane equations relative to the root node's transform and 
 set the planes as attributes that affect the entire tree.

 This works pretty well. When I look at the output in gDEBugger, I can see 
 that the clip equations are invoked after glLoadMatrix is called on the root 
 transform. glEnable is called on the clip planes before any of the geometry 
 in the hierarchy is drawn.

 Currently, I need to port this functionality to a vertex shader for a 
 project. Clipping in a shader is pretty straightforward, but I'm getting a 
 little tripped up on what transformation space the clip planes should be in 
 and how to transfer that to the vertex shader.

 According to the glClipPlane docs, the plane equations are transformed to 
 view space. In my shader, I'm passing the plane equations in as uniforms. For 
 this to work on all vertices, I need to ensure that the clip plane equations 
 have been transformed by the inverse transpose of the model view matrix. The 
 only way that I can think of doing that is creating a uniform update callback 
 which always updates the plane equations based on the camera's current model 
 view matrix.

 This seems a little clunky to me, but I wasn't sure how else to do it. Is 
 there a simpler way that I'm overlooking? This fixed function pipeline model 
 was convenient since it did a lot of this work for me, but it seems like I 
 have to do on my own if I go the programmable pipeline route. Is this a 
 correct assessment?

 Thanks! And sorry if this is a bit long-winded.

 -Dave

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

 ___
 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] Creating flare or shining star with osg

2011-12-12 Thread tolga yılmaz
Hi all;
After several tries to post this mail to the group, i dont take it long: I
am developing a flight simulation. For some reason i have to create a chaff
flare just like an F-16 throws. It should be too bright but doesnt has to
lighten another objects in the scene. Smoke trail animation path etc. and
other effects are easy to do but the flaring part that i just dont have any
idea. How could i do this?
thanks by now...

-- 
Saygılarımla

*Tolga Yılmaz*
*Yazılım Geliştirici*
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] window position and size

2011-12-12 Thread Guy Volckaert
you caj also use the environment variable OSG_WINDOW, e.g.:

set OSG_WINDOW = 40 40 640 480

Note: space delimited.

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





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


Re: [osg-users] Texture image memory leak issue

2011-12-12 Thread Poirier, Guillaume
Thanks for your input. I've upgraded from OSG 2.9.8 to 3.0.1 and the issue 
seems to be gone...


-Original Message-
From: osg-users-boun...@lists.openscenegraph.org 
[mailto:osg-users-boun...@lists.openscenegraph.org] On Behalf Of Filip Arlet
Sent: December-12-11 3:56 AM
To: osg-users@lists.openscenegraph.org
Subject: Re: [osg-users] Texture image memory leak issue

Hi,

if you check your program on memory leaks (for example with visual leak 
detector) and don't find any leaks, it's probably fine.

The problem is in memory management. There are many things that can cause 
increasing memory:
1) Creating any type of object or buffer on GPU is slow operation, so osg 
recyclates them.
2) Acquiring memory from OS is slow operation. c++ library is usually very 
hungry and call of delete doesn't have to return memory to OS.
3) fragmentation - you can only get whole memory pages. If you allocate 
something persistent in page, you cannot return it and this is something you 
can't solve without custom heap only for your 3D texture.
4) when you do huge allocation request, it's very likely that you can do it 
again, so OS or C++ library can optimalize next request.

Cheers,
Filip

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





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


Re: [osg-users] [vpb] Placing an object on a UTM file generated with osgdem

2011-12-12 Thread Ethan Fahy
Object rotation is the last piece of this puzzle.  When on object is placed on 
a geocentric terrain using the methods outlined in this thread, the object 
always appears to be oriented correctly upwards with respect to the center of 
the earth.  However I'm not sure how it is being oriented with respect to its 
rotation.  Does anyone have any insight into this?  For example if I know that 
my object's internal coordinate system specifies that positive x is north and 
positive y is west and I place that object on an arbitrary WGS84, geocentric 
terrain, how will I know how to rotate the object to line up the north 
orientation?

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





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


[osg-users] attachMoveCallback memory leak?

2011-12-12 Thread Gianni Ambrosio
Hi All,
testing my code I realized the following code generates memory leaks.


Code:

osgWidget::Canvas w(test);
w.attachMoveCallback();
BOOST_CHECK_EQUAL(true, false);




If I remove the attachMoveCallback() line I don't have leaks.

Lookig at OSG code it seems the callback object is insert into a:


Code:
typedef std::list osg::observer_ptr Callback   CallbackList;



So, can you explain me the leak please?
Moreover I can't find a way to clean the _callbacks list. Is there any? Should 
I do it before che Canvas object goes out of scope?

Regards,
Gianni

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





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


Re: [osg-users] Setting modelview matrix withviewer.getCamera()-setViewMatrix(modelViewMatrix) not working

2011-12-12 Thread Tueller, Shayne R Civ USAF AFMC 519 SMXS/MXDEC
Jaun,

A couple of suggestions here...

1) look at the source code for setViewMatrixAsLookAt(...) to understand
what it is doing with the input to create the view matrix. It calls a
method makeLookAt(...) which creates an orthonormal basis in the
rotation portion of the matrix from the eye,center,up input and then pre
multiplies the result with the eye.

2) set the view matrix with setViewMatrixAsLookAt(...) and then get the
resultant view matrix back out. Compare the returned result with your
view matrix that you're passing into setViewMatrix(...) and see what is
different.

-Shayne

-Original Message-
From: osg-users-boun...@lists.openscenegraph.org
[mailto:osg-users-boun...@lists.openscenegraph.org] On Behalf Of Juan
Herrera
Sent: Monday, November 28, 2011 11:07 PM
To: osg-users@lists.openscenegraph.org
Subject: Re: [osg-users] Setting modelview matrix
withviewer.getCamera()-setViewMatrix(modelViewMatrix) not working

I might add that viewer.getCamera()-setViewMatrixAsLookAt(eye, center,
up) does work. Why is this different?

Cheers,
Juan Herrera

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





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


[osg-users] Bugs on Mac OS X (Lion)

2011-12-12 Thread Tobias Ottenweller

Hello everyone,

I've found three bugs while using OpenSceenGraph while running on Mac OS 
X Lion (10.7.2). I'm posting them all in this message. Hopefully this is 
ok.



1  -  osgViewer::Viewer

Setting up a viewer without calling 'setUpViewOnSingleScreen()' will 
display the current scene on all available screen. As far as I 
understand this is not a bug but a feature :). But doing so 
OpenSceenGraph does not respect the arrangement of the displays. I 
didn't test a lot (and only with two displays), but it seems that the 
main screen is always assumed to be the left one.



2  -  osgGA::GUIEventAdapter::ScrollingMotion

I'm trying to write my own camera manipulator. Overwriting 
handleMouseWheel of the class StandardManipulator did not work out so 
well. The problem is that I'm only getting 'SCROLL_2D' events. I found 
post about this earlier today saying it has been fixed (sorry lost the 
link).



3  -  osgGA::GUIActionAdapter requestWarpPointer()

I'm trying to keep the mouse cursor always in the middle of the screen 
which works as expected. But after doing so the input freezes for about 
quarter a second. I found this forum entry: 
http://forum.openscenegraph.org/viewtopic.php?t=3933 . Did anybody 
already find a solution for this?



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


Re: [osg-users] [vpb] Placing an object on a UTM file generated with osgdem

2011-12-12 Thread Chris 'Xenon' Hanson
On 12/12/2011 8:37 AM, Ethan Fahy wrote:
 Object rotation is the last piece of this puzzle.  When on object is placed 
 on a geocentric terrain using the methods outlined in this thread, the object 
 always appears to be oriented correctly upwards with respect to the center of 
 the earth.  However I'm not sure how it is being oriented with respect to its 
 rotation.  Does anyone have any insight into this?  For example if I know 
 that my object's internal coordinate system specifies that positive x is 
 north and positive y is west and I place that object on an arbitrary WGS84, 
 geocentric terrain, how will I know how to rotate the object to line up the 
 north orientation?


  Just try it. Make an object that points out the X Y and Z local axes 
graphically and
stick it in using the EllispoidModel to orient it to the local ground's 
upvector and such.
It will show you what the orientation ended up like, and then you can see what 
additional
rotations might be needed to get what you expect. I can't recall off the top of 
my head
which object local axis ends up pointed north.

-- 
Chris 'Xenon' Hanson, omo sanza lettere. xe...@alphapixel.com 
http://www.alphapixel.com/
  Digital Imaging. OpenGL. Scene Graphs. GIS. GPS. Training. Consulting. 
Contracting.
There is no Truth. There is only Perception. To Perceive is to Exist. - 
Xen
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] Reading osg files with images and xml files from archives on Android

2011-12-12 Thread Thomas Hogarth
Hi Again

2. I use osgDB XmlPasser quite a bit for simple meta data stuff. Is there a 
way to read an xml file from and archive?  I usually read my xml files like 
so 


So I solved one of my problems, I used the present 3d plugin as inspiration to 
write a simple plugin to wrap loading xmlinput into an osg object wrapper.

I now just have the issue that images referenced by .osg files are not loaded 
from the archive, anyone have any advice? The images are referenced relative to 
the .osg e.g. image\\diffuse.png

Loading pngs directly is working fine.

Cheers
Tom

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





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


Re: [osg-users] Reading osg files with images and xml files from archives on Android

2011-12-12 Thread Jean-Sébastien Guay

Hi Tom,


I now just have the issue that images referenced by .osg files are not loaded 
from the archive, anyone have any advice? The images are referenced relative to 
the .osg e.g. image\\diffuse.png


Have you seen Terry Welsh's thread on developing a virtual file system 
plugin so that a zip file can act as a directory? I think that would 
work for you, it would mean you don't have any manual things to do to 
make this work. I suggest you coordinate with him to test his solution 
and then suggest improvements. That way when he submits the finished 
product to be included in OSG it will fit your needs.


Other than that, I think you're probably left with implementing a 
ReadFileCallback to intercept the load requests for files referenced by 
your .osg files, and read them yourself from the zip archive.


Hope this helps,

J-S
--
__
Jean-Sebastien Guayjean-sebastien.g...@cm-labs.com
   http://www.cm-labs.com/
http://whitestar02.dyndns-web.com/
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


[osg-users] osg threading model

2011-12-12 Thread Vijeesh Theningaledathil
Hi,

  Excuse me for posting this question as I'm just a beginner in the computer 
graphics. Which threading model will give the best performance in a dual core 
computer with Nvidia Quadro graphics card. 

Also I have a doubt regarding the makeRotate for camera rotation. If I use 
pitch,roll, yaw order, camera rotation doesn't work. I have to use roll , 
pitch, yaw order only. Why this is required?


Thank you!

Cheers,
Vijeesh

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





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