Re: [osg-users] zbuffer issue

2009-06-15 Thread Christian Sam
Hi, thanks for all the reply

like colin noted, the render problem vanished as i stripped off the offsets 
which caused the large coordinates and work now with localized coordinates.

if i ever need to display the real coordinates in an text-insert, i can re-add 
the stripped offset before display them.

Thank you!

Cheers,
Christian

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





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


Re: [osg-users] zbuffer issue

2009-06-14 Thread Christian Sam
i forgot three things to mention:

1.) 
as i mentioned above, i place adjacent trees  into one geometry. 
e.g. a geometries' vertex-array has numberOfAdjacentTrees*8 (=double quads ) 
entries. but i use only one primitiveSet to construct the geometry. i hope this 
is okay.

geometry-addPrimitiveSet(new osg::DrawArrays(osg::PrimitiveSet::QUADS, 0, 
vertices-size()));

2.)
the geometries aren't generated from back to front.

3.)
the problem also occurs when i don't use blending, alphafunc or even textures.

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





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


Re: [osg-users] zbuffer issue

2009-06-14 Thread Christian Sam
Sorry, for another posting:

i just tested the original one drawable per tree implementation with such 
large coordinates again and noticed that it also tends to flicker, as well 
hidden faces were revealed also. i couldn't encounter the outer mentioned 
problems.

thanks in advance,
christian

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





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


Re: [osg-users] get the x-axis angle of a rotation

2009-06-04 Thread Christian Sam
Hi james,

regarding your last post, did you mean that you also tried to extract angles 
from a rotation with the website's matrixToEuler or a similar approach, but 
you encountered  problems that were depended on your current 
camera-orientation? 

i think the same happened to me: i wanted to get the pitch-angle of the 
camera-orientation, to adjust the camera looking straight forward in certain 
cases. (think of some: reset view, but only for the pitch angle). i encountered 
that multiplying with the inverse rotation matrix of that angle didn't work if 
a left or right camera-rotation has been done before.
(actualy these negative-effects were only obvious when left/right rotation was 
larger than 45°. so i don't know if also minor yaw-rotations did harm, or only 
rotations exceeding a 45° threshold)

in the end, it put out that i had to build the adjustment-rotation matrix not 
with the pitch but the roll angle of the current camera-rotation in cases of 
previous left/right camera-rotations from 45° to 135° (respectively -45° to 
-135°) 

3.)
i'm not sure what you are meaning with ..it was not a success.. 
does the attachment you included work, and won't it suffers from symptoms, like 
described above?


Thanks in advance,
Christian

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





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


Re: [osg-users] get the x-axis angle of a rotation

2009-06-04 Thread Christian Sam
Hi james,

thanks for the quick reply, now everything is clear. 

Best regards,
Christian

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





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


[osg-users] get the x-axis angle of a rotation

2009-06-03 Thread Christian Sam
Hi,

i have a manipulator which stores the rotation in a quaternion. i would like to 
extract the angle of the, in matrix-words, x-axis of that rotation.
(think of a firstperson-view - i would like to extract the angle which defines 
how much i look up/down)

is there an easy way to get this done?


Thanks in advance,
Christian

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





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


Re: [osg-users] get the x-axis angle of a rotation

2009-06-03 Thread Christian Sam
Hi max, thanks for the hint

i needed some time to inform myself about quaternions, because like you, i 
tried to avoid using them. 

you mentioned Your X-rotation is pure in the quaternion., nevertheless i 
don't know how to get only the Pitch-rotation (to say it in euler words) out of 
them.

e.g: if the camera first rotates 30° to the right and then 15° down, how can i 
get the information of -15° out of the quaterion?



best regards,
Christian

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





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


Re: [osg-users] get the x-axis angle of a rotation

2009-06-03 Thread Christian Sam
Hi,

i had to do a little further research on the web because first i didn't 
understand what your code-snippet is doing. i found a website which describes 
the whole topic: 
http://www.euclideanspace.com/maths/geometry/rotations/conversions/matrixToEuler/index.htm;
 

thank you james and max for posting the clues/code.
Christian

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





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


Re: [osg-users] Q for getCoordinateFrame in special and matrixManipulator in general

2009-06-02 Thread Christian Sam
Hi robert,

thanks for replying. after some thoughts about it, i will ask the second 
question another way.

how can i get a coordinateframe from only providing a position?

Code:

CoordinateFrame eyePointCoordFrame = getCoordinateFrame( eye )



- respectively 

holds a coordinateFrame in case of providing (eye) only translation information 
and the rotation-information would be left unchanged (001, 010, 001)?


Thank you!

best regards,
Christian

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





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


Re: [osg-users] FirstPersonManipulator

2009-06-02 Thread Christian Sam
Hi simon,

i got it working, i added the osgGA namespace to the parameters of the function 
below. i had to remove the outer enclosing namespace declaration, because the 
compiler complained:
virtual void init(const GUIEventAdapter ,GUIActionAdapter); - virtual void 
init(const osgGA::GUIEventAdapter ,osgGA::GUIActionAdapter);


i only tested it for a short time but the manipulator worked very smooth. there 
were only two problems i encouterd:

in case of my terrain, the starting position is high above ground - i have to 
switch to free-mode, because when remaining in default-mode: grounded the 
camera position always resets back to initial start position after some time of 
falling down to ground. (console output, LOST IN SPACE), but never arriving it. 
i think i can fix this when providing individual setHomePosition values.

the other issue is, that i sometimes fall through the terrain (tested in 
free-mode, can't try the other one, because when i'm finally onground and 
switch to grounded-mode, i restart high above the ground, with the problems 
described above). i' dont have much experience with manipulators, collisions 
detection, etc.,  but the cause for this could be that my osgdem generated 
terrain has different LODs regarding polygon resolution. maybe on the 
translations, the collision detection has problems with possible cracks in 
polygons? 

