[osg-users] Android + multiple views

2015-05-25 Thread Robert Gosztyla
Hi,

I'm developing simple Android app, with two separate views using osg. Got 
problem with simultaneously running these two. Whole code is based on existing 
examples in osg distribution (osgAndroidExampleGLES1 and 
osgAndroidExampleGLES2). Ii'm putting on layout two views (like ELGView class 
from above examples) and got application crash. I was trying to adopt somehow 
osgcompositeviewer example, but it isn't working even with single view. Anyone 
can direct me to working example with two separate GL views, both using OSG on 
the same layout? Hints are also highly welcome.

Thank you!

Cheers,
Robert

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





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


[osg-users] [build] osg + qt + android = linker problem

2015-04-29 Thread Robert Gosztyla
Hi,

I'm using 3.2.2-rc2, building it for Android and trying to use in Qt (5.4.1) 
application. OSG is configured with this:

cmake -DOSG_BUILD_PLATFORM_ANDROID=ON 
-DANDROID_NDK=/home/some/android/android-ndk-r10d -DDYNAMIC_OPENTHREADS=OFF 
-DDYNAMIC_OPENSCENEGRAPH=OFF -DOSG_GL1_AVAILABLE=OFF -DOSG_GL2_AVAILABLE=OFF 
-DOSG_GL3_AVAILABLE=OFF -DOSG_GLES1_AVAILABLE=OFF -DOSG_GLES2_AVAILABLE=ON 
-DOSG_GL_LIBRARY_STATIC=OFF -DOSG_GL_DISPLAYLISTS_AVAILABLE=OFF 
-DOSG_GL_MATRICES_AVAILABLE=OFF -DOSG_GL_VERTEX_FUNCS_AVAILABLE=OFF 
-DOSG_GL_VERTEX_ARRAY_FUNCS_AVAILABLE=OFF -DOSG_GL_FIXED_FUNCTION_AVAILABLE=OFF 
-DJ=8 -DCMAKE_INSTALL_PREFIX=/some/sources/OpenSceneGraph-3.2.2-rc2/build 
-DOPENGL_INCLUDE_DIR=/home/some/android/android-ndk-r10d/platforms/android-21/arch-arm/usr/include/GLES

Seems, that sets of *.a libs are build, both for armeabi and armeabi-v7a 
without any problem. Trying to link them in qt application (from *.pro file):

LIBS += 
-L/home/some/sources/OpenSceneGraph-3.2.2-rc2/build/obj/local/armeabi-v7a 
-losg -losgUtil -losgDB -losgGA -losgViewer -lOpenThreads

gives me lots of linker errors, looks like osg libraries are not taken for link:

/home/some/sources/OpenSceneGraph-3.2.2-rc2/src/osgDB/Registry.cpp:752: error: 
undefined reference to 'osgGetVersion'
/home/some/sources/OpenSceneGraph-3.2.2-rc2/src/osgDB/Registry.cpp:225: error: 
undefined reference to 'osg::KdTreeBuilder::KdTreeBuilder()'
/home/some/sources/OpenSceneGraph-3.2.2-rc2/src/osgDB/OutputStream.cpp:669: 
error: undefined reference to 'osgGetVersion'
/home/some/sources/OpenSceneGraph-3.2.2-rc2/include/osg/Object:98: error: 
undefined reference to 'typeinfo for osg::ImageStream'
and so on...

Maybe some other osg version should be used for Android? Or something wrong is 
with cmake configuration? Whole build is done on Ubuntu x64.

Thank you!

Cheers,
Robert

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





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


[osg-users] osg vs openvg

2014-08-11 Thread Robert Gosztyla
Hi,

I'm trying to integrate shivavg library (version of openvg specification) with 
my osg application. I've created new class derrived from osg::Drawable for some 
openvg primitive. But trying to create this drawable causing crash. After 
digging in sources, there is getting extensions list using 
glGetString(GL_EXTENSIONS) which seems to fail (return NULL) due to call from 
not right thread (gl context is created in viewer thread?). Whole application 
is using Qt display classes from osg.

Is it possible to solve somehow getting extensions (it is part of internal code 
of shiva) if context is created in other thread?

