Re: [osg-users] terrain database popping...

2009-04-15 Thread Raymond de Vries

Hi,

Chris 'Xenon' Hanson wrote:

Tueller, Shayne R Civ USAF AFMC 519 SMXS/MXDEC wrote:
  

Thanks for the input. I'm somewhat familiar with VTP but not with libmini. I'll 
poke around to get more info...



  Libmini is one of the lower-level APIs VTP uses. VTP is certainly a good base 
to build a
geosimulation app on, depending on your requirements. You can try to stick 
libmini into
plain OSG as well, but VTP already has done the integration for you.
  
I think this is not entirely true. I believe they have integrated it 
into VTP but not with OSG. There was a VTP thread about this some time ago.


good luck
Raymond

  

-Shayne



  


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


Re: [osg-users] Erratic intersections with long line segments

2009-04-15 Thread Marcin Prus

Hi Gordon,
we had similar problem here. We were standing exactly at the edge of 2 
adjacent triangles in large terrain database and 
osgUtil::LineSegmentIntersector failed because of internal floating 
precision. Using doubles instead of floats inside 
osgUtil::LineSegmentIntersector solved our problems.


I've made submission on 18.02.2009 with modified LineSegmentIntersector 
using cmake flag to set float or double precision internally but it 
never got into the trunk. You can look at it and create your own 
LineSegmentIntersectorDbl : public LineSegmentIntersector with double 
maths inside. Perhaps this will help - it did in our case


Best,
Marcin Prus

Tomlinson, Gordon pisze:

HI All
 
I posting this for one of my folks who's is having some erratic 
results when using a long vertical line segment and the standard 
osgUtil::LineSegmentIntersector
 
Basically when he sets a line segment up with  end X,Y, 100 and 
start X,Y, -100 , occasionally we fail to get a hit even though we 
are in the middle of the terrain skin, although moving the X,Y several 
meters in any direction and we get a hit.
 
If we reduce the Z of the line segment to 500k and -500k this happens 
less errant fails,
 
if we reduce the Z's to 1k, -1k then we never get a fail,
 
further when we are failing with the intersections if the camera is 
further away from the intersection the less fails we get, the more we 
move closer to  the intersection point the more fails we get.
 
Our Near and Far clip are fixed, 1 to 10-20k , the terrain skin is 
stanard OSG geometry, nothing fancy, some lods, but the level and 
which  lod is showing does not seem to be the issue
 
I'm at at a loss to why this may be happening, we are not doing 
anything out the oridnary in this case that I can think that would 
cause this erratic behaviour ,
 
 any one seen anything like this  before ?
 
 
thanks
 
 


/Gordon
Product Manager 3d
/__
/Gordon Tomlinson
//Email / : gtomlinson @ overwatch.textron.com
__
//(C)//:/ (+1) 571-265-2612*
*(W)//:/ //(+1) 703-437-7651//

