Re: [osg-users] Extend a Line

2012-09-05 Thread Sebastian Messerschmidt

Hello Dan,

I don't really see what your question has to do with OSG or I simply 
don't understand the question.

Here's some interpretation:
You have two coordinate frames in 3d space.
Now you want a the second frame to be aligned to the first one.
Position only is easy. Construct a vector between the two positions and 
normalize it.
Now multiply this vector with the desired distance and add it to the 
first position.


But this won't bring you _behind_ the first. For this you have to take 
the direction vector of the first plane and do the same trick as above:
Normalize it, and add it (negated) to the first position scaled by your 
desired distance. This point will give you your second position.

I guess you will have to adapt the seconds orientation as well.

A general advice though:
Before you start building a flight simulator you should really learn the 
maths in 3d in order to understand OSG and the simulation stuff.


cheers
Sebastian



Hi,

I am making a very simple flight simulator and have a plane location and a 
second chase plane location

I do not want the chase plane to get too close to the target plane.

I also do not want it to get too far away from the target plane.

How do I extend a line in 3D space?  If I can extend the points below I can 
always have the chase plane a fixed distance behind

targetPos = 3, 3, 3 * trailPos = 6, 7, 3

Thank you for help to a simple question

Dan

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





___
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] Program attribute cannot me removed

2012-09-05 Thread Robert Osfield
HI Peterakos,

Using removeAttribute(osg::StateAttribute::PROGRAM) should work.

To test whether it's working try writing the scene graph out to a .osg
or .osgt file by doing a
osgDB::writeNodeFile(*mySceneGraph,before.osgt); prior to doing the
remove then once again with after.osgt once the remove is done.  You
should in theory see the removal of the program.

If you don't then we have a bug in osg::StateSet, if you do then we
possibly have some errant behaviour elsewhere in the OSG or you scene
graph usage that is causing the state to not be affected in the way
you expect it to be.

Robert.

On 4 September 2012 21:18, Peterakos hay...@gmail.com wrote:
 Hello.

 I face a problem with a program attribute.

 I enable the program using this:
 osg::StateSet* stateset = model_node-getOrCreateStateSet();
 stateset-setAttributeAndModes( program, osg::StateAttribute::ON |
 osg::StateAttribute::OVERRIDE );

 and i disable it using:
 osg::StateSet* stateset = model_node-getOrCreateStateSet();
 stateset-removeAttribute(osg::StateAttribute::PROGRAM);


 Before the return viewer.run() , enable and disable operations work fine.
 But after that, only enable works.
 I use 2 buttons to enable and disable program in run time.

 what do i do wrong ?

 thank you.



 ___
 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] Integrating GUI toolkit with OSG 2.8.3

2012-09-05 Thread Praveena Sarathchandra
Hi,

Is it possible to include OSGQT Widgets with OSG 2.8.3? Else what are the
other alternatives?

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


Re: [osg-users] osgOcean and delta3d collision detection

2012-09-05 Thread 杨洋
Thanks for your relying! I have visited the www.delta3d.org,somebody asked
the same question and received some advice,but it didn't help. I'll try
some other methods.Anyway,many thanks!

2012/9/1 Kim Bale kcb...@googlemail.com

 Hi,

 I've not had any experience with Delta3D and osgOcean. However, I know
 that is has been used a fair bit with Delta3D since the wrapper was
 developed. Have you tried the Delta3D forum? They may be more forthcoming.

 Regards,

 Kim.

 On 1 September 2012 16:11, 杨洋 yangshi...@gmail.com wrote:

 Hi,
 Does anybody use osgOcean in delta3d program?I used osgOcean to create an
 ocean in my delta3d program,but there's a big problem--when I setting
 collision mesh to the dtCore:Object that is just a “plane” loaded from
  .osg file;
 then I drop a physics_crate (with all the appropriate sets) but it goes
 through,Has anyone seen something similar? Appreciate your help!

 ___
 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 mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] bug in Imagef::readImageFromCurrentTexture