Or maybe there is support for openvg standard in osg (i'm not aware about any), 
so i could forget about shiva? Maybe there are some other openvg implementation 
usable with osg?

Maybe there is some other way to create gl context to be available for my 
drawables?

Thank you!

Cheers,
Robert

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





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


[osg-users] Step animation

2014-07-23 Thread Robert Gosztyla
Hi,

Me again ;). This time i would like to ask about animations, particular kind of 
it. I've made animation using channels and Vec3LinearChannel type. It works 
fine, without any problems, e.g. i've used three Vec3Keyframes to animate 
sample translation (or rotation), object position is nice calculated between 
each keyframe and animated. I wanted to create on the same way step animation 
- so object is moved in keyframe one, then moved at keyframe 2 without any 
interpolation between and then again moved in keyframe3 without interpolation - 
so it jumps in keyframes to appropriate positions. There is Vec3StepChannel - 
but have some problems with it (my object jumps one time and then stops). Is it 
right type to such kind of animation? If i have such example:

keyframe 1 - move object to (0, 0, 0)
keyframe 2 - move object to (1, 0, 0) // until here sems to work fine
keyframe 3 - want to back to (0, 0, 0) - this doesn't work (tried also (-1, 0, 
0) as translation to back to (0,0,0)

If Vec3StepChannel is not for this purpose, how can i achieve such animation?

Thank you!

Cheers,
Robert

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





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


[osg-users] Manual deleting nodes again...

2014-07-22 Thread Robert Gosztyla
Hi,

Searching forum i've found such topic 
http://forum.openscenegraph.org/viewtopic.php?t=5758, which is quite similar to 
my problem, however does not solved my issue. I'm trying to write functionality 
to remove node with all subnodes, but cannot get it to work. Assign NULL to 
shared pointer (as stated in above thread) doesn't work. Could someone clarify 
things a little bit? Is it enough to set pointer to NULL to remove object from 
scene tree? Or i need also to call removeChild method as well? I want also 
implement possibility to move part of scene tree from one node to another (e.g. 
move geode from one group to another, have widget to do that), so this is quite 
important for me - because if i need to call removeChild it would complicate 
code, maybe there is simpler way to do that?

Thank you!

Cheers,
Robert

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





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


Re: [osg-users] Manual deleting nodes again...

2014-07-22 Thread Robert Gosztyla
Hi,

Ok, i was mislead by previous thread and setting NULL to ref_ptr. So, i'm using 
removeChild, as it should be and got crash. I'm doing this in such way:


Code:

osg::ref_ptr  osg::Geode   geode = new osg::Geode; // on start
osg::Geode* g = geode.get(); // store pointer to my geode somewhere to process 
my system
myObject.storePointer(g);

//and then (another method to delete node)
osg::Geode* g = myObject.getPointer();
osg::Group* gr = g-getParent(0); // there is no multiple parents available

gr-removeChild(g);



Node 'g' seems to be removed from the scene, but then i've got a crash (after 
leaving method to delete). I've commented out removing child and there is no 
crash. And cannot find cause of that. Is it right way to do such kind of 
operation as removing node from scene?

Thank you!

Cheers,
Robert

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





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


[osg-users] [osgPlugins] Using plugins inside plugins

2014-07-21 Thread Robert Gosztyla
Hi

I have written custom plugin to save/load my scene  with custom user data. My 
solution stores scene tree, but geodes are stored as paths to separate model 
files (not geometry data). When scene is loaded, geodes are created using such 
piece of code:


Code:
osgDB::ReaderWriter* plyReader = 
osgDB::Registry::instance()-getReaderWriterForExtension(ply);
osgDB::ReaderWriter::ReadResult result;
osg::Node* node;

if(NULL != plyReader)
result = plyReader-readNode(name.toUtf8().constData());

node = result.takeNode();





Models are loaded, but what is strange, seems that normals are inverted. When i 
use the same way to load particular model directly onto scene, models looks 
fine. Particular format i'm using is *.ply supported by osg plugin. Any idea 
for such behaviour? Is it safe in general to use plugins in plugin in osg?

Thank you!

Cheers,
Robert

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





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


Re: [osg-users] [osgPlugins] Using plugins inside plugins

2014-07-21 Thread Robert Gosztyla
Hi,

Will answer by myself. This wasn't problem with plugins, just forget to set 
checking z-buffer for loaded node in my plugin, so quite obvious error :/. So, 
probably this thread could be deleted (if possible) as not very interesting 
problem.

Thank you!

Cheers,
Robert

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





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


[osg-users] [osgPlugins] osg store user values

2014-07-18 Thread Robert Gosztyla
Hi,

Is it possible to force osg plugin to store user values for nodes (set by 
setUserValue() method from osg::Node) somehow? Maybe using osgDB::Options, but 
haven't found any solution. Or only solution to store nodes with user values is 
writting separate plugin?

Thank you!

Cheers,
Robert

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





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


Re: [osg-users] [osgPlugins] osg store user values

2014-07-18 Thread Robert Gosztyla

robertosfield wrote:
 Hi Robert.
 The new serializers allow you to implement your own serializers for your own 
 osg::Object subclasses...
 