Self defence is not a function of learning tricks
but is a function of how quickly and intensely one
can arouse one's instinct for survival
- */Master Tambo Tetsura/*

 



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


--
Marcin Prus
Kierownik Projektu


ETC-PZL Aerospace Industries Sp. z o.o.
Al. Krakowska 110/114,  P.O. Box 22
02-256 Warszawa
http://www.ai.com.pl

tel: (48-22) 846-54-17 wew. 135
fax (48-22) 846-54-18
e-mail: p...@ai.com.pl

NIP 522-01-01-817KRS 010025
Sa;d Rejonowy dla m. st. Warszawy w Warszawie
XIII Wydzia? Gospodarczy Krajowego Rejestru Sa;dowego.
Wniesiony kapita? zak?adowy Spó?ki wynosi 1 000 000 z?otych.
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] HDR Skybox

2009-04-15 Thread josselin . petit

Hi Rob,

I think you forgot to set the data in the textureCubeMap in float,  
that's why you see strange colors for values above 1.0.


You can try this :

osg::TextureCubeMap* cubemap = new osg::TextureCubeMap;
cubemap-setInternalFormat(GL_RGBA16F_ARB);
cubemap-setSourceType(GL_FLOAT);
cubemap-setSourceFormat(GL_RGBA);
#define CUBEMAP_FILENAME(face)  
../../../OpenSceneGraph-Data/Cubemap_debevec/ #face .hdr


osg::Image* imagePosX = osgDB::readImageFile(CUBEMAP_FILENAME(posx));
osg::Image* imageNegX = osgDB::readImageFile(CUBEMAP_FILENAME(negx));
osg::Image* imagePosY = osgDB::readImageFile(CUBEMAP_FILENAME(posy));
osg::Image* imageNegY = osgDB::readImageFile(CUBEMAP_FILENAME(negy));
osg::Image* imagePosZ = osgDB::readImageFile(CUBEMAP_FILENAME(posz));
osg::Image* imageNegZ = osgDB::readImageFile(CUBEMAP_FILENAME(negz));

if (imagePosX  imageNegX  imagePosY  imageNegY  imagePosZ  
 imageNegZ)

{
cubemap-setImage(osg::TextureCubeMap::POSITIVE_X, imagePosX);
cubemap-setImage(osg::TextureCubeMap::NEGATIVE_X, imageNegX);
cubemap-setImage(osg::TextureCubeMap::POSITIVE_Y, imagePosY);
cubemap-setImage(osg::TextureCubeMap::NEGATIVE_Y, imageNegY);
cubemap-setImage(osg::TextureCubeMap::POSITIVE_Z, imagePosZ);
cubemap-setImage(osg::TextureCubeMap::NEGATIVE_Z, imageNegZ);

cubemap-setWrap(osg::Texture::WRAP_S, osg::Texture::CLAMP_TO_EDGE);
cubemap-setWrap(osg::Texture::WRAP_T, osg::Texture::CLAMP_TO_EDGE);
cubemap-setWrap(osg::Texture::WRAP_R, osg::Texture::CLAMP_TO_EDGE);

//cubemap-setFilter(osg::Texture::MIN_FILTER,  
osg::Texture::LINEAR_MIPMAP_LINEAR);

cubemap-setFilter(osg::Texture::MIN_FILTER, 
osg::Texture::LINEAR);
cubemap-setFilter(osg::Texture::MAG_FILTER, osg::Texture::LINEAR);

//cubemap-setResizeNonPowerOfTwoHint(false);
}

Hope this help :)
Josselin.


This message was sent using IMP, the Internet Messaging Program.

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


[osg-users] [build] make : Build error on FFmpegDecoder.cpp while compiling OSG-dev

2009-04-15 Thread david bruyer
Hi,

I'm trying to compile the last version of OSG-dev but I have a build error at 
the make :


Code:
/home/player/FlightGear-dev/build/OpenSceneGraph/src/osgPlugins/ffmpeg/FFmpegDecoder.cpp:90:
 erreur: 'ENOMEM' was not declared in this scope
/home/player/FlightGear-dev/build/OpenSceneGraph/src/osgPlugins/ffmpeg/FFmpegDecoder.cpp:91:
 erreur: 'EILSEQ' was not declared in this scope
/home/player/FlightGear-dev/build/OpenSceneGraph/src/osgPlugins/ffmpeg/FFmpegDecoder.cpp:92:
 erreur: 'ENOSYS' was not declared in this scope
/home/player/FlightGear-dev/build/OpenSceneGraph/src/osgPlugins/ffmpeg/FFmpegDecoder.cpp:93:
 erreur: 'ENOENT' was not declared in this scope
/home/player/FlightGear-dev/build/OpenSceneGraph/src/osgPlugins/ffmpeg/FFmpegDecoder.cpp:
 In member function 'bool osgFFmpeg::FFmpegDecoder::readNextPacketNormal()':
/home/player/FlightGear-dev/build/OpenSceneGraph/src/osgPlugins/ffmpeg/FFmpegDecoder.cpp:286:
 attention : comparaison entre des expressions entières signée et non signée
/home/player/FlightGear-dev/build/OpenSceneGraph/src/osgPlugins/ffmpeg/FFmpegDecoder.cpp:293:
 attention : comparaison entre des expressions entières signée et non signée
make[2]: *** 
[src/osgPlugins/ffmpeg/CMakeFiles/osgdb_ffmpeg.dir/FFmpegDecoder.o] Erreur 1
make[1]: *** [src/osgPlugins/ffmpeg/CMakeFiles/osgdb_ffmpeg.dir/all] Erreur 2
make: *** [all] Erreur 2
error 4: compilation has encountered problems...



Someone can help me to build OSG-dev correctly ?

Thanks in advance.
... 
David

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





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


[osg-users] The orthographic projection near/far plane

2009-04-15 Thread Kees van Kooten

Hi,

I don't know whether this has been brought up before (I couldn't find 
any posts regarding this matter in the user forum), but when using the 
orthographic projection matrix's setProjectionMatrixAsOrtho(), the 
near/far plane z values supplied as arguments are not set as according 
to the OpenGL spec. Specifically, the third column of the projection 
matrix as applied by osg is:


0.0,
0.0,
-2.0/(zFar-zNear),
-(zFar+zNear)/(zFar-zNear)

with zFar and zNear being the actual Z values of the far and near plane 
- as opposed to the distance to the far and near plane mentioned in the 
spec, which in practice turns out to be the negated z value of the far 
and near plane.


If this has been a conscious choice, it seems highly confusing to me. 
For example, the vector (0,0,zNear,1) now transforms to 
(0,0,-(3zN+zF)/(zF-zN),1) in clip space, while the expected 
transformation would yield (0,0,-1,1). In practice, it gave me a few 
problems integrating an orthographic projection with depth to a 
partially rendered scene.


Of course, the workaround is easy, as one should just supply the negated 
zNear and zFar to setProjectionMatrixAsOrtho(), and in a certain way 
this is all just a matter of interpretation of the function arguments. 
In my opinion, supplying the actual z values for the near and far plane 
is the more intuitive choice, as this is what the names of the function 
arguments imply.


Best regards,
Kees van Kooten




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


Re: [osg-users] Turning the main viewer camera on and off (when taking high-res camera screenshots).

2009-04-15 Thread Ismail Pazarbasi
Jesper,

2 days ago, I was doing the same thing, same problem, but with
composite viewer. Here is what I did...

I create my screenshot camera while I create my main CompositeViewer
and its children Viewers. When I create this screenshot viewer, I set
its nodemask to 0 - by default, it won't render. I then trigger
screenshot by placing a graphics operation into graphics context's
operation queue, which saves an osg::Image. This image will then
becomes texture of a quad. Right after screenshot completes, I trigger
another event which does:
* Iterate through compositeviewer, set all viewers' masks to 0.
* Set nodemask of screenshot viewer to 0x
* Also set things like setCameraWithFocus, etc.

There is no flicker. I have no access to code right now, I may post an
example later tonight.

HTH
Ismail

On Wed, Apr 15, 2009 at 1:52 PM, Jesper D. Thomsen j...@anybodytech.com wrote:
 Hi all,

 I have an application where I use an osg::viewer for a single viewport of a
 model. The camera for the viewer is created like this:

 --

 // Init a new Camera (Master for this View)

 camera = mViewer-getCamera();

 // Assign Graphics Context to the Camera

 camera-setGraphicsContext(gc);

 // Set the viewport for the Camera

 camera-setViewport(

 new osg::Viewport(traits-x, traits-y, traits-width, traits-height));

 // Add the Camera to the Viewer

 mViewer-setCamera(camera.get());

 ---

 I have created a function which will be used to both take high-res
 screenshots of the main viewport and to make renderings from other cameras
 defined in the model (not osg::camera's, just a camera class defining a
 camera view). I wanted to do this by creating a new osg::camera on the fly
 and disabling to main viewer camera in order to not have the viewport
 redrawn while making a rendering/screenshot. If I do not disable the
 viewer-camera by using setnodemask, the following code works but the
 contents of the main viewport disappear until the next normal frame() is
 called, which causes some naste blinking of the viewport, when recording
 video from it. When I use setnodemask to try to disable the viewer camera, I
 just get a uniform grey osg::Image. I'm somewhat new to OSG, so it is
 probably some simple error. The source code for my screenshot/rendering
 function can be found below.
 System data: Viste 64, OSG 2.6.1, Visual Studio 2005 sp1.


 bool

 CModelView::CreateOSGImageSnap(int p_width, int p_height, double p_left,
 double p_right,

 double p_bottom, double p_top, double p_near, double p_far,

 double p_eye_pivot_0, double p_eye_pivot_1, double p_eye_pivot_2,

 double p_eye_eulerpar_0, double p_eye_eulerpar_1, double p_eye_eulerpar_2,

 double p_eye_eulerpar_3, double p_eye_dist, bool p_ortho, osg::Image*
 p_image)

 {

 osg::ref_ptrosg::Camera t_camera = new osg::Camera;

 osg::ref_ptrosg::Group t_parent = new osg::Group;

 unsigned int t_samples = 0;

 unsigned int t_colorSamples = 0;

 t_camera-setViewport(0,0,p_width,p_height);

 if(p_ortho){

 t_camera-setProjectionMatrixAsOrtho(p_left,p_right,p_bottom,p_top,p_near,p_far);

 }else{

 t_camera-setProjectionMatrixAsFrustum(p_left,p_right,p_bottom,p_top,p_near,p_far);

 }

 osg::Matrixd t_matrix =
 osg::Matrixd::translate(-(osg::Vec3d(p_eye_pivot_0,p_eye_pivot_1,p_eye_pivot_2)))*

 osg::Matrixd::rotate((osg::Quat(p_eye_eulerpar_1,p_eye_eulerpar_2,p_eye_eulerpar_3,p_eye_eulerpar_0)).inverse())*

 osg::Matrixd::translate(0.0,0.0,-p_eye_dist);

 t_camera-setViewMatrix(t_matrix);

 t_camera-setRenderOrder(osg::Camera::PRE_RENDER);

 t_camera-setRenderTargetImplementation(osg::Camera::FRAME_BUFFER_OBJECT);

 t_camera-setReferenceFrame(osg::Transform::ABSOLUTE_RF);

 t_camera-setClearColor(
 osg::Vec4(GetBackgroundColor()[0],GetBackgroundColor()[1],GetBackgroundColor()[2],1.0)
 );

 p_image-allocateImage(p_width, p_height, 1, GL_RGBA, GL_UNSIGNED_BYTE);

 t_camera-attach(osg::Camera::COLOR_BUFFER, p_image, t_samples,
 t_colorSamples);

 t_camera-setPostDrawCallback(new MyCameraPostDrawCallback(p_image));

 osg::Node* t_oldroot = mOSG-getASG()-getOSGRoot();

 t_camera-addChild(mOSG-getASG()-getOSGRoot());

 t_parent-addChild(t_camera.get());

 mOSG-getViewer()-setSceneData(t_parent.get());

 mOSG-getViewer()-getCamera()-setNodeMask(0x0);

 mOSG-getViewer()-frame();

 //bool s_test = osgDB::writeImageFile(*p_image, screenshot.bmp);

 mOSG-getViewer()-setSceneData(t_oldroot);

 mOSG-getViewer()-getCamera()-setNodeMask(0x);

 return true; //Fixme: This should be changed to a bool describing whether
 the snapshot was successful.

 };


 Regards, and thanks in advance.


 Jesper D. Thomsen



 ___
 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

Re: [osg-users] The orthographic projection near/far plane

2009-04-15 Thread Jolley, Thomas P
Hi Kees,

I would expect (0,0,-zNear,1) to transform to (0,0,-1,1).

zFar and zNear are positive in the direction you're looking and negative
behind you.  I didn't see anything in the osg code that defines zFar and
zNear as being the actual Z values.  Perhaps having the variables begin
with z is misleading you.  They really don't have anything to do with
the Z axis.  Dropping the z is a problem since some compilers use near
and far as keywords.  Less confusing names might be nearClip and
farClip.

-Original Message-
From: Kees van Kooten [mailto:kvankoo...@virtualproteins.com] 
Sent: Wednesday, April 15, 2009 5:49 AM
To: osg-users@lists.openscenegraph.org
Subject: [osg-users] The orthographic projection near/far plane

Hi,

I don't know whether this has been brought up before (I couldn't find
any posts regarding this matter in the user forum), but when using the
orthographic projection matrix's setProjectionMatrixAsOrtho(), the
near/far plane z values supplied as arguments are not set as according
to the OpenGL spec. Specifically, the third column of the projection
matrix as applied by osg is:

0.0,
0.0,
-2.0/(zFar-zNear),
-(zFar+zNear)/(zFar-zNear)

with zFar and zNear being the actual Z values of the far and near plane 
- as opposed to the distance to the far and near plane mentioned in the 
spec, which in practice turns out to be the negated z value of the far 
and near plane.

If this has been a conscious choice, it seems highly confusing to me. 
For example, the vector (0,0,zNear,1) now transforms to 
(0,0,-(3zN+zF)/(zF-zN),1) in clip space, while the expected 
transformation would yield (0,0,-1,1). In practice, it gave me a few 
problems integrating an orthographic projection with depth to a 
partially rendered scene.

Of course, the workaround is easy, as one should just supply the negated

zNear and zFar to setProjectionMatrixAsOrtho(), and in a certain way 
this is all just a matter of interpretation of the function arguments. 
In my opinion, supplying the actual z values for the near and far plane 
is the more intuitive choice, as this is what the names of the function 
arguments imply.

Best regards,
Kees van Kooten




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


Re: [osg-users] Problem of points showing

2009-04-15 Thread Lingyun Yu
Hi, Ismail,

I don't understand how the expanding happen?
I read all dataset into an array of P, then when it expands? and why?
and what's old array?

On Tue, Apr 14, 2009 at 2:27 PM, Ismail Pazarbasi pazarb...@gmail.comwrote:

 Hi Lingyun,

 std::bad_alloc is thrown when operator new cannot allocate memory,
 which indicates there is not enough memory. You may reserve your array
 before hand, as Paul mentioned, but it may throw as well. This could
 reduce, if nothing, copy operations. It may also prevent exception,
 because when expanding, std::vector will have two large copies at the
 same time. That is:
 e.g. old array length was 150
 expand by 50
 While allocating 200 elements, previous 150 elements will also
 be alive/allocated, that requires room for 350 elements in total.
 Resize may reduce this cost to 200 only, because vector will not
 have to expand afterwards (i.e. during push_back), which requires a
 copy operation. Note that C++ standard allocator doesn't do realloc().
 Instead, vector will allocate a block of  N * sizeof(T) items (or
 little more), copy existing block into new one, then free existing
 block.

 // instantiate vertices normally
 vertices = new osg::Vec3Array;

 // if number of parts is greater than 1000,
 // reserve your items before.
 if (NumPart  1000)
 {
   try
   {
  vertices-reserve(NumPart);
   }
   catch (std::bad_alloc e)
   {
   // handle exception here; log and return error from this function.
   // alternatively, you can rethrow here, and catch in caller.
   }
 }

 // wrap your push_back calls in a try-catch block
 try
 {
   vertices-push_back(...);
 }
 catch (std::exception)
 {
 }

 To be on the safe side, handle your exceptions and wrap your pointers
 in a smart pointer class. If an exception is thrown and you
 rethrow/return from function, you need to delete your Geode, Group and
 other objects. You may get all these for free, if you use a smart
 pointer (osg::ref_ptrT, in this case, as osg::Node's destructor is
 protected, IIRC, which prevents it to be deleted externally, but
 only when its ref count reaches 0).

 HTH
 Ismail

 2009/4/13 Paul Martz pma...@skew-matrix.com:
  Hi Lingyun Yu --
  You don't have a variable named 'galaxy' defined, so the
  addDrawable(galaxy) is suspicious.
 
  I'd so a resize on the vertex and color arrays, rather than a push_back,
 for
  efficiency reasons.
 
  I don't think numParts100 should cause any problems. OpenGL doesn
 not
  place an upper limit on the number of primitives you can render with a
  single glDrawArrays call.
 
  I don't really see anything that would cause a crash so I guess you
 should
  use a debugger and look at the call stack, like you would any other
 crash.
 
  Paul Martz
  Skew Matrix Software LLC
  http://www.skew-matrix.com
  +1 303 859 9466
 
 
  -Original Message-
  From: osg-users-boun...@lists.openscenegraph.org
  [mailto:osg-users-boun...@lists.openscenegraph.org] On Behalf Of Sent:
  Monday, April 13, 2009 9:27 AM
  To: osg-users@lists.openscenegraph.org
  Subject: [osg-users] Problem of points showing
 
  Hi, everybody,
 
  I met a problem when I want to show huge amount of points, as you can see
  the code below, if my NumPart is 100, no problem, it shows points
  properly. But if the NumPart is 200, then it shows a lot of lines. If
  NumPart is even bigger, the program complained like this:Microsoft C++
  exception: std::bad_alloc at memory location 0x0030e898.
 
  I don't know that's because the dataset is too big or not? because while
 it
  shows not so many points, everything goes well.
 
  By the way, the data in P array are all right.
 
  osg::Geode *makeGalaxy()
  {
  osg::Geode *geode = new osg::Geode();
  osg::Geometry *geometry= new osg::Geometry();
  osg::Vec3Array *vertices = new osg::Vec3Array();
  osg::Vec4Array *colors = new osg::Vec4Array();
  osg::Vec4 ini(1,0.1,0.55,1);
  osg::Vec4 fin(0,1,0,1);
 
  for (int i = 1; i = NumPart; i++)
  {
 
  vertices-push_back(osg::Vec3(P[i].Pos[0],P[i].Pos[1],P[i].Pos[2]));
  colors-push_back(ini+(fin-ini)*(i*1/NumPart));
  }
  geometry-setVertexArray(vertices);
  geometry-setColorArray(colors);
  geometry-setColorBinding(osg::Geometry::BIND_PER_VERTEX);
  geometry-addPrimitiveSet(new
 osg::DrawArrays(osg::PrimitiveSet::POINTS,
  0, NumPart));
  geode-addDrawable(galaxy);
  return geode;
  }
 
  ...
 
  Thank you.
 
  --
  Read this topic online here:
  http://forum.openscenegraph.org/viewtopic.php?p=10166#10166
 
 
 
 
 
  ___
  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] Erratic intersections with long line segments

2009-04-15 Thread Tomlinson, Gordon
Thanks Marcin
 
That's sort of what I was thinking that it had to be rounding, our tiles are 
localized so YX are relatively small but the Z could be any value range on the 
earth and seabed, 
1million,-1million was over kill  for the segment length.
 
Be we will look to go the double route .
 
Thanks again for you reply, 
 
 

Gordon
Product Manager 3d
__
Gordon Tomlinson
Email  : gtomlinson @ overwatch.textron.com
__

 



From: osg-users-boun...@lists.openscenegraph.org 
[mailto:osg-users-boun...@lists.openscenegraph.org] On Behalf Of Marcin Prus
Sent: Wednesday, April 15, 2009 4:01 AM
To: OpenSceneGraph Users
Subject: Re: [osg-users] Erratic intersections with long line segments


Hi Gordon,
we had similar problem here. We were standing exactly at the edge of 2 adjacent 
triangles in large terrain database and osgUtil::LineSegmentIntersector failed 
because of internal floating precision. Using doubles instead of floats inside 
osgUtil::LineSegmentIntersector solved our problems.

I've made submission on 18.02.2009 with modified LineSegmentIntersector using 
cmake flag to set float or double precision internally but it never got into 
the trunk. You can look at it and create your own LineSegmentIntersectorDbl : 
public LineSegmentIntersector with double maths inside. Perhaps this will help 
- it did in our case

Best,
Marcin Prus

Tomlinson, Gordon pisze: 

HI All
 
I posting this for one of my folks who's is having some erratic results 
when using a long vertical line segment and the standard 
osgUtil::LineSegmentIntersector
 
Basically when he sets a line segment up with  end X,Y, 100 and 
start X,Y, -100 , occasionally we fail to get a hit even though we are in 
the middle of the terrain skin, although moving the X,Y several meters in any 
direction and we get a hit.
 
If we reduce the Z of the line segment to 500k and -500k this happens 
less errant fails, 
 
if we reduce the Z's to 1k, -1k then we never get a fail, 
 
further when we are failing with the intersections if the camera is 
further away from the intersection the less fails we get, the more we move 
closer to  the intersection point the more fails we get.
 
Our Near and Far clip are fixed, 1 to 10-20k , the terrain skin is 
stanard OSG geometry, nothing fancy, some lods, but the level and which  lod is 
showing does not seem to be the issue
 
I'm at at a loss to why this may be happening, we are not doing 
anything out the oridnary in this case that I can think that would cause this 
erratic behaviour ,
 
 any one seen anything like this  before ? 
 
 
thanks
 
 

Gordon
Product Manager 3d
__
Gordon Tomlinson
Email  : gtomlinson @ overwatch.textron.com
__
(C): (+1) 571-265-2612
(W): (+1) 703-437-7651

Self defence is not a function of learning tricks 
but is a function of how quickly and intensely one 
can arouse one's instinct for survival 
- Master Tambo Tetsura

 




___
osg-users mailing list
osg-users@lists.openscenegraph.org

http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
  


-- 
Marcin Prus

Kierownik Projektu




ETC-PZL Aerospace Industries Sp. z o.o.
Al. Krakowska 110/114,  P.O. Box 22
02-256 Warszawa
http://www.ai.com.pl

tel: (48-22) 846-54-17 wew. 135
fax (48-22) 846-54-18
e-mail: p...@ai.com.pl

NIP 522-01-01-817KRS 010025
Sąd Rejonowy dla m. st. Warszawy w Warszawie 
XIII Wydział Gospodarczy Krajowego Rejestru Sądowego. 
Wniesiony kapitał zakładowy Spółki wynosi 1 000 000 złotych.

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


Re: [osg-users] Problem of points showing

2009-04-15 Thread Lingyun Yu
And yes,

after I did
if (NumPart  1000)
{
  try
  {
 vertices-reserve(NumPart);
  }
  catch (std::bad_alloc e)
  {
  // handle exception here; log and return error from this function.
  // alternatively, you can rethrow here, and catch in caller.
  }
}

it jumps to catch part.


2009/4/15 Lingyun Yu lingyun.yu...@gmail.com

 Hi, Ismail,

 I don't understand how the expanding happen?
 I read all dataset into an array of P, then when it expands? and why?
 and what's old array?

 On Tue, Apr 14, 2009 at 2:27 PM, Ismail Pazarbasi pazarb...@gmail.comwrote:

 Hi Lingyun,

 std::bad_alloc is thrown when operator new cannot allocate memory,
 which indicates there is not enough memory. You may reserve your array
 before hand, as Paul mentioned, but it may throw as well. This could
 reduce, if nothing, copy operations. It may also prevent exception,
 because when expanding, std::vector will have two large copies at the
 same time. That is:
 e.g. old array length was 150
 expand by 50
 While allocating 200 elements, previous 150 elements will also
 be alive/allocated, that requires room for 350 elements in total.
 Resize may reduce this cost to 200 only, because vector will not
 have to expand afterwards (i.e. during push_back), which requires a
 copy operation. Note that C++ standard allocator doesn't do realloc().
 Instead, vector will allocate a block of  N * sizeof(T) items (or
 little more), copy existing block into new one, then free existing
 block.

 // instantiate vertices normally
 vertices = new osg::Vec3Array;

 // if number of parts is greater than 1000,
 // reserve your items before.
 if (NumPart  1000)
 {
   try
   {
  vertices-reserve(NumPart);
   }
   catch (std::bad_alloc e)
   {
   // handle exception here; log and return error from this function.
   // alternatively, you can rethrow here, and catch in caller.
   }
 }

 // wrap your push_back calls in a try-catch block
 try
 {
   vertices-push_back(...);
 }
 catch (std::exception)
 {
 }

 To be on the safe side, handle your exceptions and wrap your pointers
 in a smart pointer class. If an exception is thrown and you
 rethrow/return from function, you need to delete your Geode, Group and
 other objects. You may get all these for free, if you use a smart
 pointer (osg::ref_ptrT, in this case, as osg::Node's destructor is
 protected, IIRC, which prevents it to be deleted externally, but
 only when its ref count reaches 0).

 HTH
 Ismail

 2009/4/13 Paul Martz pma...@skew-matrix.com:
  Hi Lingyun Yu --
  You don't have a variable named 'galaxy' defined, so the
  addDrawable(galaxy) is suspicious.
 
  I'd so a resize on the vertex and color arrays, rather than a push_back,
 for
  efficiency reasons.
 
  I don't think numParts100 should cause any problems. OpenGL doesn
 not
  place an upper limit on the number of primitives you can render with a
  single glDrawArrays call.
 
  I don't really see anything that would cause a crash so I guess you
 should
  use a debugger and look at the call stack, like you would any other
 crash.
 
  Paul Martz
  Skew Matrix Software LLC
  http://www.skew-matrix.com
  +1 303 859 9466
 
 
  -Original Message-
  From: osg-users-boun...@lists.openscenegraph.org
  [mailto:osg-users-boun...@lists.openscenegraph.org] On Behalf Of Sent:
  Monday, April 13, 2009 9:27 AM
  To: osg-users@lists.openscenegraph.org
  Subject: [osg-users] Problem of points showing
 
  Hi, everybody,
 
  I met a problem when I want to show huge amount of points, as you can
 see
  the code below, if my NumPart is 100, no problem, it shows points
  properly. But if the NumPart is 200, then it shows a lot of lines.
 If
  NumPart is even bigger, the program complained like this:Microsoft C++
  exception: std::bad_alloc at memory location 0x0030e898.
 
  I don't know that's because the dataset is too big or not? because while
 it
  shows not so many points, everything goes well.
 
  By the way, the data in P array are all right.
 
  osg::Geode *makeGalaxy()
  {
  osg::Geode *geode = new osg::Geode();
  osg::Geometry *geometry= new osg::Geometry();
  osg::Vec3Array *vertices = new osg::Vec3Array();
  osg::Vec4Array *colors = new osg::Vec4Array();
  osg::Vec4 ini(1,0.1,0.55,1);
  osg::Vec4 fin(0,1,0,1);
 
  for (int i = 1; i = NumPart; i++)
  {
 
  vertices-push_back(osg::Vec3(P[i].Pos[0],P[i].Pos[1],P[i].Pos[2]));
  colors-push_back(ini+(fin-ini)*(i*1/NumPart));
  }
  geometry-setVertexArray(vertices);
  geometry-setColorArray(colors);
  geometry-setColorBinding(osg::Geometry::BIND_PER_VERTEX);
  geometry-addPrimitiveSet(new
 osg::DrawArrays(osg::PrimitiveSet::POINTS,
  0, NumPart));
  geode-addDrawable(galaxy);
  return geode;
  }
 
  ...
 
  Thank you.
 
  --
  Read this topic online here:
  http://forum.openscenegraph.org/viewtopic.php?p=10166#10166
 
 
 
 
 
  

Re: [osg-users] any help would be appreciated - updating a groupofcameras (UNCLASSIFIED)

2009-04-15 Thread Konkle, Daniel T AMRDEC/Dynetics
Classification:  UNCLASSIFIED 
Caveats: NONE


So from helpful comments, I believe I know what I'm doing wrong.
I am creating a group and adding cameras to the group.
in the cameras I have various drawables that I'd like to update with my
program.

i can't get the camera's children to update and can't find an example
that works.

for an example of what i'm trying to do, 
i took the osghud example and created a few geometries on it.

i added a callback that should change a scale factor for the triangles
that i'm adding 
and update the text in one of the screens.

i tried to versions.  one that had the callback on the camera and one
that has the callback on one of the geodes.

I appreciate any help anyone might be able to give.

Danny

 -Original Message-
 From: osg-users-boun...@lists.openscenegraph.org [mailto:osg-users-
 boun...@lists.openscenegraph.org] On Behalf Of Paul Martz
 Sent: Tuesday, April 14, 2009 12:30 PM
 To: 'OpenSceneGraph Users'
 Subject: Re: [osg-users] any help would be appreciated - updating a
 groupofcameras (UNCLASSIFIED)
 
 Hi Danny -- There really isn't much info to go on here. You don't
 describe
 the mechanism that is doing the drawing. Cameras don't draw, they only
 set
 the matrices.
 
 Assuming you are changing a Drawable in your scene graph... One thing
 to
 check would be to make sure that you have setUseDisplayLists( false ).
 You
 don't want to use display lists for dynamic geometry.
 
 If your code is too large to debug, then write a small piece of code
to
 reproduce the problem outside of your larger app, making it as small
 and
 simple as possible. This will increase the odds that someone on the
 list
 will take the time to look at it.
 
 Paul Martz
 Skew Matrix Software LLC
 http://www.skew-matrix.com
 +1 303 859 9466
 
 -Original Message-
 From: osg-users-boun...@lists.openscenegraph.org
 [mailto:osg-users-boun...@lists.openscenegraph.org] On Behalf Of
 Konkle,
 Daniel T AMRDEC/Dynetics
 Sent: Tuesday, April 14, 2009 9:32 AM
 To: OpenSceneGraph Users
 Subject: [osg-users] any help would be appreciated - updating a group
 ofcameras (UNCLASSIFIED)
 
 Classification:  UNCLASSIFIED
 Caveats: NONE
 
 I am new to OSG and I am stuck and need help/insight.
 
 I'm created a Heads up display by extending the group class.
 
 My Hud is an osg::Group and has several cameras in it.
 
 The Hud displays fine.
 
 The Hud class has several variables that control how information is
 displayed such as the heading.
 
 I've written a callback and attached it to my Hud.
 
 After attaching my Hud to my scene, I want to the callback for the Hud
 to
 change its variables but the cameras in my Hud don't use the updated
 variables to redraw themselves.
 
 I've used osg::notify to show that the callback is getting executed
and
 to
 print out the value of the heading variable I am changing.
 
 I realize I'm not showing any code only because there is so much of
it.
 
 Can anyone give me an idea of where to look to figure out why all the
 children in my HUD class aren't updating?
 
 My HUD (an osg::Group) class constructor creates several cameras that
 draw a
 variety of elements on the screen.
 
 
 I've looked through most of the examples but I'm not sure what I'm
 looking
 for.
 
 Any help would be greatly appreciated.
 
 Danny Konkle
 Classification:  UNCLASSIFIED
 Caveats: NONE
 
 ___
 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
  Classification:  UNCLASSIFIED 
Caveats: NONE



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


Re: [osg-users] Problem of points showing

2009-04-15 Thread Ismail Pazarbasi
Lingyun,

I strongly recommend you to read your std::vector implementation's
source code and debug it to understand its behavior.

Vector starts with 0 or room for few elements. When you push_back, it
checks for available space in its internal block. If requested size is
greater than current capacity, vector will want to grow to accomodate
new items. Because it can't realloc, it will allocate a completely new
buffer, which will be greater than or equal to new size (new size is
greater than the current size).

For instance:
std::vectorint v;
// push_back 6 items...
'v' has 6 items. that is, 6 * sizeof(int) memory for storage.
if you want to insert 7th item, vector needs to grow (how much it
grows depends on implementation; e.g. Visual C++'s, Dinkumware's
library says try to grow by 50%), because there is no room to place
7th item.

To perform this operation, library allocates a new block of memory
that can accomodate *at least* 7 items *before* destroying existing
block. Dinkumware's library expands by 50%, so it may grow by 3 items'
size (assuming it had 6 items), which makes new capacity 9 items (6 +
(6 * 0.5)).

This sums up:
6 existing items
9 new size
+--
15 items.
After new block is allocated successfully, vector copies its existing
objects (6 objects) onto new buffer (which can hold 9 items). After
copy succeeds, vector destroys previous buffer (6 items), then you
have a vector whose capacity is sizeof(int) * 9. Until 9th item,
vector will not need to reallocate memory.

2009/4/15 Lingyun Yu lingyun.yu...@gmail.com:
 Hi, Ismail,

 I don't understand how the expanding happen?
 I read all dataset into an array of P, then when it expands? and why?
 and what's old array?

 On Tue, Apr 14, 2009 at 2:27 PM, Ismail Pazarbasi pazarb...@gmail.com
 wrote:

 Hi Lingyun,

 std::bad_alloc is thrown when operator new cannot allocate memory,
 which indicates there is not enough memory. You may reserve your array
 before hand, as Paul mentioned, but it may throw as well. This could
 reduce, if nothing, copy operations. It may also prevent exception,
 because when expanding, std::vector will have two large copies at the
 same time. That is:
 e.g. old array length was 150
 expand by 50
 While allocating 200 elements, previous 150 elements will also
 be alive/allocated, that requires room for 350 elements in total.
 Resize may reduce this cost to 200 only, because vector will not
 have to expand afterwards (i.e. during push_back), which requires a
 copy operation. Note that C++ standard allocator doesn't do realloc().
 Instead, vector will allocate a block of  N * sizeof(T) items (or
 little more), copy existing block into new one, then free existing
 block.

 // instantiate vertices normally
 vertices = new osg::Vec3Array;

 // if number of parts is greater than 1000,
 // reserve your items before.
 if (NumPart  1000)
 {
   try
   {
      vertices-reserve(NumPart);
   }
   catch (std::bad_alloc e)
   {
       // handle exception here; log and return error from this function.
       // alternatively, you can rethrow here, and catch in caller.
   }
 }

 // wrap your push_back calls in a try-catch block
 try
 {
   vertices-push_back(...);
 }
 catch (std::exception)
 {
 }

 To be on the safe side, handle your exceptions and wrap your pointers
 in a smart pointer class. If an exception is thrown and you
 rethrow/return from function, you need to delete your Geode, Group and
 other objects. You may get all these for free, if you use a smart
 pointer (osg::ref_ptrT, in this case, as osg::Node's destructor is
 protected, IIRC, which prevents it to be deleted externally, but
 only when its ref count reaches 0).

 HTH
 Ismail

 2009/4/13 Paul Martz pma...@skew-matrix.com:
  Hi Lingyun Yu --
  You don't have a variable named 'galaxy' defined, so the
  addDrawable(galaxy) is suspicious.
 
  I'd so a resize on the vertex and color arrays, rather than a push_back,
  for
  efficiency reasons.
 
  I don't think numParts100 should cause any problems. OpenGL doesn
  not
  place an upper limit on the number of primitives you can render with a
  single glDrawArrays call.
 
  I don't really see anything that would cause a crash so I guess you
  should
  use a debugger and look at the call stack, like you would any other
  crash.
 
  Paul Martz
  Skew Matrix Software LLC
  http://www.skew-matrix.com
  +1 303 859 9466
 
 
  -Original Message-
  From: osg-users-boun...@lists.openscenegraph.org
  [mailto:osg-users-boun...@lists.openscenegraph.org] On Behalf Of Sent:
  Monday, April 13, 2009 9:27 AM
  To: osg-users@lists.openscenegraph.org
  Subject: [osg-users] Problem of points showing
 
  Hi, everybody,
 
  I met a problem when I want to show huge amount of points, as you can
  see
  the code below, if my NumPart is 100, no problem, it shows points
  properly. But if the NumPart is 200, then it shows a lot of lines.
  If
  NumPart is even bigger, the program complained like this:Microsoft C++

Re: [osg-users] Problem of points showing

2009-04-15 Thread Ismail Pazarbasi
Hi Lingyun,

How much memory is installed on your computer? How much of it is
available and which operating system are you using? Do you use page
file/swap?

2009/4/15 Lingyun Yu lingyun.yu...@gmail.com:
 And yes,

 after I did
 if (NumPart  1000)
 {
   try
   {
      vertices-reserve(NumPart);
   }
   catch (std::bad_alloc e)
   {
       // handle exception here; log and return error from this function.
       // alternatively, you can rethrow here, and catch in caller.
   }
 }

 it jumps to catch part.


 2009/4/15 Lingyun Yu lingyun.yu...@gmail.com

 Hi, Ismail,

 I don't understand how the expanding happen?
 I read all dataset into an array of P, then when it expands? and why?
 and what's old array?

 On Tue, Apr 14, 2009 at 2:27 PM, Ismail Pazarbasi pazarb...@gmail.com
 wrote:

 Hi Lingyun,

 std::bad_alloc is thrown when operator new cannot allocate memory,
 which indicates there is not enough memory. You may reserve your array
 before hand, as Paul mentioned, but it may throw as well. This could
 reduce, if nothing, copy operations. It may also prevent exception,
 because when expanding, std::vector will have two large copies at the
 same time. That is:
 e.g. old array length was 150
 expand by 50
 While allocating 200 elements, previous 150 elements will also
 be alive/allocated, that requires room for 350 elements in total.
 Resize may reduce this cost to 200 only, because vector will not
 have to expand afterwards (i.e. during push_back), which requires a
 copy operation. Note that C++ standard allocator doesn't do realloc().
 Instead, vector will allocate a block of  N * sizeof(T) items (or
 little more), copy existing block into new one, then free existing
 block.

 // instantiate vertices normally
 vertices = new osg::Vec3Array;

 // if number of parts is greater than 1000,
 // reserve your items before.
 if (NumPart  1000)
 {
   try
   {
      vertices-reserve(NumPart);
   }
   catch (std::bad_alloc e)
   {
       // handle exception here; log and return error from this function.
       // alternatively, you can rethrow here, and catch in caller.
   }
 }

 // wrap your push_back calls in a try-catch block
 try
 {
   vertices-push_back(...);
 }
 catch (std::exception)
 {
 }

 To be on the safe side, handle your exceptions and wrap your pointers
 in a smart pointer class. If an exception is thrown and you
 rethrow/return from function, you need to delete your Geode, Group and
 other objects. You may get all these for free, if you use a smart
 pointer (osg::ref_ptrT, in this case, as osg::Node's destructor is
 protected, IIRC, which prevents it to be deleted externally, but
 only when its ref count reaches 0).

 HTH
 Ismail

 2009/4/13 Paul Martz pma...@skew-matrix.com:
  Hi Lingyun Yu --
  You don't have a variable named 'galaxy' defined, so the
  addDrawable(galaxy) is suspicious.
 
  I'd so a resize on the vertex and color arrays, rather than a
  push_back, for
  efficiency reasons.
 
  I don't think numParts100 should cause any problems. OpenGL doesn
  not
  place an upper limit on the number of primitives you can render with a
  single glDrawArrays call.
 
  I don't really see anything that would cause a crash so I guess you
  should
  use a debugger and look at the call stack, like you would any other
  crash.
 
  Paul Martz
  Skew Matrix Software LLC
  http://www.skew-matrix.com
  +1 303 859 9466
 
 
  -Original Message-
  From: osg-users-boun...@lists.openscenegraph.org
  [mailto:osg-users-boun...@lists.openscenegraph.org] On Behalf Of Sent:
  Monday, April 13, 2009 9:27 AM
  To: osg-users@lists.openscenegraph.org
  Subject: [osg-users] Problem of points showing
 
  Hi, everybody,
 
  I met a problem when I want to show huge amount of points, as you can
  see
  the code below, if my NumPart is 100, no problem, it shows points
  properly. But if the NumPart is 200, then it shows a lot of lines.
  If
  NumPart is even bigger, the program complained like this:Microsoft C++
  exception: std::bad_alloc at memory location 0x0030e898.
 
  I don't know that's because the dataset is too big or not? because
  while it
  shows not so many points, everything goes well.
 
  By the way, the data in P array are all right.
 
  osg::Geode *makeGalaxy()
  {
      osg::Geode *geode = new osg::Geode();
      osg::Geometry *geometry= new osg::Geometry();
      osg::Vec3Array *vertices = new osg::Vec3Array();
      osg::Vec4Array *colors = new osg::Vec4Array();
      osg::Vec4 ini(1,0.1,0.55,1);
      osg::Vec4 fin(0,1,0,1);
 
      for (int i = 1; i = NumPart; i++)
      {
 
  vertices-push_back(osg::Vec3(P[i].Pos[0],P[i].Pos[1],P[i].Pos[2]));
      colors-push_back(ini+(fin-ini)*(i*1/NumPart));
      }
      geometry-setVertexArray(vertices);
      geometry-setColorArray(colors);
      geometry-setColorBinding(osg::Geometry::BIND_PER_VERTEX);
      geometry-addPrimitiveSet(new
  osg::DrawArrays(osg::PrimitiveSet::POINTS,
  0, NumPart));
      

Re: [osg-users] The orthographic projection near/far plane

2009-04-15 Thread Kees van Kooten

Hi Thomas,

it is indeed a matter of the actual argument names. As the function 
interface just duplicates glOrtho(), it probably won't confuse anyone 
but me. My personal pick would be nearDistance, farDistance or something 
similar.


Regards,
Kees


Jolley, Thomas P wrote:

Hi Kees,

I would expect (0,0,-zNear,1) to transform to (0,0,-1,1).

zFar and zNear are positive in the direction you're looking and negative
behind you.  I didn't see anything in the osg code that defines zFar and
zNear as being the actual Z values.  Perhaps having the variables begin
with z is misleading you.  They really don't have anything to do with
the Z axis.  Dropping the z is a problem since some compilers use near
and far as keywords.  Less confusing names might be nearClip and
farClip.

-Original Message-
From: Kees van Kooten [mailto:kvankoo...@virtualproteins.com] 
Sent: Wednesday, April 15, 2009 5:49 AM

To: osg-users@lists.openscenegraph.org
Subject: [osg-users] The orthographic projection near/far plane

Hi,

I don't know whether this has been brought up before (I couldn't find
any posts regarding this matter in the user forum), but when using the
orthographic projection matrix's setProjectionMatrixAsOrtho(), the
near/far plane z values supplied as arguments are not set as according
to the OpenGL spec. Specifically, the third column of the projection
matrix as applied by osg is:

0.0,
0.0,
-2.0/(zFar-zNear),
-(zFar+zNear)/(zFar-zNear)

with zFar and zNear being the actual Z values of the far and near plane 
- as opposed to the distance to the far and near plane mentioned in the 
spec, which in practice turns out to be the negated z value of the far 
and near plane.


If this has been a conscious choice, it seems highly confusing to me. 
For example, the vector (0,0,zNear,1) now transforms to 
(0,0,-(3zN+zF)/(zF-zN),1) in clip space, while the expected 
transformation would yield (0,0,-1,1). In practice, it gave me a few 
problems integrating an orthographic projection with depth to a 
partially rendered scene.


Of course, the workaround is easy, as one should just supply the negated

zNear and zFar to setProjectionMatrixAsOrtho(), and in a certain way 
this is all just a matter of interpretation of the function arguments. 
In my opinion, supplying the actual z values for the near and far plane 
is the more intuitive choice, as this is what the names of the function 
arguments imply.


Best regards,
Kees van Kooten




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



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


Re: [osg-users] Problem of points showing

2009-04-15 Thread Lingyun Yu
Hi, Ismail,

ok, jey, I really need to read it. thank you very much.

On Wed, Apr 15, 2009 at 4:11 PM, Ismail Pazarbasi pazarb...@gmail.comwrote:

 Lingyun,

 I strongly recommend you to read your std::vector implementation's
 source code and debug it to understand its behavior.

 Vector starts with 0 or room for few elements. When you push_back, it
 checks for available space in its internal block. If requested size is
 greater than current capacity, vector will want to grow to accomodate
 new items. Because it can't realloc, it will allocate a completely new
 buffer, which will be greater than or equal to new size (new size is
 greater than the current size).

 For instance:
 std::vectorint v;
 // push_back 6 items...
 'v' has 6 items. that is, 6 * sizeof(int) memory for storage.
 if you want to insert 7th item, vector needs to grow (how much it
 grows depends on implementation; e.g. Visual C++'s, Dinkumware's
 library says try to grow by 50%), because there is no room to place
 7th item.

 To perform this operation, library allocates a new block of memory
 that can accomodate *at least* 7 items *before* destroying existing
 block. Dinkumware's library expands by 50%, so it may grow by 3 items'
 size (assuming it had 6 items), which makes new capacity 9 items (6 +
 (6 * 0.5)).

 This sums up:
 6 existing items
 9 new size
 +--
 15 items.
 After new block is allocated successfully, vector copies its existing
 objects (6 objects) onto new buffer (which can hold 9 items). After
 copy succeeds, vector destroys previous buffer (6 items), then you
 have a vector whose capacity is sizeof(int) * 9. Until 9th item,
 vector will not need to reallocate memory.

 2009/4/15 Lingyun Yu lingyun.yu...@gmail.com:
  Hi, Ismail,
 
  I don't understand how the expanding happen?
  I read all dataset into an array of P, then when it expands? and why?
  and what's old array?
 
  On Tue, Apr 14, 2009 at 2:27 PM, Ismail Pazarbasi pazarb...@gmail.com
  wrote:
 
  Hi Lingyun,
 
  std::bad_alloc is thrown when operator new cannot allocate memory,
  which indicates there is not enough memory. You may reserve your array
  before hand, as Paul mentioned, but it may throw as well. This could
  reduce, if nothing, copy operations. It may also prevent exception,
  because when expanding, std::vector will have two large copies at the
  same time. That is:
  e.g. old array length was 150
  expand by 50
  While allocating 200 elements, previous 150 elements will also
  be alive/allocated, that requires room for 350 elements in total.
  Resize may reduce this cost to 200 only, because vector will not
  have to expand afterwards (i.e. during push_back), which requires a
  copy operation. Note that C++ standard allocator doesn't do realloc().
  Instead, vector will allocate a block of  N * sizeof(T) items (or
  little more), copy existing block into new one, then free existing
  block.
 
  // instantiate vertices normally
  vertices = new osg::Vec3Array;
 
  // if number of parts is greater than 1000,
  // reserve your items before.
  if (NumPart  1000)
  {
try
{
   vertices-reserve(NumPart);
}
catch (std::bad_alloc e)
{
// handle exception here; log and return error from this function.
// alternatively, you can rethrow here, and catch in caller.
}
  }
 
  // wrap your push_back calls in a try-catch block
  try
  {
vertices-push_back(...);
  }
  catch (std::exception)
  {
  }
 
  To be on the safe side, handle your exceptions and wrap your pointers
  in a smart pointer class. If an exception is thrown and you
  rethrow/return from function, you need to delete your Geode, Group and
  other objects. You may get all these for free, if you use a smart
  pointer (osg::ref_ptrT, in this case, as osg::Node's destructor is
  protected, IIRC, which prevents it to be deleted externally, but
  only when its ref count reaches 0).
 
  HTH
  Ismail
 
  2009/4/13 Paul Martz pma...@skew-matrix.com:
   Hi Lingyun Yu --
   You don't have a variable named 'galaxy' defined, so the
   addDrawable(galaxy) is suspicious.
  
   I'd so a resize on the vertex and color arrays, rather than a
 push_back,
   for
   efficiency reasons.
  
   I don't think numParts100 should cause any problems. OpenGL doesn
   not
   place an upper limit on the number of primitives you can render with a
   single glDrawArrays call.
  
   I don't really see anything that would cause a crash so I guess you
   should
   use a debugger and look at the call stack, like you would any other
   crash.
  
   Paul Martz
   Skew Matrix Software LLC
   http://www.skew-matrix.com
   +1 303 859 9466
  
  
   -Original Message-
   From: osg-users-boun...@lists.openscenegraph.org
   [mailto:osg-users-boun...@lists.openscenegraph.org] On Behalf Of
 Sent:
   Monday, April 13, 2009 9:27 AM
   To: osg-users@lists.openscenegraph.org
   Subject: [osg-users] Problem of points showing
  
   Hi, everybody,
  
   I met a problem 

Re: [osg-users] any help would be appreciated - updating a groupofcameras (UNCLASSIFIED)

2009-04-15 Thread Jean-Sébastien Guay

Hello Danny,

Sending your message twice will not get you help faster. Good etiquette 
would be to wait a little, and if you don't get any response after a few 
days then you can send a reminder, like no one has any idea what I'm 
doing wrong? or something like that. We all have day jobs and sending 
the same message multiple times makes it look like you expect us to stop 
everything we're doing to help you...



i can't get the camera's children to update and can't find an example
that works.


Your callbacks weren't actually doing anything to the text or the 
geometry. I've modified it to show you one example of what you can do. 
Basically, just changing the variable with which you calculated the 
vertices and which was in the text (factor) will not change them. You 
need to update the text in your callback (using text-setText(string) ) 
and you need to update your osg::Geometry objects in the other callback 
(creating new vertex arrays, or perhaps looping through the existing 
vertices and modifying those you need to).


In my modifications, I used std::stringstream instead of boost::format 
because I don't have boost on this machine. When you send example code, 
it's preferable to send code that has no dependencies other than OSG 
(and its own dependencies). It makes it more likely that others will be 
able to help.


Note also that you had a memory leak in your code:

osg::Geometry* geom = new osg::Geometry;
geom = drawLines(...);

since drawLines creates a new osg::Geometry and returns it, the original 
one was never freed. You could change that in two ways to remove the leak:


// still wasteful, but at least there's no leak
osg::ref_ptrosg::Geometry geom = new osg::Geometry;
geom = drawLines(...);

or simply

osg::Geometry* geom = drawLines(...);

Also, I've set the geometry and text objects to DYNAMIC data variance. 
If you're modifying drawables (osg::Geometry and osgText::Text are in 
this category) or statesets in update callbacks, you need to set them to 
DYNAMIC or else you'll get crashes in multithreaded mode.


Do a diff between the file you sent and the one that's attached to this 
message to see the changes. Now that I've shown you how to update text 
and geometry in the callbacks, it's up to you to make changes to get the 
result you want.


Style comment: it works, but I think you'd be able to understand 
yourself more if your code was cleaner and better indented.


Hope this helps,

J-S
--
__
Jean-Sebastien Guayjean-sebastien.g...@cm-labs.com
   http://www.cm-labs.com/
http://whitestar02.webhop.org/
/* OpenSceneGraph example, osghud.
*
*  Permission is hereby granted, free of charge, to any person obtaining a copy
*  of this software and associated documentation files (the Software), to deal
*  in the Software without restriction, including without limitation the rights
*  to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
*  copies of the Software, and to permit persons to whom the Software is
*  furnished to do so, subject to the following conditions:
*
*  THE SOFTWARE IS PROVIDED AS IS, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
*  IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
*  FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
*  AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
*  LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
*  OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
*  THE SOFTWARE.
*/

