[osg-users] virtual ~TemplateArray() is protected

2014-08-08 Thread Joe Doob
Hi,

I gave myself a headache today chasing bugs because I had a class which had an 
osg::ref_ptr as a (private) member. gcc threw compile errors 
referring to the destructor for osg::TemplateArray being protected, which it 
claimed was being called by my class's (empty) destructor. My class did not 
inherit any OSG classes.

Have I made a dumb mistake, stumbled upon something unintended, or what? I am 
using OSG 3.0.1. 

Thank you kindly for setting me straight,
stathibus

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





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


[osg-users] crashing with paged LODs, line intersector on computeBound

2013-05-15 Thread Joe Doob
Hi,

I wonder if anyone can offer some insight on why I may be experiencing these 
random crashes. 

Essentially I have many line intersection visitors following a node which is 
moving through the scene and performing line intersections on terrain, which is 
a pagedLOD database of proxynodes.

This is done in a multithreaded fashion, i.e. there are many threads each with 
a lineSegmentIntersector and intersectionVisitor of its own. By and large, it 
works great, but on very rare and seemingly random occasions the application 
crashes with a segmentation fault.

It traces to the accept call, where I am calling the terrain's group node's 
accept function on an intersection visitor.

A human-friendly version of the backtrace is as follows:
 

Code:

osg::Group::computeBound at Group.cpp
 osg::LOD::computeBound at LOD.cpp
getBound at Node.cpp
isCullingActive at Node.cpp
enter at LineSegmentIntersector.cpp
enter at IntersectionVisitor.cpp
accept at Group.cpp
traverse at Group.cpp
apply at IntersectionVisitor.cpp
accept at Group.cpp




The code that performs the actual intersection looks like this:


Code:

lineSegmentIntersector->setStart(start);
lineSegmentIntersector->setEnd(end);
intersectionVisitor->reset();
root->accept(*intersectionVisitor);




It's possible I am doing something evil with this multithreading setup that I 
am unaware of (please tell me!), but since everything works 99.9% of the time, 
I suspect there is something more subtle going on. 

I am running OSG 3.0.1 in C++.

Thanks,
Stathibus

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





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


[osg-users] Dynamic / incremental mesh generation or triangulation

2013-02-20 Thread Joe Doob
Hi,

I'm writing an application to render a mesh generated from a stream of 3d 
points, so that the mesh is updated in realtime to include points as they are 
added.

It doesn't necessarily need to be a delaunay triangulation, but that seemed 
like a reasonable place to start. The osg::DelaunayTriangulator makes a nice 
mesh but it does not seem to be built for dynamic updating. 

Does anyone have a suggestion on how to attack this?

I know the bounds of the mesh and the points will be randomly distributed 
within those bounds. 

Ultimately I am also going to need the ability to color sections of the mesh.

Thanks!
S

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





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


[osg-users] copying contents of osg::Group to rendered Group

2012-10-19 Thread Joe Doob
Hi all.

I have two osg::Groups, one which is being rendered in my viewer and another 
which is used as a buffer that collects geodes as they are created.

Periodically, I want to flush the contents of my root group and copy over all 
the contents in the buffer.

I have tried several methods of copying the contents of the buffer group to the 
root group, but I never actually see the new contents appear in my view. 
Specifically I have tried looping over all children in the buffer and calling 
root->addChild on each of these. I have also tried assigning the root to a deep 
copy clone of the buffer. In both cases I can verify that the root contains the 
data in the buffer using getNumChildren(), but they never show up.

Does anyone know why this would be? Or, am I just going about this the wrong 
way?

Thanks,
S

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





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


Re: [osg-users] getting RGB of texture in *.ive file

2012-10-02 Thread Joe Doob
Thanks for the advice!

I'm getting closer but not quite there yet. 

I found that my drawable in this test case has exactly one parent, and his 
parent has a state set. I am able to get the image attached to the texture on 
this state set without running across any null pointers, and write the image to 
a file for verification...


Code:

if(drawable->getParent(0)->getStateSet())
{
state_set = drawable->getParent(0)->getStateSet();
osg::Texture * texture = state_set->getTextureAttribute(0, 
osg::StateAttribute::TEXTURE)->asTexture();
if(texture->getImage(osg::Material::FRONT))
{
textureImage = texture->getImage(osg::Material::FRONT);
osgDB::writeImageFile(*textureImage, "image.bmp");
}




Unfortunately, the image produced is pure noise. Also, I've found that using 
the getColor method on the image always returns a Vec4 with values (1, 1, 1, 
1)... so something is clearly wrong.

I should have no problem accessing the textures of an *.ive file directly in 
this way, right?

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





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


[osg-users] getting RGB of texture in *.ive file

2012-10-01 Thread Joe Doob
Hello,

I have a large terrain map which I load from an *.osg file containing a list of 
ProxyNode objects containing *.ive files, using osgDB::readNodeFile.

My end goal is to get RGB of points on the texture map found through a line 
segment intersection.

I have read through the mousePosition function in the InteractiveImageHandler 
class which shows how I would get the texture coordinates of the point 
intersected. 

>From there, I attempted to get the RGB value this way:


Code:

osg::Drawable * drawable = intersection.drawable.get();
if(drawable->getStateSet())
{
state_set = drawable->getStateSet();
osg::Texture * texture =
dynamic_cast(state_set->getTextureAttribute
(0, osg::StateAttribute::TEXTURE));

if(texture)
{
textureImage = texture->getImage(osg::Material::FRONT);
return textureImage->getColor(textureCoordinates);
}
}




This snippet produces a valid drawable, however the drawable returns a NULL 
stateset and so I can't obtain the texture object.

How can I obtain the osg::Image to get RGB in this case? Or, is there a better 
method?

Thanks-

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





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


Re: [osg-users] instanced drawing of dynamic objects

2012-07-26 Thread Joe Doob
Thanks so much. I will have a look at those examples. I don't need rotation 
capabilities, only translation, scale, and color as you said.

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





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


[osg-users] instanced drawing of dynamic objects

2012-07-26 Thread Joe Doob
Hi,

I have a scientific visualization application in which I essentially want to 
render many (hundreds of thousands) of cubes at once, of varying color and 
size. Furthermore, these cubes will change position and color every few 
seconds, and I need to position them deliberately.

Right now I am simply drawing osg::Box objects where I want them, and flushing 
the root group / reallocating from scratch on each iteration. This is a dumb 
approach and I'm looking for something more efficient.

I am not intimately familiar with openGL but it seems that instanced drawing 
might be a good fit for this problem. I've looked at the osgdrawinstanced 
example but I'm confused about how I can define the shader such that I can 
specify the transformation on a per-instance basis. 

Does anyone have a suggestion on how I could go about this, or other 
suggestions for an optimal solution?

Chris

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





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


Re: [osg-users] [osgPlugins] osgQt widget + trackball manipulator only half working

2012-06-22 Thread Joe Doob
I took another look through the osgviewerQt source and found a solution, though 
I'm not sure I understand why my extra step is necessary:

Manually initializing the projection matrix for the camera using 
setProjectionMatrixAsPerspective fixes things.


Code:

camera->setProjectionMatrixAsPerspective(30.0f, 
static_cast(traits->width)/static_cast(traits->height), 1.0f, 
1.0f );




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





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


Re: [osg-users] [osgPlugins] osgQt widget + trackball manipulator only half working

2012-06-22 Thread Joe Doob
Yes, oddly enough it works just fine.

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





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


[osg-users] [osgPlugins] osgQt widget + trackball manipulator only half working

2012-06-22 Thread Joe Doob
Hi All,

I have a simple Qt4 wrapper for my OSG 3.0 application which employs the 
trackball manipulator. The left and middle mouse button functions in the 
manipulator work as expected, but the right mouse button does not seem to do 
anything, which makes the manipulator kind of useless.

Is this a known issue or could there be some problem with the way that I'm 
implementing my viewer?

My widget class (which inherits osg::CompositeViewer) adds a view with the 
trackball manipulator like so:


Code:

QWidget * MyViewerWidget::addToViewWidget(osg::Camera* cam, osg::Group* root)
{
osgViewer::View* view = new osgViewer::View;
view->setCamera(cam);
addView(view);
view->setSceneData(root);
view->setCameraManipulator(new osgGA::TrackballManipulator);
osgQt::GraphicsWindowQt* gw =
dynamic_cast(cam->getGraphicsContext());

return gw ? gw->getGLWidget() : NULL;
}




And in the constructor for my Qt main window  I initialize an object of this 
class called viewWidget and do:


Code:

osg::Camera * cam1 = viewWidget->createCamera(0,0,100,100);
QWidget * view1 = viewWidget->addToViewWidget(cam1, root);
setGeometry(100,100,800,600);
grid->addWidget(view1, 0, 0);
viewWidget->setLayout(grid);
setCentralWidget(viewWidget);




I am running all of this on linux (Fedora 15).

Thanks for any input!

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





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