2012-09-05 Thread Robert Osfield
Hi Alex,

On 15 February 2012 17:24, Robert Osfield robert.osfi...@gmail.com wrote:
 I guess this will be something that is rather driver dependant - and
 why I had spotted this issue with my own usage.  Could you modified
 Image.cpp to get things working for and post the full modified file to
 osg-submissions.

Alas no file came through so I've had to take an educated guess at
exactly what you found needed to be changed and have just checked in
the following change to Image::computePixelFormat(.):

+case(GL_RGBA8):
+case(GL_RGBA16):
 case(GL_RGBA32F_ARB):
 case(GL_RGBA16F_ARB):
 return GL_RGBA;

And svn update will get you this change, could you please try it out
with your application?

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


Re: [osg-users] osg(terrain) krasches on a double delete

2012-09-05 Thread Ola Nilsson

Hi Robert,

Good. This also works for me in the osgterrain-crash-program.

I've updated our patches to match this fix, and our internal tests also  
pass.


Thanks for taking the time and sharing this great software!

Ola




On Fri, 31 Aug 2012 18:03:33 +0200, Robert Osfield  
robert.osfi...@gmail.com wrote:



Hi Ola, Brad et. al,

I have just checked in a fix, similar to Ola's suggested fix, with
this fix I can't get Ola's modified osgterrain to crash and when the
code had debugging code in place it showed that it was detected the
problem TerrainTile's that were being deleted and correctly handled
these.  The code block of interest is now:

{
OpenThreads::ScopedLockOpenThreads::ReentrantMutex
lock(_mutex);
for(TerrainTileSet::iterator itr =
_updateTerrainTileSet.begin(); itr !=_updateTerrainTileSet.end();
++itr)
{
// take a reference first to make sure that the
referenceCount can be safely read without another thread decrementing
it to zero.
(*itr)-ref();

// only if referenceCount is 2 or more indicating
there is still a reference held elsewhere is it safe to add it to list
of tiles to be updated
if ((*itr)-referenceCount()1)  
tiles.push_back(*itr);


// use unref_nodelete to avoid any issues when the
*itr TerrainTile has been deleted by another thread while this for
loop has been running.
(*itr)-unref_nodelete();
}
_updateTerrainTileSet.clear();
}

Could you please try out the svn/trunk version of the OSG and let me
know how you get on,
Robert.
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org



--
Using Opera's revolutionary email client: http://www.opera.com/mail/
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] Program attribute cannot me removed

2012-09-05 Thread Peterakos
Hello.

This is what i did.
I disabled it in run time and checked the state set before and after this
line:
stateset-removeAttribute(osg::StateAttribute::PROGRAM)

Before that line the program was in attribute list along with lighting.
After that line, only lighting was there. But still the shaders seem active.

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


Re: [osg-users] QT and OSG on separate X screens

2012-09-05 Thread Roman Grigoriev
I upgraded to Qt 5.0.0beta1 and my app works only if I use singlethreaded
overwise I got 
Cannot make QOpenGLContext current in a different thread

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





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


Re: [osg-users] Error while loading OSG model on Android

2012-09-05 Thread Koduri Lakshmi
Hi,

Thank you verymuch for the quick help.

I forgot to mention in the previous post that I made video as background by 
making GL_DEPTH_BUFFER_BIT. That is I used  
_viewer-getCamera()-setClearMask(GL_DEPTH_BUFFER_BIT ).


I have a look at the code of osgAnroidExample. But I am not able to find any 
specific info about camera settings in any of the C++ files.

If I assign the transformation matrix which I got from the 3rd Party AR library 
then model is not appearing on the screen. If not assign the transformation 
matrix then the model is appeared on the screen.

AR library is giving a projection matrix. I used 
_viewer-getCamera()-setProjectionMatrix(osg::Matrix(projectionMatrix.data));.
 But even I am not able to see model on scree. 

Here I listed the full OSG code with the transformation matrix