//#include boost/format.hpp
#include sstream
#include osgUtil/Optimizer
#include osgDB/ReadFile

#include osgViewer/Viewer
#include osgViewer/CompositeViewer

#include osgGA/TrackballManipulator

#include osg/Material
#include osg/Geode
#include osg/BlendFunc
#include osg/Depth
#include osg/PolygonOffset
#include osg/MatrixTransform
#include osg/Camera
#include osg/RenderInfo

#include osgDB/WriteFile

#include osgText/Text

osg::Vec4 colorVec[] = {
osg::Vec4(0.0f, 0.99f, 0.0f, 1.0f),
osg::Vec4(0.85f, 0.00f, 0.0f, 1.0f),
osg::Vec4(0.0f, 0.00f, 0.0f, 1.0f),
osg::Vec4(1.0f, 1.00f, 1.0f, 1.0f),
osg::Vec4(0.0f, 0.00f, 1.0f, 1.0f),
osg::Vec4(0.3f, 0.30f, 0.3f, 1.0f),
osg::Vec4(0.9f, 0.90f, 0.0f, 1.0f)
};
// create LINES
osg::Geometry * drawLines(osg::Vec3Array * vertices, int colorIndex, 
osg::PrimitiveSet::Mode lineType)
{
// create Geometry object to store all the vertices and lines primitive.
osg::Geometry* linesGeom = new osg::Geometry();
// Set dynamic data variance since the geometry will be updated in a 
callback.
linesGeom-setDataVariance(osg::Object::DYNAMIC);
// Use vertex buffers so display lists won't need to be updated.
linesGeom-setUseDisplayList(false);

// pass the created vertex array to the points geometry object.
linesGeom-setVertexArray(vertices);

// 

Re: [osg-users] any help would be appreciated - updating agroupofcameras (UNCLASSIFIED)

2009-04-15 Thread Paul Martz
Hi Danny -- Can you create a reproducer code that doesn't use Boost?

Paul Martz
Skew Matrix Software LLC
http://www.skew-matrix.com
+1 303 859 9466

-Original Message-
From: osg-users-boun...@lists.openscenegraph.org
[mailto:osg-users-boun...@lists.openscenegraph.org] On Behalf Of Konkle,
Daniel T AMRDEC/Dynetics
Sent: Wednesday, April 15, 2009 8:04 AM
To: OpenSceneGraph Users
Subject: Re: [osg-users] any help would be appreciated - updating
agroupofcameras (UNCLASSIFIED)

Classification:  UNCLASSIFIED
Caveats: NONE


So from helpful comments, I believe I know what I'm doing wrong.
I am creating a group and adding cameras to the group.
in the cameras I have various drawables that I'd like to update with my
program.

i can't get the camera's children to update and can't find an example
that works.

for an example of what i'm trying to do, 
i took the osghud example and created a few geometries on it.

i added a callback that should change a scale factor for the triangles
that i'm adding 
and update the text in one of the screens.

i tried to versions.  one that had the callback on the camera and one
that has the callback on one of the geodes.

I appreciate any help anyone might be able to give.

Danny

 -Original Message-
 From: osg-users-boun...@lists.openscenegraph.org [mailto:osg-users-
 boun...@lists.openscenegraph.org] On Behalf Of Paul Martz
 Sent: Tuesday, April 14, 2009 12:30 PM
 To: 'OpenSceneGraph Users'
 Subject: Re: [osg-users] any help would be appreciated - updating a
 groupofcameras (UNCLASSIFIED)
 
 Hi Danny -- There really isn't much info to go on here. You don't
 describe
 the mechanism that is doing the drawing. Cameras don't draw, they only
 set
 the matrices.
 
 Assuming you are changing a Drawable in your scene graph... One thing
 to
 check would be to make sure that you have setUseDisplayLists( false ).
 You
 don't want to use display lists for dynamic geometry.
 
 If your code is too large to debug, then write a small piece of code
to
 reproduce the problem outside of your larger app, making it as small
 and
 simple as possible. This will increase the odds that someone on the
 list
 will take the time to look at it.
 
 Paul Martz
 Skew Matrix Software LLC
 http://www.skew-matrix.com
 +1 303 859 9466
 
 -Original Message-
 From: osg-users-boun...@lists.openscenegraph.org
 [mailto:osg-users-boun...@lists.openscenegraph.org] On Behalf Of
 Konkle,
 Daniel T AMRDEC/Dynetics
 Sent: Tuesday, April 14, 2009 9:32 AM
 To: OpenSceneGraph Users
 Subject: [osg-users] any help would be appreciated - updating a group
 ofcameras (UNCLASSIFIED)
 
 Classification:  UNCLASSIFIED
 Caveats: NONE
 
 I am new to OSG and I am stuck and need help/insight.
 
 I'm created a Heads up display by extending the group class.
 
 My Hud is an osg::Group and has several cameras in it.
 
 The Hud displays fine.
 
 The Hud class has several variables that control how information is
 displayed such as the heading.
 
 I've written a callback and attached it to my Hud.
 
 After attaching my Hud to my scene, I want to the callback for the Hud
 to
 change its variables but the cameras in my Hud don't use the updated
 variables to redraw themselves.
 
 I've used osg::notify to show that the callback is getting executed
and
 to
 print out the value of the heading variable I am changing.
 
 I realize I'm not showing any code only because there is so much of
it.
 
 Can anyone give me an idea of where to look to figure out why all the
 children in my HUD class aren't updating?
 
 My HUD (an osg::Group) class constructor creates several cameras that
 draw a
 variety of elements on the screen.
 
 
 I've looked through most of the examples but I'm not sure what I'm
 looking
 for.
 
 Any help would be greatly appreciated.
 
 Danny Konkle
 Classification:  UNCLASSIFIED
 Caveats: NONE
 
 ___
 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
  Classification:  UNCLASSIFIED 
Caveats: NONE


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


Re: [osg-users] [build] make : Build error on FFmpegDecoder.cpp while compiling OSG-dev

2009-04-15 Thread david bruyer
Bonjour Jean-Sébastien,

Merci pour ta prise en compte.

David

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





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


[osg-users] GPU Feedback

2009-04-15 Thread Ed
Does OSG provide in mechanism for retrieving any metrics from the GPU?  
Seems like I read a few months ago on the nvidia dev site that certain 
drivers allowed for the retrieval of GPU performance metrics, but I 
can't find that information now.   Anyone know what I am referring to?  
Or if I am hallucinating?


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


Re: [osg-users] any help would be appreciated - updating a groupofcameras (UNCLASSIFIED)

2009-04-15 Thread Konkle, Daniel T AMRDEC/Dynetics
Classification:  UNCLASSIFIED 
Caveats: NONE

i didn't send it twice because i wanted more help or faster help.

i sent it twice because i was having problem with email and i didn't think the 
message went out.

i check the list server and it wasn't there. 

i was obviously mistaken and i apologize.

 -Original Message-
 From: osg-users-boun...@lists.openscenegraph.org [mailto:osg-users-
 boun...@lists.openscenegraph.org] On Behalf Of Jean-Sébastien Guay
 Sent: Wednesday, April 15, 2009 9:48 AM
 To: OpenSceneGraph Users
 Subject: Re: [osg-users] any help would be appreciated - updating a
 groupofcameras (UNCLASSIFIED)
 
 Hello Danny,
 
 Sending your message twice will not get you help faster. Good etiquette
 would be to wait a little, and if you don't get any response after a
 few
 days then you can send a reminder, like no one has any idea what I'm
 doing wrong? or something like that. We all have day jobs and sending
 the same message multiple times makes it look like you expect us to
 stop
 everything we're doing to help you...
 
  i can't get the camera's children to update and can't find an example
  that works.
 
 Your callbacks weren't actually doing anything to the text or the
 geometry. I've modified it to show you one example of what you can do.
 Basically, just changing the variable with which you calculated the
 vertices and which was in the text (factor) will not change them. You
 need to update the text in your callback (using text-setText(string) )
 and you need to update your osg::Geometry objects in the other callback
 (creating new vertex arrays, or perhaps looping through the existing
 vertices and modifying those you need to).
 
 In my modifications, I used std::stringstream instead of boost::format
 because I don't have boost on this machine. When you send example code,
 it's preferable to send code that has no dependencies other than OSG
 (and its own dependencies). It makes it more likely that others will be
 able to help.
 
 Note also that you had a memory leak in your code:
 
 osg::Geometry* geom = new osg::Geometry;
 geom = drawLines(...);
 
 since drawLines creates a new osg::Geometry and returns it, the
 original
 one was never freed. You could change that in two ways to remove the
 leak:
 
 // still wasteful, but at least there's no leak
 osg::ref_ptrosg::Geometry geom = new osg::Geometry;
 geom = drawLines(...);
 
 or simply
 
 osg::Geometry* geom = drawLines(...);
 
 Also, I've set the geometry and text objects to DYNAMIC data variance.
 If you're modifying drawables (osg::Geometry and osgText::Text are in
 this category) or statesets in update callbacks, you need to set them
 to
 DYNAMIC or else you'll get crashes in multithreaded mode.
 
 Do a diff between the file you sent and the one that's attached to this
 message to see the changes. Now that I've shown you how to update text
 and geometry in the callbacks, it's up to you to make changes to get
 the
 result you want.
 
 Style comment: it works, but I think you'd be able to understand
 yourself more if your code was cleaner and better indented.
 
 Hope this helps,
 
 J-S
 --
 __
 Jean-Sebastien Guayjean-sebastien.g...@cm-labs.com
 http://www.cm-labs.com/
  http://whitestar02.webhop.org/