This means that i need to subclass all osg classes to have such possibility? 
What about osg::Group, osg::Transform and osg::Geode? Is it possible to just 
add new serializer to them? In fact, i'm not subclassing any osg classes now, 
so it would be good to avoid it still.

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





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


[osg-users] osgAnimation strategy

2014-07-11 Thread Robert Gosztyla
Hi,

I've created new import/export plugin for models stored in particular format. 
There are animations included, which are imported also without any problem. 
However i would like to have possibility to edit such animations in my editor 
or add new ones. In fact, my models are collected from different parts loaded 
from different files, so each file creates one osgAnimation object, then each 
node (geometry part) inside such file uses UpdateMatrixTransform and each 
transformation is created using channels. When such file is imported, animation 
is registered in BasicAnimationManager.
And here is the question regarding strategy of creating and importing such 
animations - is above approach is right one? Maybe each animated node in each 
file should create separate osgAnimation object? After loading i would like to 
have possibility to add new animation to existing one or add it to object not 
animated yet.

For example: let's say i have node (not animated) in the tree, which is 
connected to some animated parent. I would like to add separate animation to 
it, how to do that? Create UpdateMatrixTransform and channels and then put it 
into parent animation object? Or create new animation and add to manager? Or in 
fact it really doesn't matter to which animation data are added?

Thank you!

Cheers,
Robert

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





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


[osg-users] Disable GUIEventHandler

2014-07-01 Thread Robert Gosztyla
Hi,

I have in my project few pickers (for models, triangles, points) based on 
osgGA::GUIEventHandler. All of them are added to viewer... but i would like to 
have them selectable to work somehow (i mean one active in current time). All i 
found is method removeEventHandler(), but it seems to destroy my picker 
(destructor is called). They are singletons and are using also other data, so 
destroying them is not best idea. Is there any way to disable event handler for 
some time without destroying it?

Thank you!

Cheers, Robert

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





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


Re: [osg-users] How to show all objects

2010-11-04 Thread Robert Gosztyla
Hi,


 ...that you want to change the viewers master Camera to look
 at the newly expanded scene?...


I want to do this. Regarding home position probably i could use home() method, 
right? I have a case that i'm expanding my terrain with new tiles (i'm building 
it) and after adding new tile i would like to see whole terrain (of course if 
it is possible (camera ranges etc.)).

Thank you!

Cheers,
Robert

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





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


[osg-users] How to show all objects

2010-11-03 Thread Robert Gosztyla
Hi,

I have i think a simple question. If i'm adding new objects on scene and they 
are invisible (culled) or partialy invisible, how to force view or camera to 
show all objects (whole scene). Is there any simple method?

Thank you!

Cheers,
Robert

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





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


Re: [osg-users] osg::DrawElements - i missed something?

2010-10-28 Thread Robert Gosztyla
Hi,

I have no errors, just version using draw elements is not displayed. I'm using 
VC2008 Express under Vista64 on GF9800GT. Are there any limitations using draw 
elements i should know about?

Thank you!

Cheers,
Robert

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





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


Re: [osg-users] osg::DrawElements - i missed something?

2010-10-28 Thread Robert Gosztyla
Hi,

I have found one interesting behaviour yet:

osg::ref_ptr  osg::UIntArray array = new osg::UIntArray();
array-push_back( 0 );
array-push_back( 1 );
array-push_back( 2 );
array-push_back( 3 );
p_geometry-addPrimitiveSet( new osg::DrawElementsUInt( 
osg::PrimitiveSet::TRIANGLES, array-size(),  array-front() ) );

And it works. But anybody have any idea what was wrong before?
Thank you!

Cheers,
Robert

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





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


Re: [osg-users] Terrain geometry

2010-10-28 Thread Robert Gosztyla
Hi,

After deep analyze of osgTerrain code i found solution fine for me. In original 
code all geometry are generated and keeped in GeometryTechnique class , so one 
solution could be changes in geometry techniuqe object or creating own class 
deriving from terrain technique. I've made second solution and its working :). 
Using this method you could implement own terrain algorithm to generate 
geometry. I think there is no possibility to edit geometry created in standard 
geometry technique object as it is not avaiable outside (all members are 
totally private).

Thank you!

Cheers,
Robert

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





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


[osg-users] osg::DrawElements - i missed something?

2010-10-27 Thread Robert Gosztyla
Hi,

Small piece of code:


Code:
osg::ref_ptr  osg::Vec3Array  verts = new osg::Vec3Array();