Code:
int x=0;
int y=0;

int width=screenWidth;
int height=screenHeight;

_viewer = new osgViewer::Viewer();
_viewer-setUpViewerAsEmbeddedInWindow(x, y, width, height);
 _root = new osg::Group();

_viewer-realize();
_state = _root-getOrCreateStateSet();
_state-setMode(GL_LIGHTING, osg::StateAttribute::ON);
_state-setMode(GL_DEPTH_TEST, osg::StateAttribute::ON);
_state-setMode(GL_CULL_FACE, osg::StateAttribute::ON);

_viewer-addEventHandler(new 
osgGA::StateSetManipulator(_viewer-getCamera()-getOrCreateStateSet()));


_manipulator = new osgGA::KeySwitchMatrixManipulator;

_manipulator-addMatrixManipulator( '1', Trackball, new 
osgGA::TrackballManipulator() );
_manipulator-addMatrixManipulator( '2', Flight, new 
osgGA::FlightManipulator() );
_manipulator-addMatrixManipulator( '3', Drive, new 
osgGA::DriveManipulator() );
_manipulator-addMatrixManipulator( '4', Terrain, new 
osgGA::TerrainManipulator() );
_manipulator-addMatrixManipulator( '5', Orbit, new 
osgGA::OrbitManipulator() );
_manipulator-addMatrixManipulator( '6', FirstPerson, new 
osgGA::FirstPersonManipulator() );
_manipulator-addMatrixManipulator( '7', Spherical, new 
osgGA::SphericalManipulator() );

_viewer-setCameraManipulator( _manipulator.get() );

_viewer-getViewerStats()-collectStats(scene, true);

_viewer-getCamera()-setViewport(0,0,screenWidth, screenHeight);
_viewer-getCamera()-setClearMask(GL_DEPTH_BUFFER_BIT );

modelSwitch=new osg::Switch;
trans=new osg::MatrixTransform();

osg::ref_ptrosg::Node loadedModel = 
osgDB::readNodeFile(/mnt/sdcard/OSG/lz.osg);
if (loadedModel == 0) {
LOG(Model not loaded);
} else {
LOG(Model loaded);


loadedModel-setName(/mnt/sdcard/OSG/test.osg);

trans-addChild(loadedModel.get());
modelSwitch-addChild(trans.get());
}

_root-addChild(modelSwitch.get());

_viewer-setSceneData(NULL);
_viewer-setSceneData(_root.get());
_manipulator-getNode();
_viewer-home();


   State state = Renderer::getInstance().begin();
  // Explicitly render the Video Background
   Renderer::getInstance().drawVideoBackground();
  
  for(int tIdx = 0; tIdx  state.getNumActiveTrackables(); tIdx++)
   {
  
//_viewer-getCamera()-setProjectionMatrix(osg::Matrix(projectionMatrix.data));
 //NotGetting even I set projection matrix
 // Get the trackable:
const Trackable* trackable = state.getActiveTrackable(tIdx);
Matrix44F modelViewMatrix = 
Tool::convertPose2GLMatrix(trackable-getPose());

osg::Matrix mat;
mat.set(osg::Matrix(modelViewMatrix.data));
trans-setMatrix(mat);

osg::Vec3f tr,scal;
osg::Quat rot,so,rot1,rot2;
mat.decompose(tr,rot,scal,so);


 _viewer-frame();

  Renderer::getInstance().end();
  break;
   }


   
I logged the Transformation matrix and here I am giving two of them


Code:
0.953237  -0.0311842  0.300609  0  
0.165658  -0.778015  -0.606012  0  
0.252777  0.627472  -0.736467  0  
16.6605  14.1914  162.78  1  

Equalent OSG scale and Tranlate vectors (x,y,z values):  1  1  1 and 16.6605   
14.1914   162.78 


0.999434  0.0286711  0.0175895  0  
0.0336364  -0.853354  -0.520246  0  
9.4044e-05  0.520543  -0.853835  0  
75.0211  38.932  197.853  1  