Classification:  UNCLASSIFIED 
Caveats: NONE

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


Re: [osg-users] any help would be appreciated - updatingagroupofcameras (UNCLASSIFIED)

2009-04-15 Thread Konkle, Daniel T AMRDEC/Dynetics
Classification:  UNCLASSIFIED 
Caveats: NONE

reproducer code without boost.

 -Original Message-
 From: osg-users-boun...@lists.openscenegraph.org [mailto:osg-users-
 boun...@lists.openscenegraph.org] On Behalf Of Paul Martz
 Sent: Wednesday, April 15, 2009 9:52 AM
 To: 'OpenSceneGraph Users'
 Subject: Re: [osg-users] any help would be appreciated -
 updatingagroupofcameras (UNCLASSIFIED)
 
 Hi Danny -- Can you create a reproducer code that doesn't use Boost?
 
 Paul Martz
 Skew Matrix Software LLC
 http://www.skew-matrix.com
 +1 303 859 9466
 
 -Original Message-
 From: osg-users-boun...@lists.openscenegraph.org
 [mailto:osg-users-boun...@lists.openscenegraph.org] On Behalf Of
 Konkle,
 Daniel T AMRDEC/Dynetics
 Sent: Wednesday, April 15, 2009 8:04 AM
 To: OpenSceneGraph Users
 Subject: Re: [osg-users] any help would be appreciated - updating
 agroupofcameras (UNCLASSIFIED)
 
 Classification:  UNCLASSIFIED
 Caveats: NONE
 
 
 So from helpful comments, I believe I know what I'm doing wrong.
 I am creating a group and adding cameras to the group.
 in the cameras I have various drawables that I'd like to update with