verts-push_back(osg::Vec3(-100.0f, 200.0f,-100.0f ) );
verts-push_back(osg::Vec3( 100.0f, 200.0f,-100.0f ) );
verts-push_back(osg::Vec3( 100.0f, 200.0f, 100.0f ) );
verts-push_back(osg::Vec3(-100.0f, 200.0f, 100.0f ) );
verts-push_back(osg::Vec3(-100.0f, 200.0f,-100.0f ) );

osg::ref_ptr  osg::DrawElements  elements = static_cast  osg::DrawElements* 
 ( new osg::DrawElementsUInt( osg::PrimitiveSet::LINE_LOOP ) );

elements-reserveElements( 3 );
elements-addElement( 0 );
elements-addElement( 1 );
elements-addElement( 2 );

p_geometry-setVertexArray( verts.get() );

// does not work
p_geometry-addPrimitiveSet( elements.get() );

// works
p_geometry-addPrimitiveSet( new 
osg::DrawArrays(osg::PrimitiveSet::LINE_LOOP,0,verts-size() ) );

p_geode-addDrawable( p_geometry.get() );



Do you see something wrong in this code? Or I missed something?

Thank you!

Cheers,
Robert

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





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


Re: [osg-users] osg::DrawElements - i missed something?

2010-10-27 Thread Robert Gosztyla
Hi,

Hmm, the same effect, doesn't work (why should?). There is something wrong with 
elements-addElement() method?

Thank you!

Cheers,
Robert

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





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


Re: [osg-users] Terrain geometry

2010-10-21 Thread Robert Gosztyla
Hi,

I'm back again with my terrain editing question :). I was serching forum for 
some solution, but i didn't find any. If i have found at least terraintile 
geometry and drawable associated with that how i could change this geometry? 
I've tried to use dirtyDisplayList() method, but it doesn't work as expected, i 
found also in some post that for terrain rendering this method won't work. 
There is also project called osgTDS, which modifies terrain geometry during 
loading from file and there is used method replaceDrawable() for geode. Is it 
the only solution for it? Or i can do is in some other way too? I rather don't 
want to modify height file, because probably i need some additional adjustment 
than only height on my terrain. 

Thank you!

Cheers,
Robert

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





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


Re: [osg-users] Terrain + picking tiles + optimalization

2010-10-20 Thread Robert Gosztyla
Hi Robert :),

Yes, i was investigation this sample. But there is  used intersect visitor for 
camera (view-getCamera()-accept(iv);), what means for me visiting all visible 
nodes on scene. And if i have terrain with lot of trees, buildings etc. and i 
just want to edit terrain geometry? Isn't a little bit nonsense to check 
everything? Isn't faster to create visitor to visit only terrain nodes and 
inside terraintile node check intersections?

Thank you!

Cheers,
Robert

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





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


Re: [osg-users] Terrain + picking tiles + optimalization

2010-10-20 Thread Robert Gosztyla
Hi,

Thanks for advices. But i have still one question to clarify. Let's assume, 
that i have simple node visitor, which traverses my terrain nodes - something 
like terrain-accept( myvisitor ). It calls myvisitor::apply( osg::Geode geode 
) method.
Inside i want to create intersection visitor, which should check only given 
geode. In my current soultion i'm checkin intersections as:

picker = new osgUtil::LineSegmentIntersector( osgUtil::Intersector::WINDOW, x, 
y );
osgUtil::IntersectionVisitor iv( picker.get() );

and then it is passed to view-getCamera()-accept( iv );

Is it possible to change this code fragment to check only given geode as 
parameter, not all visible nodes on the scene? Is it enough to add NodeMask and 
TraversalMask to IntersectionVisitor to force checking only given geode?


Thank you!

Cheers,
Robert

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





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


[osg-users] Render to AVI

2010-10-19 Thread Robert Gosztyla
Hi,

I'm looking for some plugin (or other feature), which renders osg scene to avi 
file (i need to prepare some kind of avi demo). Is there any mechanism in osg 
to do that? Or i have to use some screen graber, render to texture  or similar 
tool?

Thank you!

Cheers,
Robert

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





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


[osg-users] Terrain + picking tiles + optimalization

2010-10-19 Thread Robert Gosztyla
Hi,

I have again basic question which is related to my previous one about terrain 
editing. I can create terrain with lot of tiles, so now i want to have 
posibility to choose particular tile by picking it. The way i tried to 
implement is something like that:

1. create osgTerrain object 
2. add TerrainTiles objects to terrain
3. create node visitor and pass terrain to it (terrain-accept)
4. in visitor apply(osg::Geode) method i'm creating 
osgUtil::LineSegmentIntersector and osgUtil::IntersectionVisitor objects
5. passing visitor to view camera. 