Equalent OSG scale and Tranlate vectors (x,y,z values):  1  1  1 and 75.0211  
38.932  197.853 



3rdParty AR library gave an example to draw a teapot. Here I am giving that 
code for the reference. 


Code:


 // Set GL11 flags:
glEnableClientState(GL_VERTEX_ARRAY);
glEnableClientState(GL_NORMAL_ARRAY);
glEnableClientState(GL_TEXTURE_COORD_ARRAY);

glEnable(GL_TEXTURE_2D);
glDisable(GL_LIGHTING);

//getting tracker code and setting video code here (as above)
...



// Load projection matrix:
glMatrixMode(GL_PROJECTION);
glLoadMatrixf(projectionMatrix.data);

// Load model 

Re: [osg-users] Program attribute cannot me removed

2012-09-05 Thread Robert Osfield
Hi Peterakos,

On 5 September 2012 11:36, Peterakos hay...@gmail.com wrote:
 I disabled it in run time and checked the state set before and after this
 line:
 stateset-removeAttribute(osg::StateAttribute::PROGRAM)

 Before that line the program was in attribute list along with lighting.
 After that line, only lighting was there. But still the shaders seem active.

This suggests an issue with osg::State's lazy state up dating not
applying it's default value for osg::StateAttribute::PROGRAM.

Could you create a small OSG example that illustrates this problem so
that others can help look into it.

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


Re: [osg-users] Program attribute cannot me removed

2012-09-05 Thread Glenn Waldron
On Wed, Sep 5, 2012 at 8:38 AM, Robert Osfield robert.osfi...@gmail.comwrote:

 Hi Peterakos,

 On 5 September 2012 11:36, Peterakos hay...@gmail.com wrote:
  I disabled it in run time and checked the state set before and after this
  line:
  stateset-removeAttribute(osg::StateAttribute::PROGRAM)
 
  Before that line the program was in attribute list along with lighting.
  After that line, only lighting was there. But still the shaders seem
 active.

 This suggests an issue with osg::State's lazy state up dating not
 applying it's default value for osg::StateAttribute::PROGRAM.

 Could you create a small OSG example that illustrates this problem so
 that others can help look into it.


FWIW, I did this just a few weeks ago; I wrote a simple test program (no
longer have it) to see whether OSG was correctly applying the default
global PROGRAM attribute. It was working correctly.

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


Re: [osg-users] NodeTrackerManipulator

2012-09-05 Thread Gianni Ambrosio
Hi,
is it possible to preserve the distance of a manipulator switching from a 
TrackballManipulator to a NodeTrackerManipulator? I mean, I would just like the 
camera to be rotated so that the tracking node is centered but I would also 
like to use in the NodeTrackerManipulator the same distance of the previous 
TrackballManipulator. I realized the setByMatrix() virtual method is called 
switching from a manipulator to the other but I don't thing I can get the 
distance from the passed Matrix. Is there a way to solve the problem?

Regards,
Gianni

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





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


Re: [osg-users] [ANN] osgAndroid: Library for develop OSG applications in Android

2012-09-05 Thread Jan Ciger
Hello Rafael,

I have tried your osgAndroid library, it does indeed work for me after
fixing few details, such as incorrect project references in Eclipse.

However, I see a weird bug. I have modified the OSGOverlayCamera example to
load three .ive files - a cube, floor plane and a monkey mesh (Suzanne from
Blender). That works ok. However, as soon as I use MatrixTransforms to move
things around or to scale them, it goes wrong. E.g. setting scale factor to
0.1 makes my geometry reliably vanish (4x4 scaling matrix with 0.1 on
diagonal and 1 in the last element). Using scaling coefficient of 0.2
doesn't make it vanish, but doesn't scale it neither ?!

Then I wanted to swap the axes, because my geometry is y-up. So I have used
this matrix:

Matrix(1, 0, 0, 0,
   0, 0, 1, 0,
   0, -1, 0, 0,
   0, 0, 0, 1);