my
 program.
 
 i can't get the camera's children to update and can't find an example
 that works.
 
 for an example of what i'm trying to do,
 i took the osghud example and created a few geometries on it.
 
 i added a callback that should change a scale factor for the triangles
 that i'm adding
 and update the text in one of the screens.
 
 i tried to versions.  one that had the callback on the camera and one
 that has the callback on one of the geodes.
 
 I appreciate any help anyone might be able to give.
 
 Danny
 
  -Original Message-
  From: osg-users-boun...@lists.openscenegraph.org [mailto:osg-users-
  boun...@lists.openscenegraph.org] On Behalf Of Paul Martz
  Sent: Tuesday, April 14, 2009 12:30 PM
  To: 'OpenSceneGraph Users'
  Subject: Re: [osg-users] any help would be appreciated - updating a
  groupofcameras (UNCLASSIFIED)
 
  Hi Danny -- There really isn't much info to go on here. You don't
  describe
  the mechanism that is doing the drawing. Cameras don't draw, they
 only
  set
  the matrices.
 
  Assuming you are changing a Drawable in your scene graph... One
thing
  to
  check would be to make sure that you have setUseDisplayLists( false
 ).
  You
  don't want to use display lists for dynamic geometry.
 
  If your code is too large to debug, then write a small piece of code
 to
  reproduce the problem outside of your larger app, making it as small
  and
  simple as possible. This will increase the odds that someone on the
  list
  will take the time to look at it.
 
  Paul Martz
  Skew Matrix Software LLC
  http://www.skew-matrix.com
  +1 303 859 9466
 
  -Original Message-
  From: osg-users-boun...@lists.openscenegraph.org
  [mailto:osg-users-boun...@lists.openscenegraph.org] On Behalf Of
  Konkle,
  Daniel T AMRDEC/Dynetics
  Sent: Tuesday, April 14, 2009 9:32 AM
  To: OpenSceneGraph Users
  Subject: [osg-users] any help would be appreciated - updating a
group
  ofcameras (UNCLASSIFIED)
 
  Classification:  UNCLASSIFIED
  Caveats: NONE
 
  I am new to OSG and I am stuck and need help/insight.
 
  I'm created a Heads up display by extending the group class.
 
  My Hud is an osg::Group and has several cameras in it.
 
  The Hud displays fine.
 
  The Hud class has several variables that control how information is
  displayed such as the heading.
 
  I've written a callback and attached it to my Hud.
 
  After attaching my Hud to my scene, I want to the callback for the
 Hud
  to
  change its variables but the cameras in my Hud don't use the updated
  variables to redraw themselves.
 
  I've used osg::notify to show that the callback is getting executed
 and
  to
  print out the value of the heading variable I am changing.
 
  I realize I'm not showing any code only because there is so much of
 it.
 
  Can anyone give me an idea of where to look to figure out why all