anyway this is a very good manipulator, keep up on it!

Thank you!

Cheers,
Christian

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





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


Re: [osg-users] Q for getCoordinateFrame in special and matrixManipulator in general

2009-06-02 Thread Christian Sam
Hi,

okay, after some examples debugging i think i got it:
a CoordinateSystem is a user added node, which provides methods that allow to 
setup a matrix with lat/lon instead of cartesian coordinates.

on flat environments, there is no need to setup a CoordinateSystem. when 
getCoordinateFrame(pos) is called in such a case, a matrix with rotation of a 
default coordinatesystem (001, 010, 001) and translation of pos is returned.


if that is somehow correct, i have another question:
is it right that, in case of an ellipsoid CoordinateSystem (like in the example 
osgsimulation.exe) the rotation-part of the resulting-matrix is depended of 
the current position?


Thank you!

Cheers,
Christian

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





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


[osg-users] Q for getCoordinateFrame in special and matrixManipulator in general

2009-06-01 Thread Christian Sam
Hi community, i'm currently trying to understand how the various 
camera-manipulators work (trackball, terrain, ufo, etc.) and several questions 
arrived:

- the first thing that confused me was, that Y/Z-vector directions are now the 
openGL-way. (is there a reason why OSG normally uses Y as forward-vector?)

- i also often encounterd the functions getCoordinateFrame(Vec3) and 
getUpVector(cf), e.g:

Code:

CoordinateFrame eyePointCoordFrame = getCoordinateFrame( eye )
if (intersect(eye+getUpVector(eyePointCoordFrame)*distance,...



i have not much practice with matrix transformations, so its a little bit hard 
for me to understand the sense of this, but i assume the following: eye is the 
position of the camera, and the camera has it's own local coordinate-system. 
getCoordinateFrame() / getXVector() provide the world coordinates from such 
local coordinate frame. 

i looked up the implentation of getCoordinateFrame(), but i couldn't find out 
how it is accomplished, can you explain me how this is done?



Thanks in advance, 
Christian

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





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


Re: [osg-users] FirstPersonManipulator

2009-05-29 Thread Christian Sam
Hi,

i included the following lines in my applicationcode:
#include ../include/FirstPersonManipulator.h
viewer.setCameraManipulator(new osgGA::FirstPersonManipulator);

and got:
1   Creating library D:\workspace\test-osg\sln\graz\Debug\graz.lib and object 
D:\workspace\test-osg\sln\graz\Debug\graz.exp
1graz5.obj : warning LNK4217: locally defined symbol 
??0firstpersonmanipula...@osgga@@q...@_n@Z (public: __thiscall 
osgGA::FirstPersonManipulator::FirstPersonManipulator(bool)) imported in 
function _main
1graz5.obj : warning LNK4217: locally defined symbol 
?classn...@firstpersonmanipulator@osgGA@@UBEPBDXZ (public: virtual char const * 
__thiscall osgGA::FirstPersonManipulator::className(void)const ) imported in 
function [thunk]:public: virtual char const * __thiscall 
osgGA::FirstPersonManipulator::className`vtordisp{4294967292,0}' (void)const  
(?classn...@firstpersonmanipulator@osgGA@@$4p...@a@BEPBDXZ)
1graz5.obj : error LNK2019: unresolved external symbol __declspec(dllimport) 
protected: void __thiscall osgGA::FirstPersonManipulator::`vbase 
destructor'(void) (__imp_??_dfirstpersonmanipula...@osgga@@IAEXXZ) referenced 
in function protected: virtual void * __thiscall 
osgGA::FirstPersonManipulator::`scalar deleting destructor'(unsigned int) 
(??_gfirstpersonmanipula...@osgga@@maep...@z)
1FirstPersonManipulator.obj : error LNK2019: unresolved external symbol 
__declspec(dllimport) const osgGA::FirstPersonManipulator::`vftable'{for 
`osg::Object'} (__imp_??_7firstpersonmanipula...@osgga@@6bobj...@osg@@@) 
referenced in function public: __thiscall 
osgGA::FirstPersonManipulator::FirstPersonManipulator(bool) 
(??0firstpersonmanipula...@osgga@@q...@_n@Z)
1FirstPersonManipulator.obj : error LNK2019: unresolved external symbol 
__declspec(dllimport) const osgGA::FirstPersonManipulator::`vftable'{for 
`osg::Drawable::EventCallback'} 
(__imp_??_7firstpersonmanipula...@osgga@@6beventcallb...@drawable@osg@@@) 
referenced in function public: __thiscall 
osgGA::FirstPersonManipulator::FirstPersonManipulator(bool) 
(??0firstpersonmanipula...@osgga@@q...@_n@Z)
1FirstPersonManipulator.obj : error LNK2019: unresolved external symbol 
__declspec(dllimport) const osgGA::FirstPersonManipulator::`vftable'{for 
`osg::NodeCallback'} 
(__imp_??_7firstpersonmanipula...@osgga@@6bnodecallb...@osg@@@) referenced in 
function public: __thiscall 
osgGA::FirstPersonManipulator::FirstPersonManipulator(bool) 
(??0firstpersonmanipula...@osgga@@q...@_n@Z)
1FirstPersonManipulator.obj : error LNK2019: unresolved external symbol 
__declspec(dllimport) const osgGA::FirstPersonManipulator::`vbtable'{for 
`osg::Drawable::EventCallback'} 
(__imp_??_8firstpersonmanipula...@osgga@@7beventcallb...@drawable@osg@@@) 
referenced in function public: __thiscall 
osgGA::FirstPersonManipulator::FirstPersonManipulator(bool) 
(??0firstpersonmanipula...@osgga@@q...@_n@Z)
1FirstPersonManipulator.obj : error LNK2019: unresolved external symbol 
__declspec(dllimport) const osgGA::FirstPersonManipulator::`vbtable'{for 
`osg::NodeCallback'} 
(__imp_??_8firstpersonmanipula...@osgga@@7bnodecallb...@osg@@@) referenced in 
function public: __thiscall 
osgGA::FirstPersonManipulator::FirstPersonManipulator(bool) 
(??0firstpersonmanipula...@osgga@@q...@_n@Z)
1D:\workspace\test-osg\sln\graz\Debug\graz.exe : fatal error LNK1120: 6 
unresolved externals


is it possible to try this manipulator without building a new osgViewer?


Thank you!

Cheers,
Christian

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





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


[osg-users] ordered assignment of textures recommended?

2009-05-20 Thread Christian Sam
Hi community,

i have a bunch of categorized roof-types. out of a handful of different 
textures (small dimensioned), i want to assign - depending on the rooftype, a 
texture per roof. the roofs are not ordered per rooftype, and i hardly expect a 
roof to have the same texture assigned like the previous one - so frequent 
(texture) statechanges will certainly arise when creating the geometry.

what can i expect in creating such a scenegraph?

(A): osg should have no problems to store a handful of small-sized textures as 
texture objects. so frequent (texture)state-changes are no problem while 
assignment.

 or

(B): this situtation will result in a problem.


If situation (B) - what would be appropriate counter-methods? (i guess one 
would be a to do a manual sorting of the roofs per rooftype, before creating 
the scenegraph. but would the following also work? 

- use a different renderbin for every rooftype(/texture)?

- let the optimizer run over the created scenegraph?


thanks in advance,
christian

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





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


Re: [osg-users] ordered assignment of textures recommended?

2009-05-20 Thread Christian Sam
hi paul, thanks for the reply


Paul Martz wrote:
 
 OSG already sorts by state at runtime...
 


this is i wanted to know. (i wasn't sure if the optimizer is responsible for 
things like that)


best regards,
christian

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





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


[osg-users] set new vertexarray. automatic deallocation of the old one?

2009-05-16 Thread Christian Sam
Hi community, 

i have three questions:

- if i want to replace a geometry's vertexarray, which was defined through an 
imported .osg nodefile, does it suffice to just call setVertexArray(newArray)?

- will the previous array be automatically deallocated?

-  does this also apply in a case when the vertexarray was defined without any 
imported nodefile, e.g. programmatically?

Thank you!

Best regards,
Christian

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





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


Re: [osg-users] light, normals

2009-05-15 Thread Christian Sam
Hi,

i wanna thank the two posters for clarifying which different approaches are 
possible for this issue, because problems like that weren't covered in the 
basic opengl books i have read.


Cheers,
Christian

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





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


[osg-users] light, normals

2009-05-14 Thread Christian Sam
Hi,

i need a little help with some lighting issues. the geometry, a roof, consists 
of a drawable with one primitive (DrawElement TRIANGLES) and associated normal 
vectors per vertex. the problem is, the resulting shading of the rendering is 
not what i have expected. 

[Image: http://www.spatiality.at/osg/roof_solid.png ]
[Image: http://www.spatiality.at/osg/roof_wire.png ]

face1 is like wanted, but face2 and face3 seem odd for me. 

is this caused by a to crude mesh?

Thank you very much!
Christian

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



#include osgGA/StateSetManipulator
#include osg/StateSet

#include osg/Node
#include osg/Group
#include osg/Geode
#include osg/Geometry
#include osgViewer/Viewer
#include osgGA/TrackballManipulator
#include osg/ShadeModel 

int main()
{
   osg::Group* root = new osg::Group();
   osg::Geode* polygonGeode = new osg::Geode;
   osg::Geometry* polygonGeometry = new osg::Geometry;
   polygonGeode-addDrawable(polygonGeometry);
   root-addChild(polygonGeode);

   osg::Vec3Array* polygonVertices = new osg::Vec3Array;
   polygonVertices-push_back( osg::Vec3(400, 400, 0) );
   polygonVertices-push_back( osg::Vec3(300, 400, 0) );
   polygonVertices-push_back( osg::Vec3(300, 300, 0) );
   polygonVertices-push_back( osg::Vec3(500, 300, 0) );
   polygonVertices-push_back( osg::Vec3(500, 500, 0) );
   polygonVertices-push_back( osg::Vec3(400, 500, 0) );
   polygonVertices-push_back( osg::Vec3(300, 350, 50) );
   polygonVertices-push_back( osg::Vec3(450, 350, 50) );
   polygonVertices-push_back( osg::Vec3(450, 500, 50) );
   polygonGeometry-setVertexArray(polygonVertices);

   osg::DrawElementsUInt* polygonBase = new osg::DrawElementsUInt(osg::PrimitiveSet::TRIANGLES, 0);
   polygonBase-push_back(1);
   polygonBase-push_back(2);
   polygonBase-push_back(6);
   polygonBase-push_back(2);
   polygonBase-push_back(3);
   polygonBase-push_back(6);
   polygonBase-push_back(6);
   polygonBase-push_back(3);
   polygonBase-push_back(7);
   polygonBase-push_back(3);
   polygonBase-push_back(4);
   polygonBase-push_back(7);
   polygonBase-push_back(7);
   polygonBase-push_back(4);
   polygonBase-push_back(8);
   polygonBase-push_back(4);
   polygonBase-push_back(5);
   polygonBase-push_back(8);
   polygonBase-push_back(5);
   polygonBase-push_back(7);
   polygonBase-push_back(8);
   polygonBase-push_back(5);
   polygonBase-push_back(0);
   polygonBase-push_back(7);
   polygonBase-push_back(7);
   polygonBase-push_back(0);
   polygonBase-push_back(6);
   polygonBase-push_back(0);
   polygonBase-push_back(1);
   polygonBase-push_back(6);
   polygonGeometry-addPrimitiveSet(polygonBase);

	//osg::StateSet* stateSet = root-getOrCreateStateSet();
	//osg::ShadeModel* shadeModel = new osg::ShadeModel;
	//shadeModel-setMode(osg::ShadeModel::FLAT);
	//stateSet-setAttribute(shadeModel);

//	osg::Vec3 lightPosition(-1.0, -1.0, 2.0);
//	osg::ref_ptrosg::LightSource lightSource = new osg::LightSource;
//	lightSource-setDataVariance(osg::Object::DYNAMIC);
//	lightSource-getLight()-setPosition(osg::Vec4(lightPosition, 0));
	lightSource-getLight()-setAmbient(osg::Vec4(0.2, 0.2, 0.2, 1.0));
//	lightSource-getLight()-setDiffuse(osg::Vec4(0.4, 0.4, 0.4, 1.0));
	root-addChild(lightSource);

   osg::Vec3Array* normals = new osg::Vec3Array;
   polygonGeometry-setNormalArray(normals);
   polygonGeometry-setNormalBinding(osg::Geometry::BIND_PER_VERTEX);
   { osg::Vec3 norm(-1, 0, 0); norm.normalize(); normals-push_back(norm); }
   { osg::Vec3 norm(-1, 0, 0); norm.normalize(); normals-push_back(norm); }
   { osg::Vec3 norm(-1, 0, 0); norm.normalize(); normals-push_back(norm); }
   { osg::Vec3 norm(0, -1, 1); norm.normalize(); normals-push_back(norm); }
   { osg::Vec3 norm(0, -1, 1); norm.normalize(); normals-push_back(norm); }
   { osg::Vec3 norm(0, -1, 1); norm.normalize(); normals-push_back(norm); }
   { osg::Vec3 norm(0, -1, 1); norm.normalize(); normals-push_back(norm); }
   { osg::Vec3 norm(0, -1, 1); norm.normalize(); normals-push_back(norm); }
   { osg::Vec3 norm(0, -1, 1); norm.normalize(); normals-push_back(norm); }
   { osg::Vec3 norm(1, 0, 1); norm.normalize(); normals-push_back(norm); }
   { osg::Vec3 norm(1, 0, 1); norm.normalize(); normals-push_back(norm); }
   { osg::Vec3 norm(1, 0, 1); norm.normalize(); normals-push_back(norm); }
   { osg::Vec3 norm(1, 0, 1); norm.normalize(); normals-push_back(norm); }
   { osg::Vec3 norm(1, 0, 1); norm.normalize(); normals-push_back(norm); }
   { osg::Vec3 norm(1, 0, 1); norm.normalize(); normals-push_back(norm); }
   { osg::Vec3 norm(0, 1, 0); norm.normalize(); normals-push_back(norm); }
   { osg::Vec3 norm(0, 1, 0); norm.normalize(); normals-push_back(norm); }
   { osg::Vec3 norm(0, 1, 0); norm.normalize(); normals-push_back(norm); }
   { osg::Vec3 norm(-1, 0, 1); norm.normalize(); normals-push_back(norm); }
   { osg::Vec3 norm(-1, 0, 1); norm.normalize(); normals-push_back(norm); }
   { 

Re: [osg-users] light, normals

2009-05-14 Thread Christian Sam
Hi,

okay, i think i figured out that the odd shading is only a result of my 
missunderstanding of the normals BIND_PER_VERTEX concept.

my geometry has 9 vertices - i thought if i use a drawElement index with index 
swaps to revist a vertex, this would give me the opportunity to use more than 
one normal per vertex (there are reasons why i need this ;-). i now think the 
truth is, only real vertices in the vertexlist let me allow to do this.

if them is so, this thread is solved.


Thank you!

Cheers,
Christian

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





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


[osg-users] fast path with these settings?

2009-05-13 Thread Christian Sam
Hi,

according to documentation: Fast paths use vertex arrays, and 
glDrawArrays/glDrawElements.

- what is the difference between vertex arrays and glDrawArrays, or is it meant 
as generic term for glDrawArrays/glDrawElements?


will the use of something like this drop me into slow path mode?


Code:

osg::TemplateIndexArray |unsigned int, osg::Array::UIntArrayType,4,4| 
*colorIndexArray;
colorIndexArray = new osg::TemplateIndexArray |unsigned int, 
osg::Array::UIntArrayType,4,4|;
colorIndexArray-push_back(0); // vertex 0 assigned color array element 0
...




if not, i'm looking for a way to assign normals to vertices per indexed array, 
like the colorindexarray above. does this work in the same way?


Code:

osg::TemplateIndexArray |unsigned int, osg::Array::UIntArrayType,3,4| 
*normalsIndexArray;
normalsIndexArray = new osg::TemplateIndexArray|unsigned int, 
osg::Array::UIntArrayType,3,4|;
normalsIndexArray-push_back(0); // vertex 0 assigned normals array element 0
...





Thank you!

Cheers,
Christian

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





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


Re: [osg-users] fast path with these settings?

2009-05-13 Thread Christian Sam
hi bryan, thank you for your reply.


 
 
  
  according to documentation: Fast paths use vertex arrays, and
  glDrawArrays/glDrawElements. 
  
 
 Which documentation?
 


- sorry, i meant according to (doxygen) reference 
(http://www.openscenegraph.org/documentation/OpenSceneGraphReferenceDocs/a00267.html#fe139bb2f71cbafc1a8fc9e707ca5397)


 
 
  - what is the difference between vertex arrays and glDrawArrays, or is
  it meant as generic term for glDrawArrays/glDrawElements? 
  
 
 Usually vertex arrays means using glVertexPointer() instead of a
 series of glVertexf().
 


- solved


 
 
  
  will the use of something like this drop me into slow path mode?
  
  Code:
  
  osg::TemplateIndexArray |unsigned int, osg::Array::UIntArrayType,4,4|
  *colorIndexArray; 
  colorIndexArray = new osg::TemplateIndexArray |unsigned int,
  osg::Array::UIntArrayType,4,4|; 
  colorIndexArray-push_back(0);
  
 
 Using index arrays will drop you into slow path mode, as will binding
 any of your data arrays PER_PRIMITIVE. See
 osg::Geometry::drawImplementation() for the exact conditions.
 


- as far as i have understood osg::Geometry::drawImplementation():  
regardless of what a indexed array is indexing (vertex, color, normals, etc.) 
it will drop me into slow path mode.
but does type glDrawElements also falls under this rule - they are indexed too? 
but according to reference: Fast paths use vertex arrays, and 
DrawArrays/glDrawElements. 

- whats the difference between BIND_PER_PRIMITIVE_SET and
BIND_PER_PRIMITIVE? in the tutorials these types are never used, but i assume 
if i have a geometry consisting of 4 quads, i could define a colorarray with 4 
entries and bind them with BIND_PER_PRIMITIVE_SET, so the vertices of quad_1 
get color_1, quad_2's vertices color_2, and so on, meaning every quad gets its 
own color. 


 
 
  
  if not, i'm looking for a way to assign normals to vertices per
  indexed array, like the colorindexarray above. does this work in the same 
  way?
  
  Code:
  
  osg::TemplateIndexArray |unsigned int, osg::Array::UIntArrayType,3,4|
  *normalsIndexArray; 
  normalsIndexArray = new osg::TemplateIndexArray|unsigned int,
  osg::Array::UIntArrayType,3,4|; 
  normalsIndexArray-push_back(0);
  
 
 It's most likely faster (because you'll be avoiding the slow path) to
 copy your vertices and normals so you can bind the normals PER_VERTEX,
 even though you'll get duplicates in the array. There was a thread on
 the mailing list about how to do this recently; I suggest you search the
 archives for it.
 


- solved

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





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


Re: [osg-users] constructing geometry using position, normal and uv coord arrays

2009-05-11 Thread Christian Sam
Hi,

thank you for the reply. to give you some more information of my situation: i 
want to visualize certain roof types. i generate the geometry information 
(vertices, tex-coords, normals) programmatically in my application. i'm using 
triangle_strips with drawElements indices to construct my roof types - one 
reason for this is, i have to insert some index-swaps to get certain 
roofforms done with only one triangle_strip primitive per roof. 

the next step would be to calculate the normal vectors. my first (and most 
confortable) idea was to use the osg::smoothingVisitor. the problem arrived 
with that was, i was getting averaged normals, which didn't represent roofs 
very well.

so i was looking for another way where i could use for every planar face of my 
triangle_strip its own normals to get facetted looking roofs and posted here in 
this thread the question how to do this.

now, after some further research, i'm currently thinking, due the circumstance 
of shared vertices in a triangle_strip, it is impossible to assign multiple 
normals to one vertex. 
i' ve read of a workaround where to use one normal for every triangle_strip's 
planar face in addition and using FLATSHADING. i know this is not the same like 
the above mentioned in SMOOTHSHADING, but i think it would certainly better 
than the average normals.

so what do you think of that approach, or maybe you might have some other ideas?


Best Regards,
Christian Sam

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





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


Re: [osg-users] constructing geometry using position, normal and uv coord arrays

2009-05-11 Thread Christian Sam
Hi J.P.

Thank you for taking the time in helping me. i have two questions regarding 
your recommendations.


 I think most people would nowadays advise to just
 specify normals per vertex and not try to use normals per face (slow
 path).


- does this mean: if a normals-indexarray hasn't the same amount of entries 
like the vertex-indexarray (like in the case i'm planning to do) the rendering 
will be done with glBegin/glEnd calls instead of the faster alternatives 
(displaylists, indexed arrays, etc.)

- i have never heard the phrase slow path, but this does not sounds good ;-) 
does this mean the consequences mentioned above?


 
 E.g.
 primitive 1 = vertex_array_shared + normal_array1 + drawelements
 primitive 2 = vertex_array_shared + normal_array2 + drawelements
 


i' m a opengl/osg beginner, so i hope i got you right
- you mean that instead of defining one primitive (triangle_strip, 
drawElements) that defines a roof-geometry, i define several primitives 
(triangle_strip, drawElements) with same vertices and indices, but different 
assigned normalarrays) for the same roof-geometry. (there would still be a need 
of normals array 3, for the normals of vertex 4 and 5, pointing north)
this will result in two exact overlying, seperate triangle_strips so no 
difference will be noticed, 
[Image: http://www.spatiality.at/osg/roof.jpg ] 

but wouldn't their faces z-fighting?

Best regards,
christian sam

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





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


Re: [osg-users] constructing geometry using position, normal and uv coord arrays

2009-05-11 Thread Christian Sam
Hi,

okay, now i think i understand you. first step: construct the roof in 
conjunction with a normalarray that defines normals for as much as complete 
faces as possible. for the remaining ones, construct further primitives, which 
overlap the faces where the right normals weren't defined till yet.

[Image: http://www.spatiality.at/osg/roof2.jpg ]

was this the way you meant?

Cheers,
Christian

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





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


Re: [osg-users] constructing geometry using position, normal and uv coord arrays

2009-05-11 Thread Christian Sam
Hi,

update: i'm now using another concept. (i think thats the one you recommended 
at the beginning of the thread)

instead of my original indexlist: 0, 1, 4, 2, 5, 3, 4, 0 which prevents me from 
assigning more than one normal per vertex, i'm using index swaps to (re)visit 
a vertex more than one time. this allows me to assign more than one normal per 
vertex without violating the triangle_strip rules.

new indexlist: 0, 1, 4, 1, 4, 2, 5, 2, 5, 3, 5, 3, 4, 0
normalslist: W, W, W, S, S, S, S, E, E, E, N, N, N, N

normals[]: {North, East, South, West}


Thank you!

Cheers,
Christian

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





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


Re: [osg-users] constructing geometry using position, normal and uv coord arrays

2009-05-10 Thread Christian Sam
Hi,

i have a similar situation like the threadstarter longa...@gmail.com. i think i 
understand what you are recommending, but i dont know how to apply duplicate 
vertices (i also want to use different normals) for a triangle_strip primitive.

Thank you!

Cheers,
Christian Sam

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





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


Re: [osg-users] osgtessellate example question

2009-04-30 Thread Christian Sam
btw. after retessellation a geometry, where are the additional created vertices 
stored? are they added to the end of the existing vertexarray?

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





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


Re: [osg-users] when to use VertexBufferObjects or DisplayLists

2009-04-06 Thread Christian Sam
thank you all for the performance hints, as far as i have understood you, i 
should try to move from a geode-addDrawable(createSingleTreeSprite) to a 
geode-addDrawable(createMultiTreeGeometry(Cell)).

with that approach also different tree geometry (width/size) should be possible 
without performance loss? (although using different textures in one cell is 
impossible)

greetings,
christian

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





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


[osg-users] when to use VertexBufferObjects or DisplayLists

2009-04-05 Thread Christian Sam
Hi,

i have a question about using VBOs and Display Lists in osg

according to my OpenGL book, both methods will optimize rendering due geometry 
is moved to the graphics-hardware.  it also says, a constraint when using 
display lists is, that data can't be changed afterwards. so its great for 
rendering the same object multiple times, but not when you want to modify it.

in my application i'm rendering a forest. i want to have a handful of different 
tree sprites, which will vary in size and color (but not in texture). as far as 
i know osg uses display lists by default - will i benefit from a switch to 
vertex buffer objects, because in this case many states will stay the same and 
only geometry will vary/be modifed through the different tree sprites?


best regards,
christian

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





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


Re: [osg-users] when to use VertexBufferObjects or DisplayLists

2009-04-05 Thread Christian Sam
hi,

refering to osgforest as example, is a method like createTransformGraph, where 
the different looking trees are based on the same (scaled) tree model better 
from a performance point of view? i mean better than the two other fixed 
pipeline methods in this example

thanks in advance,
christian

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





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


[osg-users] VertexArray from a loaded .osg file.

2009-04-05 Thread Christian Sam
Hi,

i'm using osggis to convert an esri shape file to an .osg file. i want to use 
the scenedata, more precisely the vertex positions from that file. i need them 
for an analyzing function, and won't add that loaded file directly into my 
scenegraph, because i don't want to display it before analyzing is done.

is it possible to use the VertexArray from the loaded scenefile in a new 
created Drawable (which will display my analyzing results), AND add additional 
vertices, based on the analyzing process to it?
Or will i have to allocate a new VertexArray for my Drawable and copy the 
loaded file's VertexArray by Value into it?


Thanks in advance,
christian

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





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


[osg-users] osg proxynode

2009-03-29 Thread Christian Sam
Hi,

could someone tell me in a few sentences what a proxynode (or is it just 
proxy?) in osg is, and what it is used for? 

thanks in advance,
christian

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





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


[osg-users] better use smart-pointers or plain pointers in this case?

2009-03-26 Thread Christian Sam
Hi,

i'm working on a point-in-polygon test. my current implementation has a list 
with plain pointers that hold references to the polygons' properties. (i use 
them to ease the calculating of an inside-result for that polygons)


Code:

class FetchedPolygon {

public:

FetchedPolygon(osg::Geometry* geom = NULL, osg::Vec3Array* verts = 
NULL);

osg::Geometry* geometry;
osg::Vec3Array* vertices;
std::vectorosg::PrimitiveSet* primitiveSets;
};

std::mapconst unsigned int, FetchedPolygon fetchedPolygons;




before, i used smart-pointers to reference the polygons. (of course) it works 
both ways, but i can't decide what typ of referencing to use.

i think if i use smart-pointers, i would be able to check if the actual 
polygons in the scenegraph are still valid (check  the ref counter) without the 
need of a dirty flag. 
but if the polygons get changed/deleted (e.g. when i want to load a new set of 
polygon features) the properties i'm pointing to wouldn't be deleted as long as 
the smart-pointers are referencing them.

i think its hard to give a rule of thumb when to use smart-pointers. in general 
i'm using them when objects (especially for the scenegraph) are created - as 
long as they won't be attached to another scenegraph-object on the next line. 
i don't use them to reference these already allocated objects, e.g. when they 
are passed to another function, i would use a local pointer inside.


so what your suggestions? Thanks in advance,
christian

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





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


[osg-users] where can i find the vertex positions?

2009-03-18 Thread Christian Sam
Hi,

i' m looking for a way to get the vertex positions of my geometry. i know there 
are methods, provided by osg, to access these vertex positions, but i wanted to 
get some insight how they are handled by osg, so i debugged a simple scene.

i found the geometry object along with the _primitives data member, 
referencing my 5 DrawArrays with the correct indexes. the debugger also 
showed me a _vertexData member, but i couldn't find any reference to the 
actual vertex positions. 

(i set my breakpoint in viewerbase.cpp in the ViewerBase::frame() at the 
eventTraversal() function.)
here is my .osg scene file:

Code:

LOD {
  nodeMask 0x
  cullingActive TRUE
  Radius -1
  RangeMode DISTANCE_FROM_EYE_POINT
  RangeList 1 {
0 1e+010
  }
  num_children 1
  Group {
nodeMask 0x
cullingActive TRUE
num_children 1
MatrixTransform {
  nodeMask 0x
  cullingActive TRUE
  StateSet {
DataVariance STATIC
rendering_hint DEFAULT_BIN
renderBinMode INHERIT
GL_CULL_FACE ON
GL_LIGHTING OFF
CullFace {
  mode BACK
}
  }
  referenceFrame RELATIVE
  Matrix {
1 0 0 0
0 1 0 0
0 0 1 0
682985 5.21326e+006 0 1
  }
  num_children 1
  Geode {
nodeMask 0x
cullingActive TRUE
num_drawables 1
Geometry {
  PrimitiveSets 5
  {
DrawArrays LINE_STRIP 0 5
DrawArrays LINE_STRIP 5 5
DrawArrays LINE_STRIP 10 5
DrawArrays LINE_STRIP 15 5
DrawArrays LINE_STRIP 20 5
  }
  VertexArray Vec3Array 25
  {
218.39 263.092 0
   ...
-19.3272 -195.515 0
  }
  ColorBinding PER_VERTEX
  ColorArray Vec4Array 25
  {
0.001251 0.563585 0.193304 1
...
0.808741 0.585009 0.479873 1
  }
}
  }
}
  }
}




* where can i find them?

* and whats the prefered way to access them finally in my application? 
i think it can be done both with a visitor 
(osg::Drawable::AttributeFunctor::apply() like in the osgprerender example), 
and with a getChild().getVertexArray()

Thanks in advance,
christian

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





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


Re: [osg-users] where can i find the vertex positions?

2009-03-18 Thread Christian Sam
hi,

thanks for the hints, after searching for some of the terms i stumbled over 
http://www.openscenegraph.org/projects/osg/wiki/Support/ProgrammingGuide/AnalysingAScenegraph;
 which proved very helpful. (maybe someone references it in the tutorial 
section)

best regards,
christian

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





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


[osg-users] [vpb] osgdem and shapefiles (for --forest/--building)

2009-03-15 Thread Christian Sam
hi,

i'm using vpb-0.9.9 and osg-2.8.0. as long as i don't use shape files with the 
--forest/buidling option, osgdem works flawless, but when i use it, it crashes 
at the following line:


Code:

D:\workspace\test-geodata\vpb\grazosgdem -t ortho\test.tif -d dem\test.tif 
--forest forest\test.shp --height 10 --TERRAIN -o out-vpb2\graz.ive
-t ortho\test.tif
-d dem\test.tif
--forest forest\test.shp
Applying UserData
-o out-vpb2\graz.ive
Adding terrainTile
Adding model
addModel : Assigned coordinate system ()
addModel(4,)
   extents 531928 540774
   5.20866e+006 5.2177e+006
DataSet::_run() 0 0
ERROR 6: SetColorTable() not supported for existing TIFF files.
DataSet::assignDestinationCoordinateSystem() : assigning first source file as th
e destination coordinate system
started DataSet::createDestination(30)
AR=1.00 C1=1 R1=1
createNewDestinationGraph
Time for _destinationGraph-computeMaximumSourceResolution() = 0.002304
Time for createDestinationGraph 0.014481
Time for after_computeNeighbours 0.001316
Time for consolodateRequiredResolutions 0.01
Source::do3DObjectReprojectionUsingFileCache(), should be setting projection to
PROJCS[WGS 84 / UTM zone 33N,GEOGCS[WGS 84,DATUM[WGS_1984,SPHEROID[WGS 84
,6378137,298.2572235630016,AUTHORITY[EPSG,7030]],AUTHORITY[EPSG,6326]],
PRIMEM[Greenwich,0],UNIT[degree,0.0174532925199433],AUTHORITY[EPSG,4326]
],PROJECTION[Transverse_Mercator],PARAMETER[latitude_of_origin,0],PARAMETER[
central_meridian,15],PARAMETER[scale_factor,0.9996],PARAMETER[false_easting
,50],PARAMETER[false_northing,0],UNIT[metre,1,AUTHORITY[EPSG,9001]]
,AUTHORITY[EPSG,32633]]




it tried different SRSs for my geodata, but it didnt help. btw: if i use the 
same shapefiles in osggis or use a simple ogr2ogr command everything works, so 
i think the problem isn't caused from my fwtools-2.0.4.

thanks in advance,
christian

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





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


[osg-users] i want to update a 3rdParty library, does this effect osg builds?

2009-03-15 Thread Christian Sam
hi

i have built osg against fwtools-2.0.4. now i'm planning to install the latest 
fwtools version - what steps will i have to take referring my osg library ?

* does it suffice to update my %PATH% systemvariable from ...program 
files\fwtools2.0.4\bin;... to ...program files\fwtools2.2.8\bin;...?

* or do i have to run cmake (update the gdal include/lib paths there), and run 
a new build process with the generated .sln file? if yes, do i have to clear 
any cmake caches or do a complete rebuild of osg?


thanks in advance,
christian

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





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


[osg-users] [vpb] forest/building outlines

2009-03-13 Thread Christian Sam
hi,

i just noticed that osgdem provides --forest/--buidling outline options. whats 
the effect of that in the generated file?


best regards,
christian

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





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


[osg-users] questions about boundingBox and contains()

2009-03-10 Thread Christian Sam
hi,

as far as i understand every Drawable object in the scenegraph does have a 
_boundingBox data member.

* does the user have to manually initalize this boundingBox (with a call like 
myDrawableOject.computeBound()), or has it already been set by osg to nodes' 
geometry extent (xmin, xmax, ymin, ymax, zmin, zmax)?

* if the user wants to query, if a ceratin vec3 position lies inside a Drawable 
object, can this be done with something like: 
myDrawableObject.getBound().contains(osg::Vec3f(...))?

* if the user has a non-rectangluar polygon (e.g. an area in form of 
pentagram), will the above also work? if not, can you give me a hint how to 
implement an adequate contains()-query?


thanks in advance,
christian

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





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


[osg-users] osgtessellate example question

2009-03-02 Thread Christian Sam
hi,

i have a question concerning the osgtessellate example. why vanishes the 
TRIANGLE_STRIP primitives constructed in the function makePolsTwo() after 
TESS_WINDING_NEGATIVE?

as far as i understand, a similiar primitive, constructed in makePols() is 
created with same settings, like the one in makePolsTwo(), and it also 
(temporaly) disapperars while TESS_WINDING_ABS_GEQ_TWO. but when the 
tessellation cycle starts again, the one from makePols() is there again, the 
other one from makePolsTwo() isn't.

thanks in advance,
christian

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





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


[osg-users] osg debugging question

2009-03-02 Thread Christian Sam
hi, 

i wanted to debug an osg example (osgtessellate) to see how the number of 
primitives changes inside a Geode instance while tessellation is done. first 
of all, let me tell you that i'm not only new to osg, but also to debugging c++ 
applications, so if something seems strange the way i have done please let me 
know.



first, i changed the scope of the object i was interessed in to global scope:

osg::Group *makeTessellateExample (void) {
osg::Group *grp=new osg::Group;
osg::Geode gd=new osg::Geode;
...

extern osg::Geode *gd=0;
osg::Group *makeTessellateExample (void) {
osg::Group *grp=new osg::Group;
gd=new osg::Geode;
...


then i set a breakpoint inside a function of the applicationcode, which is also 
called once initalization is done.

bool KeyboardEventHandle::handle(...
{
switch(ea.getEventType())
{
case(osgGA::GUIEventAdapter::KEYDOWN):
{
if (_scene  ea.getKey()=='n')   BREAKPOINT 
...


finally when i pressed 'n' during runtime i could inspect the Geode instance in 
debugmode.

---

my questions are:

* at first i had some problems to find a suited place for the breakpoint, to 
pause the debugger so i can inspect my object. if there wouldn't be the 
keyboard-event-handler function inside the osgtessellation example, nothing 
inside the applicationcode would be re-called once initialization is done. so 
whats the preferred place for a breakpoint if viewer.run() is used?

* if i don't set a breakpoint, than it seems there is another possibility to 
pause the debugger of my IDE (vs 8.0). it's called BREAK ALL and program flow 
is paused inside of an arbitrary OSG function (xutility, vector, etc.). but 
from there i dont' have access to my Geode instane (because it's out of 
scope?). so whats the best way to debug an osg application?


thanks in advance,
christian

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





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


[osg-users] extend osgforest with a tree position raster mask

2009-02-27 Thread Christian Sam
hi,

i would like to extend the example-program osgforest in a way so that the 
placement of trees becomes user-controllable via an additional raster mask. in 
detail: a 1bit rasterfile should mark treeless areas with a value of 0 and 
tree-covered areas with a value of 1. subsequent this mandatory partitioning, 
i would like use the existing, random placement of trees in tree-covered areas.

i'm new to osg, so i have a few questions about how to implement this, and 
would also be happy to get some clues from you.


* can i use a simple osg::texture2D (nearest neighbour worldcoordinate scaled 
to osgforest's terrain extent), as raster mask?

* if yes, how can i query/access a raster value at a specific texture 
coordinate?

* how can i prevent that the raster mask will be rendered in the final scene? 
(would a nodemask be the right way, or are there any better/simpler ways?)

* in this first approach i will only implement 2 different tree regions: 
covered and non-covered. my plan is to extend to the existing createTreeList 
function with a simple check for the raster mask value at the randomly 
generated tree position coordinates. only if it happens to lie inside a 
tree-covered area, the tree will be pushed into the trees list. maybe someone 
knows a more elegant way? 


best regards,
christian

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





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


[osg-users] basic terrain querstions

2009-02-23 Thread Christian Sam
hi

i would like to get a better understanding of osg's various possibilities in 
terrain-visualization. currently i'm using osggis/virtualplanetbuilder to 
display georeferenced, common gis rasterfiles which work wonderful. but as an 
osg-newbie i also would like to know what are the approaches of basic terrain 
handling of osggis' underlying osg.

what i know/suppose so far:

* according to the osgforest example, the most basic method seems to be using 
osg::Geometry, attach a vertex-/texturecoord array and draw as indiced 
DrawElement primitiveset.

* the other possibility seems to be osg:HeightField, which is less code than 
the above one, as well i can omit texturecoordinates (at least according to the 
example) because of its regular grid characteristic.



what i would like to know:

* are these assumptions right?

* are there other terrain related possibilities?

* i also have read about osgTerrain, but when i start the osgterrain example 
with an osgdem (--TERRAIN) generated dataset: osgterrain.exe 
boston-sample\terrain\out.ive i get the following message: No model created, 
please specify terrain or master file on command line, so till yet i haven't 
got an impression what osgTerrain actually is/does. 
actually it is more important for me to get some information about osgTerrain 
itself, than to get this example running - but if it happens that someone knows 
why that application doesn't work it's okay too ;-) 

* is there an easy way or example on how to load terrain vertices from a dumb 
raster file (heightmap, like you use in many 3d modelling programs) directly to 
osg (without osgdem preparation)?


thanks in advance,
christian

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





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