However, if I use this, add the geometry as children to this matrix and set
the matrix as scene data to the viewer, the geometry explodes (it is
stretched out into infinity) - as if division by zero was happening
somewhere or the matrix was singular (it obviously isn't).

Of course, the same geometry configuration with the same matrices is
working just fine if I add the matching C++ code to the native OSG example
from the OSG source. What is going on? Some sort of JNI type conversion
issue? I am not a JNI expert, so I have no clue there ...

For the record, I am testing this on an Acer Iconia A500 tablet, with the
Ice Cream Sandwich. It has Tegra 2 (without Neon, so using armeabi ABI)
chipset.

What is going on here?

Regards,

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


Re: [osg-users] [ANN] osgAndroid: Library for develop OSG applications in Android

2012-09-05 Thread Rafa Gaitan
Hi Jan,

I'm glad you are using it, I'm answering you below.

2012/9/5 Jan Ciger jan.ci...@gmail.com

 Hello Rafael,

 I have tried your osgAndroid library, it does indeed work for me after
 fixing few details, such as incorrect project references in Eclipse.


Nice to hear that worked for you, Could you post me the changes?, If the
changes are related to the Android.mk files, this is something you need to
change in order to build against OSG (maybe I need to add the note to the
wiki). If are related to the eclipse projects I will be happy to fix them
:).



 However, I see a weird bug. I have modified the OSGOverlayCamera example
 to load three .ive files - a cube, floor plane and a monkey mesh (Suzanne
 from Blender). That works ok. However, as soon as I use MatrixTransforms to
 move things around or to scale them, it goes wrong. E.g. setting scale
 factor to 0.1 makes my geometry reliably vanish (4x4 scaling matrix with
 0.1 on diagonal and 1 in the last element). Using scaling coefficient of
 0.2 doesn't make it vanish, but doesn't scale it neither ?!

 Then I wanted to swap the axes, because my geometry is y-up. So I have
 used this matrix:

 Matrix(1, 0, 0, 0,
0, 0, 1, 0,
0, -1, 0, 0,
0, 0, 0, 1);

 However, if I use this, add the geometry as children to this matrix and
 set the matrix as scene data to the viewer, the geometry explodes (it is
 stretched out into infinity) - as if division by zero was happening
 somewhere or the matrix was singular (it obviously isn't).

 Of course, the same geometry configuration with the same matrices is
 working just fine if I add the matching C++ code to the native OSG example
 from the OSG source. What is going on? Some sort of JNI type conversion
 issue? I am not a JNI expert, so I have no clue there ...

 For the record, I am testing this on an Acer Iconia A500 tablet, with the
 Ice Cream Sandwich. It has Tegra 2 (without Neon, so using armeabi ABI)
 chipset.

 What is going on here?


I've been using MatrixTransform for AR applications and I don't remember
that kind of issues, but JNI stuff is tricky and maybe there is a bug
there. Sometimes if you don't keep correctly the reference count of OSG
objects between Java and C++ weird things happen.

Could you post the code or a simple example so I could check it on my side?
Anyway I'm going to test it in order to replicate your problem.

I have a Samsung Galaxy S with Android 2.3.6.

Regards,
Rafa.




 Regards,

 Jan

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




-- 
Rafael Gaitán Linares
CTO at Mirage Technologies S.L - http://www.mirage-tech.com
gvSIG3D Developer - http://gvsig3d.blogspot.com
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] NodeTrackerManipulator

2012-09-05 Thread Gianni Ambrosio
Hi,
anyway from my point of view there is a bug in osgGA::NodeTrackerManipulator 
setByMatrix() or getInverseMatrix() methods. In fact I modified the 
osgviewer.exe code just to enable a NodeTrackerManipulator with '8' key and it 
seems strange that if I push '8' key twice I get two different camera 
orientation. Don't you think so?

Regards,
Gianni

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





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


Re: [osg-users] NodeTrackerManipulator