the
  children in my HUD class aren't updating?
 
  My HUD (an osg::Group) class constructor creates several cameras
that
  draw a
  variety of elements on the screen.
 
 
  I've looked through most of the examples but I'm not sure what I'm
  looking
  for.
 
  Any help would be greatly appreciated.
 
  Danny Konkle
  Classification:  UNCLASSIFIED
  Caveats: NONE
 
  ___
  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
   Classification:  UNCLASSIFIED
 Caveats: NONE
 
 
 ___
 osg-users mailing list
 osg-users@lists.openscenegraph.org
 http://lists.openscenegraph.org/listinfo.cgi/osg-users-
 openscenegraph.org
  

Re: [osg-users] GPU Feedback

2009-04-15 Thread Tomlinson, Gordon
Run osgviewer with you favorite models and cycle through the stats
options ( the 's' key ) you will see some GPU stats 


Gordon
Product Manager 3d
__
Gordon Tomlinson
Email  : gtomlinson @ overwatch.textron.com
__


-Original Message-
From: osg-users-boun...@lists.openscenegraph.org
[mailto:osg-users-boun...@lists.openscenegraph.org] On Behalf Of Ed
Sent: Wednesday, April 15, 2009 11:02 AM
To: osg-users@lists.openscenegraph.org
Subject: [osg-users] GPU Feedback

Does OSG provide in mechanism for retrieving any metrics from the GPU?  
Seems like I read a few months ago on the nvidia dev site that certain
drivers allowed for the retrieval of GPU performance metrics, but I 
can't find that information now.   Anyone know what I am referring to?  
Or if I am hallucinating?

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


Re: [osg-users] terrain database popping...

2009-04-15 Thread Chris 'Xenon' Hanson
Raymond de Vries wrote:
 geosimulation app on, depending on your requirements. You can try to
 stick libmini into
 plain OSG as well, but VTP already has done the integration for you.
 I think this is not entirely true. I believe they have integrated it
 into VTP but not with OSG. There was a VTP thread about this some time ago.

  Right. I phrased that poorly. Libmini is integrated into VTP, but not into 
OSG. Libmini
is a purely OpenGL piece of code, and would require integration into OSG. Most 
people
facing this prospect just go with VTP to get the whole enchilada.

 good luck
 Raymond

-- 
Chris 'Xenon' Hanson, omo sanza lettere  Xenon AlphaPixel.com
PixelSense Landsat processing now available! http://www.alphapixel.com/demos/
There is no Truth. There is only Perception. To Perceive is to Exist. - Xen
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] Problem of points showing