And as i understand my terrain visitor visits all tiles of my terrain and then 
inside terrain visitor apply method intersection visitor visits all visible 
nodes of the scene testing intersection, what sounds for me as a little 
nonsense. How to do it properly? I would like to do in such way:

1. 1. create osgTerrain object 
2. add TerrainTiles objects to terrain
3. create node visitor and pass terrain to it (terrain-accept)
4. in terrain visitor apply(osg::Geode) method i want to check if pick ray is 
intersecting my geode.

But how to get pick ray? I found something like osgUtil::PickVisitor, but i'm 
not sure how to use it. Could somebody help with that?

Thank you!

Cheers,
Robert

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





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


Re: [osg-users] Terrain geometry

2010-10-18 Thread Robert Gosztyla
Hi,


 VPB isn't really intended for editing terrain, but it generates heightfields 
 that can be dynamically altered at runtime just fine. You just have to be 
 aware that there are multiple LODs of each terrain tile.


Could you explain it with more detail? How i can alter heightfield in runtime? 
You mean altering generated geometry or bitmap and then generated geometry? Is 
this the way i could do some terrain editing feature?
Now i'm trying to modify terrain geometry, but i still got the problem with 
accessing data for it. I'm trying to use class derivied from NodeVisitor and i 
call e.g. void CTerrainVisitor::apply( osg::Geode geode ), where geode has my 
terrain geometry. But what is the reference between terrain tile and given 
geode object? Maybe there is some other, better method to use osgTerrain and 
have possibility to edit it? Or osgTerrain is not best approach to have 
editable terrain and i have to write my own wrapper for that?

Thank you!

Cheers,
Robert

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





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


[osg-users] Terrain geometry

2010-10-11 Thread Robert Gosztyla
Hi all,

I've created terrain using osgTerrain::Terrain, way simialr to that:

osgTerrain::Terrain* Terrain = new osgTerrain::Terrain;
osg::Image* high_map = osgDB::readImageFile( height.bmp );
osg::HeightField*  heightmap1 = new osg::HeightField;

heightmap1-allocate( RES_X, RES_Y );
heightmap1-setXInterval(10.0f);
heightmap1-setYInterval(10.0f);

for( int z = 0; z  RES_X; z++ )
  for( int x = 0; x  RES_Y; x++ )   
heightmap1-setHeight( x, z, (float) *high_map-data( x, z ) );

 osg::ref_ptrosgTerrain::Locator Locator1 = new osgTerrain::Locator;
 Locator1-setCoordinateSystemType( osgTerrain::Locator::PROJECTED );
 Locator1-setTransformAsExtents( 0.0, 0.0, 2560.0, 2560.0 );

osg::ref_ptrosgTerrain::HeightFieldLayer HeightFieldLayer1 = new 
osgTerrain::HeightFieldLayer( heightmap1.get() );
HeightFieldLayer1-setLocator( Locator1.get() );

osg::ref_ptrosgTerrain::TerrainTile TerrainTile1 = new 
osgTerrain::TerrainTile;
TerrainTile1-setElevationLayer( HeightFieldLayer1.get() );
Terrain-setSampleRatio( 1.0f );

osg::ref_ptrosg::StateSet m_TerrainStateSet = Terrain-getOrCreateStateSet();
Terrain-addChild( TerrainTile1.get() );

Now i want to create manipulator, which could detect collisions of line segment 
with my terrain. I found sample named pick, where collisions are detected in 
pick handler, but it is using computeIntersections() method  from Viewer class. 
I've tried to analyze computeIntersections() method but i think this is far 
ahead of my knowledge of OSG, so i would like to get some explanations or way 
how to do that. I'm trying to get terrain geometry (i don't know how :/), than 
use osgUtil::IntersectVisitor, but i cannot detect any collisions.

osg::LineSegment*  segment = new osg::LineSegment( vec, vec1 );
osgUtil::IntersectVisitorvisitor;
osgUtil::Hit  hit;
osgUtil::IntersectVisitor::HitList  hits;

visitor.addLineSegment( segment );
Terrain-accept( visitor );
hits = visitor.getHitList( segment );

Thank you!

Cheers,
Robert

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





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


Re: [osg-users] Terrain geometry

2010-10-11 Thread Robert Gosztyla
Hi,

Problem is solved now :) and i think my way was quite right (as i presented 
above). Problem was in wrong scalling of objects and manipulators. I know that 
VPB is great for terrain, but i need tool to edit terrain geometry - is it VPB 
able to provide features for that? I'm not familiar with VPB at all, so maybe 
somebody, who has any experience with that could say something about?

Thank you!

Cheers,
Robert

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





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