2012-09-05 Thread Robert Osfield
HI Gianni,

On 5 September 2012 14:12, Gianni Ambrosio ga...@vi-grade.com wrote:
 is it possible to preserve the distance of a manipulator switching from a 
 TrackballManipulator to a NodeTrackerManipulator? I mean, I would just like 
 the camera to be rotated so that the tracking node is centered but I would 
 also like to use in the NodeTrackerManipulator the same distance of the 
 previous TrackballManipulator. I realized the setByMatrix() virtual method is 
 called switching from a manipulator to the other but I don't thing I can get 
 the distance from the passed Matrix. Is there a way to solve the problem?

A 4x4 view matrix just doesn't provide enough controls to provide the
distance.  Probably a better approach would be to provide a better
mechanism for passing settings between camera manipulators, such as by
provide a generic interface for querying parameters from the base
class and then have the new manipulator pull the settings it requires
in the form that it needs from the previous manipulator rather than
pushing a 4x4 matrix from one to another.

I'm open to suggestion for a new API to support this.

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


Re: [osg-users] [ANN] osgAndroid: Library for develop OSG applications in Android

2012-09-05 Thread Rafa Gaitan
Hi Jan,

I had found one fatal bug, that probably was the problem. It was
the typical copy - paste problem! :S. When doing postMult or preMult, I was
using the same origin matrix to do the computation, so weird things were
happening.

Fixes and some improvements to the osgcamera example (now is landscape and
with correct aspect ratio) es checked in and pushed to the repository. I
have also added a modified the example using three MatrixTransform, I think
in the similar way you described.

I didn't spotted this before, because in AR applications we were setting
the matrix directly using .set method.

Thank you for spotting that bug!, Anyway tell me if things work for you or
maybe there is another hidden problem there.

Cheers,
Rafa.


2012/9/5 Rafa Gaitan rafa.gai...@gmail.com

 Hi Jan,

 I'm glad you are using it, I'm answering you below.

 2012/9/5 Jan Ciger jan.ci...@gmail.com

 Hello Rafael,

 I have tried your osgAndroid library, it does indeed work for me after
 fixing few details, such as incorrect project references in Eclipse.


 Nice to hear that worked for you, Could you post me the changes?, If the
 changes are related to the Android.mk files, this is something you need to
 change in order to build against OSG (maybe I need to add the note to the
 wiki). If are related to the eclipse projects I will be happy to fix them
 :).



 However, I see a weird bug. I have modified the OSGOverlayCamera example
 to load three .ive files - a cube, floor plane and a monkey mesh (Suzanne
 from Blender). That works ok. However, as soon as I use MatrixTransforms to
 move things around or to scale them, it goes wrong. E.g. setting scale
 factor to 0.1 makes my geometry reliably vanish (4x4 scaling matrix with
 0.1 on diagonal and 1 in the last element). Using scaling coefficient of
 0.2 doesn't make it vanish, but doesn't scale it neither ?!

 Then I wanted to swap the axes, because my geometry is y-up. So I have
 used this matrix:

 Matrix(1, 0, 0, 0,
0, 0, 1, 0,
0, -1, 0, 0,
0, 0, 0, 1);

 However, if I use this, add the geometry as children to this matrix and
 set the matrix as scene data to the viewer, the geometry explodes (it is
 stretched out into infinity) - as if division by zero was happening
 somewhere or the matrix was singular (it obviously isn't).

 Of course, the same geometry configuration with the same matrices is
 working just fine if I add the matching C++ code to the native OSG example
 from the OSG source. What is going on? Some sort of JNI type conversion
 issue? I am not a JNI expert, so I have no clue there ...

 For the record, I am testing this on an Acer Iconia A500 tablet, with the
 Ice Cream Sandwich. It has Tegra 2 (without Neon, so using armeabi ABI)
 chipset.

 What is going on here?


 I've been using MatrixTransform for AR applications and I don't remember
 that kind of issues, but JNI stuff is tricky and maybe there is a bug
 there. Sometimes if you don't keep correctly the reference count of OSG
 objects between Java and C++ weird things happen.

 Could you post the code or a simple example so I could check it on my
 side? Anyway I'm going to test it in order to replicate your problem.

 I have a Samsung Galaxy S with Android 2.3.6.

 Regards,
 Rafa.




 Regards,

 Jan


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




 --
 Rafael Gaitán Linares
 CTO at Mirage Technologies S.L - http://www.mirage-tech.com
 gvSIG3D Developer - http://gvsig3d.blogspot.com




-- 
Rafael Gaitán Linares
CTO at Mirage Technologies S.L - http://www.mirage-tech.com
gvSIG3D Developer - http://gvsig3d.blogspot.com
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] [ANN] osgAndroid: Library for develop OSG applications in Android