2009-04-15 Thread Martin Beckett
vector typically doubles the size of memory it reserves when it needs more 
space. This is because every time it allocates new memory it must move the 
contents of the existing memory - it's slow to copy all the existing elements 
and so it makes sense to only increase as few times as possible (see 
http://www.ddj.com/cpp/184401375 for a discussion). 
Unfortunately this isn't a good stratergy when you are almost out of memory.

Another problem is that the memory must be contiguous (ie in one block), so if 
you frequently allocate and delete memory there might not be a single free 
block large enough - even if you have enough overall memory.

There is also a little 'trick' to reduce a vector back down to the minimum 
required memory - see http://www.gotw.ca/gotw/054.htm
 
Code:
vectorstuff( c ).swap( c );



(note - can someone confirm the swap() trick works with ref counting?)

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





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


Re: [osg-users] any help would be appreciated - updating a groupofcameras (UNCLASSIFIED)

2009-04-15 Thread Jean-Sébastien Guay

Hello Danny,


i didn't send it twice because i wanted more help or faster help.
i sent it twice because i was having problem with email and i didn't think the 
message went out.
i check the list server and it wasn't there. 
i was obviously mistaken and i apologize.


OK, apology accepted, but look below and check my message, I attached a 
fixed example that should help you out and gave a few explanatory 
comments. (I have the habit of placing quotes inline with my reply)


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


Re: [osg-users] Problem of points showing

2009-04-15 Thread Lingyun Yu
Thank you very much, Ismail and Martin,

I have 3G memory installed. and 1.02G is avaible, I use windows vista. and I
didn't use file page file/swap.

I will read carefully about both of you suggested. If you have some source
can be read for that, please tell me.

Yun


On Wed, Apr 15, 2009 at 5:10 PM, Martin Beckett m...@mgbeckett.com wrote:

 vector typically doubles the size of memory it reserves when it needs more
 space. This is because every time it allocates new memory it must move the
 contents of the existing memory - it's slow to copy all the existing
 elements and so it makes sense to only increase as few times as possible
 (see http://www.ddj.com/cpp/184401375 for a discussion).
 Unfortunately this isn't a good stratergy when you are almost out of
 memory.

 Another problem is that the memory must be contiguous (ie in one block), so
 if you frequently allocate and delete memory there might not be a single
 free block large enough - even if you have enough overall memory.

 There is also a little 'trick' to reduce a vector back down to the minimum
 required memory - see http://www.gotw.ca/gotw/054.htm

 Code:
 vectorstuff( c ).swap( c );



 (note - can someone confirm the swap() trick works with ref counting?)

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





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




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


Re: [osg-users] OpenSceneGraph-2.8.1 release candidate two tagged

2009-04-15 Thread Mick
Hi Robert,


robertosfield wrote:
 Hi All,
 
 I've now fixed the svn2cl usage in Cmake so that that ChangeLog generation 
 should now reflect either the branch or svn/trunk that a release is tagged 
 from.  I've also merged a change to OperationThread to enable multi-thread 
 usage with the up coming osgCompute NodeKit so using 2.8.1 with osgCompute 
 should work out of the box.  You can grab the source code from:
   
  source package : OpenSceneGraph-2.8.1-rc2.zip 
  (http://www.openscenegraph.org/downloads/developer_releases/OpenSceneGraph-2.8.1-rc2.zip)
   
  svn tag: svn co 
  http://www.openscenegraph.org/svn/osg/OpenSceneGraph/tags/OpenSceneGraph-2.8.1-rc2
   
  (http://www.openscenegraph.org/svn/osg/OpenSceneGraph/tags/OpenSceneGraph-2.8.1-rc2)
   OpenSceneGraph  
 As usual I'll make requests/pleads for testing across as many platforms as 
 you can get your hands on and against your own apps as well as the OSG 
 example set.  The more testing the better.  Could you send in feedback of 
 success/failires to this thread so we can keep track of how well this release 
 candidate is hanging together.
 
 Cheers,
 Robert.
 
  --
 Post generated by Mail2Forum


the 2.8.1 tag rc2 builds and runs fine on Windows XP MSVC8 (Visual Studio 
2005). Also no problems with building the examples and using the upcoming 
osgCompute/osgCuda in multi-threaded applications.

Thanks.

Mick


-- 
SVT Group

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





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


Re: [osg-users] any help would be appreciated - updating a groupofcameras (UNCLASSIFIED)

2009-04-15 Thread Konkle, Daniel T AMRDEC/Dynetics
Classification:  UNCLASSIFIED 
Caveats: NONE

 
 Hello Danny,
 
  i didn't send it twice because i wanted more help or faster help.
  i sent it twice because i was having problem with email and i didn't
 think the message went out.
  i check the list server and it wasn't there.
  i was obviously mistaken and i apologize.
 
 OK, apology accepted, but look below and check my message, I attached
a
 fixed example that should help you out and gave a few explanatory
 comments. (I have the habit of placing quotes inline with my reply)


Hello Jean-Sebastien,

thanks for the insight into OSG.
i'm looking through the fixed example now.

thanks for the help.

Danny
Classification:  UNCLASSIFIED 
Caveats: NONE

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


Re: [osg-users] any help would be appreciated - updating a groupofcameras (UNCLASSIFIED)

2009-04-15 Thread Jean-Sébastien Guay

Hello Danny,


thanks for the insight into OSG.
i'm looking through the fixed example now.

thanks for the help.


My pleasure.

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


Re: [osg-users] GPU Feedback

2009-04-15 Thread Ed
Evidently I didn't look hard enough... I found what I was looking for: 
The NVPerfKit counters.  
http://developer.nvidia.com/object/nvperfkit_counters.html.  Do the 
stats you refer to come from these counters or this type of feedback 
mechanism?  i.e. low level counters inside the hardware and driver?


Ed


Tomlinson, Gordon wrote:

Run osgviewer with you favorite models and cycle through the stats
options ( the 's' key ) you will see some GPU stats 



Gordon
Product Manager 3d
__
Gordon Tomlinson
Email  : gtomlinson @ overwatch.textron.com
__


-Original Message-
From: osg-users-boun...@lists.openscenegraph.org
[mailto:osg-users-boun...@lists.openscenegraph.org] On Behalf Of Ed
Sent: Wednesday, April 15, 2009 11:02 AM
To: osg-users@lists.openscenegraph.org
Subject: [osg-users] GPU Feedback

Does OSG provide in mechanism for retrieving any metrics from the GPU?  
Seems like I read a few months ago on the nvidia dev site that certain
drivers allowed for the retrieval of GPU performance metrics, but I 
can't find that information now.   Anyone know what I am referring to?  
Or if I am hallucinating?


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

  


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


Re: [osg-users] any help would be appreciated -updatingagroupofcameras (UNCLASSIFIED)

2009-04-15 Thread Paul Martz
Hi Danny -- On the assumption that your code is supposed to change the text,
I put a breakpoint at each call to setText in your app. I saw several calls
initially, but once the app started rendering, none of the breakpoints were
hit after that point. So, it seems J-S's advice is sound: The reason you're
not updating the text is because, well, you're not updating the text. :-) My
advice would be to add a call to setText() at the spot in the code where you
want to change its value.

Paul Martz
Skew Matrix Software LLC
http://www.skew-matrix.com
+1 303 859 9466

-Original Message-
From: osg-users-boun...@lists.openscenegraph.org
[mailto:osg-users-boun...@lists.openscenegraph.org] On Behalf Of Konkle,
Daniel T AMRDEC/Dynetics
Sent: Wednesday, April 15, 2009 9:05 AM
To: OpenSceneGraph Users
Subject: Re: [osg-users] any help would be appreciated
-updatingagroupofcameras (UNCLASSIFIED)

Classification:  UNCLASSIFIED
Caveats: NONE

reproducer code without boost.

 -Original Message-
 From: osg-users-boun...@lists.openscenegraph.org [mailto:osg-users- 
 boun...@lists.openscenegraph.org] On Behalf Of Paul Martz
 Sent: Wednesday, April 15, 2009 9:52 AM
 To: 'OpenSceneGraph Users'
 Subject: Re: [osg-users] any help would be appreciated - 
 updatingagroupofcameras (UNCLASSIFIED)
 
 Hi Danny -- Can you create a reproducer code that doesn't use Boost?
 
 Paul Martz
 Skew Matrix Software LLC
 http://www.skew-matrix.com
 +1 303 859 9466
 
 -Original Message-
 From: osg-users-boun...@lists.openscenegraph.org
 [mailto:osg-users-boun...@lists.openscenegraph.org] On Behalf Of 
 Konkle, Daniel T AMRDEC/Dynetics
 Sent: Wednesday, April 15, 2009 8:04 AM
 To: OpenSceneGraph Users
 Subject: Re: [osg-users] any help would be appreciated - updating 
 agroupofcameras (UNCLASSIFIED)
 
 Classification:  UNCLASSIFIED
 Caveats: NONE
 
 
 So from helpful comments, I believe I know what I'm doing wrong.
 I am creating a group and adding cameras to the group.
 in the cameras I have various drawables that I'd like to update with
my
 program.
 
 i can't get the camera's children to update and can't find an example 
 that works.
 
 for an example of what i'm trying to do, i took the osghud example and 
 created a few geometries on it.
 
 i added a callback that should change a scale factor for the triangles 
 that i'm adding and update the text in one of the screens.
 
 i tried to versions.  one that had the callback on the camera and one 
 that has the callback on one of the geodes.
 
 I appreciate any help anyone might be able to give.
 
 Danny
 
  -Original Message-
  From: osg-users-boun...@lists.openscenegraph.org [mailto:osg-users- 
  boun...@lists.openscenegraph.org] On Behalf Of Paul Martz
  Sent: Tuesday, April 14, 2009 12:30 PM
  To: 'OpenSceneGraph Users'
  Subject: Re: [osg-users] any help would be appreciated - updating a 
  groupofcameras (UNCLASSIFIED)
 
  Hi Danny -- There really isn't much info to go on here. You don't 
  describe the mechanism that is doing the drawing. Cameras don't 
  draw, they
 only
  set
  the matrices.
 
  Assuming you are changing a Drawable in your scene graph... One
thing
  to
  check would be to make sure that you have setUseDisplayLists( false
 ).
  You
  don't want to use display lists for dynamic geometry.
 
  If your code is too large to debug, then write a small piece of code
 to
  reproduce the problem outside of your larger app, making it as small 
  and simple as possible. This will increase the odds that someone on 
  the list will take the time to look at it.
 
  Paul Martz
  Skew Matrix Software LLC
  http://www.skew-matrix.com
  +1 303 859 9466
 
  -Original Message-
  From: osg-users-boun...@lists.openscenegraph.org
  [mailto:osg-users-boun...@lists.openscenegraph.org] On Behalf Of 
  Konkle, Daniel T AMRDEC/Dynetics
  Sent: Tuesday, April 14, 2009 9:32 AM
  To: OpenSceneGraph Users
  Subject: [osg-users] any help would be appreciated - updating a
group
  ofcameras (UNCLASSIFIED)
 
  Classification:  UNCLASSIFIED
  Caveats: NONE
 
  I am new to OSG and I am stuck and need help/insight.
 
  I'm created a Heads up display by extending the group class.
 
  My Hud is an osg::Group and has several cameras in it.
 
  The Hud displays fine.
 
  The Hud class has several variables that control how information is 
  displayed such as the heading.
 
  I've written a callback and attached it to my Hud.
 
  After attaching my Hud to my scene, I want to the callback for the
 Hud
  to
  change its variables but the cameras in my Hud don't use the updated 
  variables to redraw themselves.
 
  I've used osg::notify to show that the callback is getting executed
 and
  to
  print out the value of the heading variable I am changing.
 
  I realize I'm not showing any code only because there is so much of
 it.
 
  Can anyone give me an idea of where to look to figure out why all
the
  children in my HUD class aren't updating?
 
  My HUD (an osg::Group) class 

Re: [osg-users] Problem of points showing

2009-04-15 Thread Lingyun Yu
no, 2G is avaible I mean

On Wed, Apr 15, 2009 at 5:43 PM, Lingyun Yu lingyun.yu...@gmail.com wrote:

 Thank you very much, Ismail and Martin,

 I have 3G memory installed. and 1.02G is avaible, I use windows vista. and
 I didn't use file page file/swap.

 I will read carefully about both of you suggested. If you have some source
 can be read for that, please tell me.

 Yun



 On Wed, Apr 15, 2009 at 5:10 PM, Martin Beckett m...@mgbeckett.com wrote:

 vector typically doubles the size of memory it reserves when it needs more
 space. This is because every time it allocates new memory it must move the
 contents of the existing memory - it's slow to copy all the existing
 elements and so it makes sense to only increase as few times as possible
 (see http://www.ddj.com/cpp/184401375 for a discussion).
 Unfortunately this isn't a good stratergy when you are almost out of
 memory.

 Another problem is that the memory must be contiguous (ie in one block),
 so if you frequently allocate and delete memory there might not be a single
 free block large enough - even if you have enough overall memory.

 There is also a little 'trick' to reduce a vector back down to the minimum
 required memory - see http://www.gotw.ca/gotw/054.htm

 Code:
 vectorstuff( c ).swap( c );



 (note - can someone confirm the swap() trick works with ref counting?)

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





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




 --
 Cheers,
 Yun




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


[osg-users] Callbacks - Automatic assignment

2009-04-15 Thread Appolloni, Thomas
I have a very dynamic and large data set that is made up of several
levels of PagedLODs so nodes are being continually loaded/unloaded
to/from memory. However, I would also like to apply callbacks to the
nodes upon loading so that they might be dynamically modified based upon
user preferences before they're rendered. I'd prefer not to place a
callback at the root and have it continually visit all the children
looking for those nodes without any callbacks.
 
The question is: 

Is there any way to define a callback and have the OSG pipeline
automatically attach it onto the root node of all newly loaded files (in
DatabasePager or the methods that call it) as they are loaded?

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


Re: [osg-users] Callbacks - Automatic assignment

2009-04-15 Thread Thrall, Bryan
Appolloni, Thomas wrote on Wednesday, April 15, 2009 1:59 PM:

 I have a very dynamic and large data set that is made up of several
 levels of PagedLODs so nodes are being continually loaded/unloaded
 to/from memory. However, I would also like to apply callbacks to the
 nodes upon loading so that they might be dynamically modified based
upon
 user preferences before they're rendered. I'd prefer not to place a
 callback at the root and have it continually visit all the children
 looking for those nodes without any callbacks.
 
 The question is:
 
 Is there any way to define a callback and have the OSG pipeline
 automatically attach it onto the root node of all newly loaded files
(in
 DatabasePager or the methods that call it) as they are loaded?

You can add a ReadFileCallback to attach the callback when the files are
loaded; see osgDB::Registry.

-- 
Bryan Thrall
FlightSafety International
bryan.thr...@flightsafety.com
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


[osg-users] osgTerrain

2009-04-15 Thread GuiYe
 
  Hello,robert!
  Can you provide some examples about how to use the library of osgTerrain 
except osgTerrain! The library is so complex that I don't know how to use it to 
render terrain data! Can you provide some documents about the library! On the 
other hand , I hope that the example of osgTerrain with its' own data to show 
the screenshot!Can you give me the data to run the example?
Thank you! Good Luck!
  
  
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] [vpb] Building a geocentric database with heigh data

2009-04-15 Thread Tueller, Shayne R Civ USAF AFMC 519 SMXS/MXDEC
Perhaps you can provide more info on what osgdem reports when it crashes.

Try running gdalinfo on your source files to see what format they're
using...

-Shayne

-Original Message-
From: osg-users-boun...@lists.openscenegraph.org
[mailto:osg-users-boun...@lists.openscenegraph.org] On Behalf Of Mauricio
Sent: Tuesday, April 14, 2009 5:49 PM
To: osg-users@lists.openscenegraph.org
Subject: [osg-users] [vpb] Building a geocentric database with heigh data

Hi,

I tryed to build a geocentric database with heigh data from several input
images but I did not succeed.

I issued the following command line:

osgdem --geocentric --whole-globe -t texture_2048.tif -d height_2048.tif -l
4 -v 0.1 -o earth.ive

This command causes osgdem to crash.

I used the following data, among others, in tiff format:

heigh field (fliped vertically!?):
http://picasaweb.google.com.br/mauricio.hofmam/Earth#5324691195386557506

texture:
http://picasaweb.google.com.br/mauricio.hofmam/Earth#5324691052559797922

The following command works fine (without heigh field):

osgdem --geocentric --whole-globe -t texture_2048.tif -l 4 -v 0.01 -o
earth.ive

The following command also works fine (with heigh field but not geocentric):

osgdem -t texture_2048.tif -d height_2048.tif -l 4 -v 0.01 -o earth.ive

Am I missing someting?

I am using the lastest versions of OpenSceneGraph (2.8.0) and VPB (0.9.10).
... 

Thank you.

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





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


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


Re: [osg-users] Problem of points showing

2009-04-15 Thread Ismail Pazarbasi
Hi Martin,

ISO 14882:2003 (the C++03) standard doesn't clearly specify how
containers must swap its contents. It's clearly specified in C++0x
drafts. Most implementations simply exchange internal block (pointers)
and capacity, if allocators are the same. Otherwise, each element will
be copied.

ref_ptr can be easily used in either case (latter case being the
inefficient/different allocator case), because it satisfies the
requirements (from C++03):
25.2.2 Swap [lib.alg.swap]
templateclass T void swap(T a, T b);
1 Requires: Type T is CopyConstructible (20.1.3) and Assignable (23.1).
2 Effects: Exchanges values stored in two locations.

ref_ptrT is CopyConstructible and Assignable; its copies are equivalent.

Ismail

On Wed, Apr 15, 2009 at 5:10 PM, Martin Beckett m...@mgbeckett.com wrote:
 vector typically doubles the size of memory it reserves when it needs more 
 space. This is because every time it allocates new memory it must move the 
 contents of the existing memory - it's slow to copy all the existing elements 
 and so it makes sense to only increase as few times as possible (see 
 http://www.ddj.com/cpp/184401375 for a discussion).
 Unfortunately this isn't a good stratergy when you are almost out of memory.

 Another problem is that the memory must be contiguous (ie in one block), so 
 if you frequently allocate and delete memory there might not be a single free 
 block large enough - even if you have enough overall memory.

 There is also a little 'trick' to reduce a vector back down to the minimum 
 required memory - see http://www.gotw.ca/gotw/054.htm

 Code:
 vectorstuff( c ).swap( c );



 (note - can someone confirm the swap() trick works with ref counting?)

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





 ___
 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] OverlayNode question

2009-04-15 Thread paul1492

Can somebody give me a explanation of how an OverlayNode is used?

I need to render some geometry stuff (i.e. geopolitical, grid lines) on top of 
terrain elevation geometry and currently, I'm rendering to a texture and laying 
this texture on my terrain polygons. 

Should I be using an Overlay node for this? If so, I'm confused by how the 
OverlayNode should be configured.

Thanks,
Paul P.


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


Re: [osg-users] Dinamic Line Drawing

2009-04-15 Thread Allen Saucier
boooch (and anyone who might have suggestions...),

I really appreciate the code you posted but I can't get it to work as you did.  
The ONLY way I was able to get the lines drawn was to RE-set the vertexArray  
of  my geometry.  Like so: m_ogeomTrailGeometry-setVertexArray(vad);

However, this is an extremely expensive operation.  Do you have any suggestions 
that I might try to lower my re-draw expense?


Here's my code snippet:


class class1
{
public:
osg::ref_ptrosg::DrawArrays m_podreTrailDrawElements;
osg::ref_ptrosg::Vec3Array m_ov3aLineVerticesData;
osg::ref_ptrosg::Geometry  m_ogeomTrailGeometry;
osg::ref_ptrosg::Geode m_ogeoTrailGeode;
osg::Vec3d   m_ov3dPrevPos; 

}

class1::method_1(double xInitial, double yInitial, double zInitial)
{
  // initialize previous to current point/position sent in
  m_ov3dPrevPos.set(xInitial, yInitial, zInitial);
  // curr pos
  osg::Vec3d ov3d(xInitial, yInitial, zInitial);

  m_podreTrailDrawElements= new osg::DrawArrays(osg::PrimitiveSet::LINE_STRIP);
  m_ov3aLineVerticesData  = new osg::Vec3Array();  
  m_ogeomTrailGeometry= new osg::Geometry();
  m_ogeoTrailGeode= new osg::Geode;

  m_ov3aLineVerticesData-push_back(m_ov3dPrevPos); // prev pos
  m_ov3aLineVerticesData-push_back(ov3d);  // curr pos

  m_podreTrailDrawElements-setFirst(0);
  m_podreTrailDrawElements-setCount(m_ov3aLineVerticesData-size());
  
  
  m_ogeomTrailGeometry-addPrimitiveSet(m_podreTrailDrawElements.get());
  m_ogeomTrailGeometry-setVertexArray(m_ov3aLineVerticesData.get());// add 
line segs to geometry
  m_ogeoTrailGeode-addDrawable(m_ogeomTrailGeometry.get());

  
  // ADD ONLY ONCE to the Node Scene
  m_no3vViewer-m_iAddElementToScene(m_ogeoTrailGeode.get());
} // method_1()


class1::method_updateLine(double x, double y, double z)
{
  osg::Vec3Array *vad = dynamic_castosg::Vec3Array 
*(m_ogeomTrailGeometry-getVertexArray());
  vad-push_back(osg::Vec3(x,y,z));
  
  osg::DrawArrays *drArrys = dynamic_castosg::DrawArrays 
*(m_ogeomTrailGeometry-getPrimitiveSet(0));
  drArrys-setFirst(0);
  drArrys-setCount(vad-size());
  //drArrys-dirty();
  //std::cout vad-size()== vad-size()  std::endl;
  m_ogeomTrailGeometry-setVertexArray(vad);
}



Allen

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





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


Re: [osg-users] Dinamic Line Drawing

2009-04-15 Thread Paul Martz
Your geometry is probably using display lists (on by default).
setVertexArray will dirty and rebuild them. A more efficient solution would
be to disable display lists. If you do that, you should be able to change
individual elements of your array and not have to set the entire array.

Paul Martz
Skew Matrix Software LLC
http://www.skew-matrix.com
+1 303 859 9466

-Original Message-
From: osg-users-boun...@lists.openscenegraph.org
[mailto:osg-users-boun...@lists.openscenegraph.org] On Behalf Of Allen
Saucier
Sent: Wednesday, April 15, 2009 3:26 PM
To: osg-users@lists.openscenegraph.org
Subject: Re: [osg-users] Dinamic Line Drawing

boooch (and anyone who might have suggestions...),

I really appreciate the code you posted but I can't get it to work as you
did.  The ONLY way I was able to get the lines drawn was to RE-set the
vertexArray  of  my geometry.  Like so:
m_ogeomTrailGeometry-setVertexArray(vad);

However, this is an extremely expensive operation.  Do you have any
suggestions that I might try to lower my re-draw expense?


Here's my code snippet:


class class1
{
public:
osg::ref_ptrosg::DrawArrays m_podreTrailDrawElements;
osg::ref_ptrosg::Vec3Array m_ov3aLineVerticesData;
osg::ref_ptrosg::Geometry  m_ogeomTrailGeometry;
osg::ref_ptrosg::Geode m_ogeoTrailGeode;
osg::Vec3d   m_ov3dPrevPos; 

}

class1::method_1(double xInitial, double yInitial, double zInitial) {
  // initialize previous to current point/position sent in
  m_ov3dPrevPos.set(xInitial, yInitial, zInitial);
  // curr pos
  osg::Vec3d ov3d(xInitial, yInitial, zInitial);

  m_podreTrailDrawElements= new
osg::DrawArrays(osg::PrimitiveSet::LINE_STRIP);
  m_ov3aLineVerticesData  = new osg::Vec3Array();  
  m_ogeomTrailGeometry= new osg::Geometry();
  m_ogeoTrailGeode= new osg::Geode;

  m_ov3aLineVerticesData-push_back(m_ov3dPrevPos); // prev pos
  m_ov3aLineVerticesData-push_back(ov3d);  // curr pos

  m_podreTrailDrawElements-setFirst(0);
  m_podreTrailDrawElements-setCount(m_ov3aLineVerticesData-size());
  
  
  m_ogeomTrailGeometry-addPrimitiveSet(m_podreTrailDrawElements.get());
  m_ogeomTrailGeometry-setVertexArray(m_ov3aLineVerticesData.get());// add
line segs to geometry
  m_ogeoTrailGeode-addDrawable(m_ogeomTrailGeometry.get());

  
  // ADD ONLY ONCE to the Node Scene
  m_no3vViewer-m_iAddElementToScene(m_ogeoTrailGeode.get());
} // method_1()


class1::method_updateLine(double x, double y, double z) {
  osg::Vec3Array *vad = dynamic_castosg::Vec3Array
*(m_ogeomTrailGeometry-getVertexArray());
  vad-push_back(osg::Vec3(x,y,z));
  
  osg::DrawArrays *drArrys = dynamic_castosg::DrawArrays
*(m_ogeomTrailGeometry-getPrimitiveSet(0));
  drArrys-setFirst(0);
  drArrys-setCount(vad-size());
  //drArrys-dirty();
  //std::cout vad-size()== vad-size()  std::endl;
  m_ogeomTrailGeometry-setVertexArray(vad);
}



Allen

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





___
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] Dinamic Line Drawing

2009-04-15 Thread Allen Saucier
Thanks Paul!  I didn't understand that in the previous postings.  Would you 
mind telling me how to disable the display listings for this geometry?


** PAUL wrote ***
Your geometry is probably using display lists (on by default).
setVertexArray will dirty and rebuild them. A more efficient solution would
be to disable display lists. If you do that, you should be able to change
individual elements of your array and not have to set the entire array.

Paul Martz
Skew Matrix Software LLC
http://www.skew-matrix.com
+1 303 859 9466



Allen

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





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


Re: [osg-users] terrain database popping...

2009-04-15 Thread Tueller, Shayne R Civ USAF AFMC 519 SMXS/MXDEC
I think it would be good to fold libmini (or something equivalent) into OSG.
That way you can use the databases built with VPB. I don't know much about
VTP but using VPB databases are nice...

-Shayne

-Original Message-
From: osg-users-boun...@lists.openscenegraph.org
[mailto:osg-users-boun...@lists.openscenegraph.org] On Behalf Of Chris
'Xenon' Hanson
Sent: Wednesday, April 15, 2009 9:09 AM
To: OpenSceneGraph Users
Subject: Re: [osg-users] terrain database popping...

Raymond de Vries wrote:
 geosimulation app on, depending on your requirements. You can try to
 stick libmini into
 plain OSG as well, but VTP already has done the integration for you.
 I think this is not entirely true. I believe they have integrated it
 into VTP but not with OSG. There was a VTP thread about this some time
ago.

  Right. I phrased that poorly. Libmini is integrated into VTP, but not into
OSG. Libmini
is a purely OpenGL piece of code, and would require integration into OSG.
Most people
facing this prospect just go with VTP to get the whole enchilada.

 good luck
 Raymond

-- 
Chris 'Xenon' Hanson, omo sanza lettere  Xenon
AlphaPixel.com
PixelSense Landsat processing now available!
http://www.alphapixel.com/demos/
There is no Truth. There is only Perception. To Perceive is to Exist. -
Xen
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


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


Re: [osg-users] [vpb] Building a geocentric database with heigh data

2009-04-15 Thread Mauricio
The source data are ordinary tiff files. I tried several. 
Can you point any sample image which you know that works?

See attached screen capture of osgdem output issued before crash.

Thank you.

Mauricio Hofmam

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



attachment: osgdem_error.jpg___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] Dinamic Line Drawing

2009-04-15 Thread Paul Martz
setUseDisplayLists( false ).

Paul Martz
Skew Matrix Software LLC
http://www.skew-matrix.com
+1 303 859 9466

-Original Message-
From: osg-users-boun...@lists.openscenegraph.org
[mailto:osg-users-boun...@lists.openscenegraph.org] On Behalf Of Allen
Saucier
Sent: Wednesday, April 15, 2009 3:44 PM
To: osg-users@lists.openscenegraph.org
Subject: Re: [osg-users] Dinamic Line Drawing

Thanks Paul!  I didn't understand that in the previous postings.  Would you
mind telling me how to disable the display listings for this geometry?


** PAUL wrote ***
Your geometry is probably using display lists (on by default).
setVertexArray will dirty and rebuild them. A more efficient solution would
be to disable display lists. If you do that, you should be able to change
individual elements of your array and not have to set the entire array.

Paul Martz
Skew Matrix Software LLC
http://www.skew-matrix.com
+1 303 859 9466



Allen

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





___
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] vertex data in byte precision

2009-04-15 Thread Luigi Calori

Probably a newbie question:

Is it possible to store vertex data in byte array like Vec3bArray ?

I' ve tried but it seem not allowed: I obtain crash when call setVertexArray
Is it something dependent on driver?

I attach two sample files, short working, byte hanging

Thanks
   Luigi
Group {
  UniqueID Group_0
  nodeMask 0x
  cullingActive TRUE
  num_children 2
  ClearNode {
nodeMask 0x
cullingActive FALSE
StateSet {
  DataVariance STATIC
  rendering_hint DEFAULT_BIN
  renderBinMode USE
  binNumber -1
  binName RenderBin
}
requiresClear TRUE
clearColor 0 0 0 1
clearMask 16640
  }
  Geode {
nodeMask 0x
cullingActive TRUE
StateSet {
  DataVariance STATIC
  rendering_hint DEFAULT_BIN
  renderBinMode INHERIT
  GL_LIGHTING OFF
  GL_DEPTH_TEST OFF
  GL_BLEND ON
  0x8861 ON
  Point {
size 20
fade_threshold_size  1
distance_attenuation  1 0 0
  }
  BlendFunc {
source SRC_ALPHA
destination DST_ALPHA
  }
  textureUnit 0 {
GL_TEXTURE_2D ON
Texture2D {
  file Images/particle.rgb
  wrap_s CLAMP
  wrap_t CLAMP
  wrap_r CLAMP
  min_filter LINEAR_MIPMAP_LINEAR
  mag_filter LINEAR
  maxAnisotropy 1
  borderColor 0 0 0 0
  borderWidth 0
  useHardwareMipMapGeneration TRUE
  unRefImageDataAfterApply FALSE
  internalFormatMode USE_IMAGE_DATA_FORMAT
  resizeNonPowerOfTwo TRUE
}
PointSprite {
  coordOriginMode UPPER_LEFT
}
  }
}
num_drawables 1
Geometry {
  DataVariance STATIC
  useDisplayList TRUE
  useVertexBufferObjects FALSE
  PrimitiveSets 1
  {
DrawArrays POINTS 0 128
  }
  VertexArray Vec3sArray 128
  {
0 11 2 3 16 0
7 18 -8 15 14 9
16 10 -10 4 0 -3
5 4 -8 16 8 -11
3 9 2 7 9 2
7 15 -8 4 4 2
20 19 7 5 2 4
24 22 0 5 -1 -4
22 9 8 10 11 8
17 14 5 0 0 -7
12 10 -7 8 -7 6
10 14 4 6 4 3
14 14 0 10 -1 6
18 14 3 8 -4 1
14 20 0 0 -8 3
11 34 -4 13 -7 1
9 16 -4 13 -5 5
1 34 0 15 -10 -4
15 30 3 6 0 0
-1 21 -3 21 -8 0
7 26 1 13 -6 2
4 27 3 12 -10 -4
-1 31 4 20 -15 4
-3 24 3 23 -9 -1
-7 22 2 36 -10 0
-15 30 0 35 -7 3
-20 34 0 32 -13 -2
-6 25 2 36 -8 -3
-23 25 -1 31 8 -1
-24 22 0 43 5 1
-23 8 2 28 -4 2
-26 5 -2 41 -2 0
-16 13 0 42 1 -2
-18 2 0 40 7 0
-20 -3 1 42 25 2
-29 -3 0 36 29 3
-30 -1 2 34 22 -2
-14 -11 0 36 32 -1
-18 -8 0 40 30 0
-12 -7 0 42 38 0
-24 -13 -1 38 45 -1
-13 -17 0 37 38 -2
-8 -22 1 35 48 -2
-8 -19 1 38 49 -2
-3 -20 -1 22 51 -1
-10 -24 -1 29 57 0
-7 -42 0 21 60 0
3 -39 -1 13 55 0
14 -40 1 16 66 1
10 -28 1 -2 49 0
21 -29 0 -8 65 0
16 -37 2 -9 53 0
32 -44 0 -9 54 1
34 -38 0 -10 56 0
29 -29 1 -27 56 0
49 -31 0 -26 57 0
57 -26 -1 -35 46 1
62 -23 -2 -42 42 0
49 -14 0 -30 43 1
51 -24 -1 -36 39 -1
57 -10 0 -47 28 0
73 -1 1 -46 29 1
62 0 -1 -51 16 1
62 2 0 -50 12 -1
  }
  ColorBinding PER_VERTEX
  ColorArray Vec4Array 128
  {
1 1 0 0.5
1 1 0 0.5
0.984375 0.984375 0.015625 0.507813
0.984375 0.984375 0.015625 0.507813
0.96875 0.96875 0.03125 0.515625
0.96875 0.96875 0.03125 0.515625
0.953125 0.953125 0.046875 0.523438
0.953125 0.953125 0.046875 0.523438
0.9375 0.9375 0.0625 0.53125
0.9375 0.9375 0.0625 0.53125
0.921875 0.921875 0.078125 0.539063
0.921875 0.921875 0.078125 0.539063
0.90625 0.90625 0.09375 0.546875
0.90625 0.90625 0.09375 0.546875
0.890625 0.890625 0.109375 0.554688
0.890625 0.890625 0.109375 0.554688
0.875 0.875 0.125 0.5625
0.875 0.875 0.125 0.5625
0.859375 0.859375 0.140625 0.570313
0.859375 0.859375 0.140625 0.570313
0.84375 0.84375 0.15625 0.578125
0.84375 0.84375 0.15625 0.578125
0.828125 0.828125 0.171875 0.585938
0.828125 0.828125 0.171875 0.585938
0.8125 0.8125 0.1875 0.59375
0.8125 0.8125 0.1875 0.59375
0.796875 0.796875 0.203125 0.601563
0.796875 0.796875 0.203125 0.601563
0.78125 0.78125 0.21875 0.609375
0.78125 0.78125 0.21875 0.609375
0.765625 0.765625 0.234375 0.617188
0.765625 0.765625 0.234375 0.617188
0.75 0.75 0.25 0.625
0.75 0.75 0.25 0.625
0.734375 0.734375 0.265625 0.632813
0.734375 0.734375 0.265625 

[osg-users] Problem with CompositeViewer in osg2.8 static libs

2009-04-15 Thread heishuijing_2000
hello everyone,
Recently,i had a problem with Osg 2.8. I have write a very simple program 
to test a bug with osg 2.8 static libs and VS2008.The test program is below:

#include osgViewer/CompositeViewer
#include osgViewer/GraphicsWindow
#include osg/ref_ptr
USE_GRAPHICSWINDOW();
int main(int argc, char* argv[])
   {
  osg::ref_ptrosgViewer::CompositeViewer pViewer = new 
osgViewer::CompositeViewer();
  return;
   }
   I use USE_GRAPHICSWINDOW() becasue my Osg2.8's libs is static libs.
   As you see, this is just a simple test program,but this doesn't work with 
VS2008 and osg2.8.I have found that the exception happened when the program 
exited,the stack when exception happend is below:
   static void __cdecl doexit (int code,int quick,int retcaller) 
Crt0.c
   void __cdecl exit (int code)  
Crt0dat.c
   int__tmainCRTStartup(void)
Crt0.c
 
Anyone can help me with this problem? Thank you .
 




网易邮箱,中国第一大电子邮件服务商___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] GPU Feedback

2009-04-15 Thread Jason Daly

Ed wrote:
Evidently I didn't look hard enough... I found what I was looking for: 
The NVPerfKit counters.  
http://developer.nvidia.com/object/nvperfkit_counters.html.  Do the 
stats you refer to come from these counters or this type of feedback 
mechanism?  i.e. low level counters inside the hardware and driver?
  


Hi, Ed,

OSG uses the EXT_timer_query OpenGL extension to measure the GPU time 
(all of the other stats are measured on the CPU).  The EXT_timer_query 
extension works with any Nvidia driver, whereas the NVPerfKit counters 
require Nvidia's instrumented drivers, which most users won't be using.


--J

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


[osg-users] Can not create OpenGL texture in OSG

2009-04-15 Thread su hu
Hi all,

When I tried to create a texture by glGenTextures in OSG, I met a problem.
glGenTextures can not create a texture object. Zero is returned and no
texture is created. Source codes are as follow:

while(!Viewer.done())
{
  ...
  if(Render)
  {
 
  Viewer.frame();
   }
   else if(LoadTexture)
   {
GLuintTexID = 0;
glGenTextures(1, TexID );

   }

   
}

Version of my osg is 2.8 for vs2005. OS is Win XP professional.  Graphics
card is ATI X1600.

Thanks for your help!

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


Re: [osg-users] Can not create OpenGL texture in OSG

2009-04-15 Thread su hu
After glGenTextures, I use glGetError to get the error. The result is :
GL_INVALID_OPERATION.

OpenGL manual (
http://www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/gentextures.html)gives
the reason as:

*GL_INVALID_OPERATION* is generated if *glGenTextures* is
  executed between the execution of *glBegin* and the
  corresponding execution of *glEnd*.


But I dont know how to do. Thanks for your help.


Su Hu

2009/4/16 su hu ttts...@gmail.com

 Hi all,

 When I tried to create a texture by glGenTextures in OSG, I met a problem.
 glGenTextures can not create a texture object. Zero is returned and no
 texture is created. Source codes are as follow:

 while(!Viewer.done())
 {
   ...
   if(Render)
   {
  
   Viewer.frame();
}
else if(LoadTexture)
{
 GLuintTexID = 0;
 glGenTextures(1, TexID );
 
}


 }

 Version of my osg is 2.8 for vs2005. OS is Win XP professional.  Graphics
 card is ATI X1600.

 Thanks for your help!

 Su Hu


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