2012-09-05 Thread Jan Ciger

On 09/05/2012 05:15 PM, Rafa Gaitan wrote:

Hi Jan,

I'm glad you are using it, I'm answering you below.

2012/9/5 Jan Ciger jan.ci...@gmail.com mailto:jan.ci...@gmail.com

Hello Rafael,

I have tried your osgAndroid library, it does indeed work for me
after fixing few details, such as incorrect project references in
Eclipse.


Nice to hear that worked for you, Could you post me the changes?, If the
changes are related to the Android.mk files, this is something you need
to change in order to build against OSG (maybe I need to add the note to
the wiki). If are related to the eclipse projects I will be happy to fix
them :).


I think that the name of the project referenced by example is wrong - it 
doesn't install the JNI libs with the Camera example unless you set the 
projects are referenced from the example.


I will check what other changes I had to make, but it wasn't much or it 
was specific to my setup.





I've been using MatrixTransform for AR applications and I don't remember
that kind of issues, but JNI stuff is tricky and maybe there is a bug
there. Sometimes if you don't keep correctly the reference count of OSG
objects between Java and C++ weird things happen.

Could you post the code or a simple example so I could check it on my
side? Anyway I'm going to test it in order to replicate your problem.


Sure, I can do that. The code is a simple mod of your example. I will 
send you a follow-up e-mail with the code and the other changes tomorrow 
when I am back at the office.


Regards,

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


Re: [osg-users] [ANN] osgAndroid: Library for develop OSG applications in Android

2012-09-05 Thread Jan Ciger

On 09/05/2012 06:41 PM, Rafa Gaitan wrote:

Hi Jan,

I had found one fatal bug, that probably was the problem. It was
the typical copy - paste problem! :S. When doing postMult or preMult, I
was using the same origin matrix to do the computation, so weird things
were happening.

Fixes and some improvements to the osgcamera example (now is landscape
and with correct aspect ratio) es checked in and pushed to the
repository. I have also added a modified the example using three
MatrixTransform, I think in the similar way you described.

I didn't spotted this before, because in AR applications we were setting
the matrix directly using .set method.

Thank you for spotting that bug!, Anyway tell me if things work for you
or maybe there is another hidden problem there.


Ah, that is indeed an oops :-p

I will check tomorrow when I am back at the office. Hopefully that will 
fix it. However I am setting the matrices using setMatrix() too, so 
perhaps there is yet another issue in there.


BTW, re camera - it was crashing on my tablet, because the camera cannot 
support the preview resolution you were asking for (the full screen 
resolution). A better way to do it is to ask for the preferred 
resolution and then rescale that to fit the screen. I think that was one 
of the things I had to fix otherwise the camera example was crashing on 
start.


Regards,

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


Re: [osg-users] Custom Drawable GLSL

2012-09-05 Thread Jeremy Moles
On Tue, 2012-09-04 at 19:21 +0100, Robert Osfield wrote:
 Hi Jeremy,
 
 It should be possible to do a
 
 drawImplementation(..)
 {
 
   state.apply(stateSetOne);
   // do stuff
   state.apply(stateSetTwo);
  // do more stuff
 
 }

I've settled on:

drawImplementation() {
state.pushStateSet(ss1);
state.apply();
// do stuff
state.popStateSet();
state.apply()

state.pushStateSet(ss1);
state.apply();
// do more stuff
state.popStateSet();
state.apply()
}

Does this seem like an abomination? :) Just calling state.apply() ALMOST
worked, but there was some state leakage (for example, the shader was
applied to all subsequent fragment processing, regardless of it's
location in the graph).

 I'm not 100% sure what will happen with the progress of draw traversal
 w.r.t how the drawable StateSet if any is applied and then later
 assumed to be applied by other state calls.  I think it will probably
 work out OK though so try it, and if something breaks then considering
 adding an extra state.apply(drawwablesStateSet) or a perhaps a state
 dirty.
 
 This is something we can workout if required though, try the simplest
 thing first then if need be investigate more complicated routes...
 
 Robert.
 ___
 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] [ANN] osgAndroid: Library for develop OSG applications in Android

2012-09-05 Thread Rafa Gaitan
Hi Jan,

2012/9/5 Jan Ciger jan.ci...@gmail.com

 On 09/05/2012 06:41 PM, Rafa Gaitan wrote:

 Hi Jan,

 I had found one fatal bug, that probably was the problem. It was
 the typical copy - paste problem! :S. When doing postMult or preMult, I
 was using the same origin matrix to do the computation, so weird things
 were happening.

 Fixes and some improvements to the osgcamera example (now is landscape
 and with correct aspect ratio) es checked in and pushed to the
 repository. I have also added a modified the example using three
 MatrixTransform, I think in the similar way you described.

 I didn't spotted this before, because in AR applications we were setting
 the matrix directly using .set method.

 Thank you for spotting that bug!, Anyway tell me if things work for you
 or maybe there is another hidden problem there.


 Ah, that is indeed an oops :-p

 I will check tomorrow when I am back at the office. Hopefully that will
 fix it. However I am setting the matrices using setMatrix() too, so perhaps
 there is yet another issue in there.


Thank you, If it gives you any problem then send me the modified example
and I will try to reproduce it.



 BTW, re camera - it was crashing on my tablet, because the camera cannot
 support the preview resolution you were asking for (the full screen
 resolution). A better way to do it is to ask for the preferred resolution
 and then rescale that to fit the screen. I think that was one of the things
 I had to fix otherwise the camera example was crashing on start.


I've also checked in changes regarding the camera resolution I hope these
changes will also fix the problems on your side.


Thank you for testing!
Rafa.



 Regards,

 Jan
 __**_
 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




-- 
Rafael Gaitán Linares
CTO at Mirage Technologies S.L - http://www.mirage-tech.com
gvSIG3D Developer - http://gvsig3d.blogspot.com
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


[osg-users] [vpb] Quesions about LOD in VPB

2012-09-05 Thread David Glenn
Greetings All!

I'm just getting the time to do some real study on VPB and I had some questions 
about LOD and controlling it!

First of all, I'm going to reverence a tool that I know “Terra Vista” for an 
example. If you don't know about this tool, I understand and try to explain in 
more detail.

One of the tricks you can do in Terra Vista is that you can limit the amount of 
LOD's you can use in a given area over others. This allows you to build terrain 
that has higher level of detail in some areas (where it matters ) and allows 
other areas to max out at a lower level of detail. This in the end would make 
the terrain take up less space than of all of the terrain was at a high level 
of detail. 

I managed to get a group of satellite data at 1 meter resolution and it works 
fine, but it's taking up over 50 gigs of Hard disk space. I like to cut it back 
a bit so I can at lease maybe get it on a double layer DVD, if not , a blue ray 
disk.  I figure that if I can cut back on the resolution in areas that I don’t 
need to be at 1 meter resolution, I can cut the size in whole of the terrain to 
something more manageable. 

Dglenn


David Glenn
---
D Glenn 3D Computer Graphics amp; Media Systems.
www.dglenn.com

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





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