Maximilian Wurm | 18 Apr 13:02 2014
Picon
Picon

How to set up PrimitiveRestart-Mode?

Hi,

I already read through all posts, I could find for PrimitiveRestart in combination with OSG.
The PrimitiveRestart-extension is definately included since OSG Version 3.2. But there is neither a
description in the API nor an example, that explaines how to activate GL_PRIMITIVE_RESTART or how to
define the glPrimitiveRestartIndex.

Maybe someone has a clue?
Thank you!

Cheers,
Maximilian

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

Max Reimann | 18 Apr 10:33 2014
Picon

osgAnimation Ragdoll Problem

Hi,

Im trying to build a Ragdoll with Bullet and a osgAnimation skeleton.
Ive got the bullet side working and now trying to update the bones of the osg skeleton with the transforms. 

The problem is that I cant seem to get the conversion from worldspace to bone space right (every bone in
bullet is in worldspace).

I set a bone up like this :

Code:
	
osg::ref_ptr<osgAnimation::Bone> bone = new osgAnimation::Bone;
	parent->insertChild(0, bone.get());
	parent->addChild(createBoneShape(transform.getTrans(), osg::Vec4(1.0f, 1.0f, 1.0f, 1.0f)));

	 osg::ref_ptr<RagdollBoneUpdater> updater = new RagdollBoneUpdater(motionState, name);

	 bone->setUpdateCallback(updater.get());
	 bone->setMatrixInSkeletonSpace(osg::Matrix::translate(transform.getTrans()) * bone->getMatrixInSkeletonSpace());
	 bone->setName(name);

And use the updater to get the worldtransform from the btMotionstate:

Code:

class RagdollBoneUpdater : public osgAnimation::UpdateBone
{
public:
	 RagdollBoneUpdater(BoneMotionState* motionState, const std::string& name) :
(Continue reading)

Steven Powers | 17 Apr 22:06 2014
Picon

Issues with alpha blended texture overlay

Hi,

I tried to add a texture overlay that gets rendered through an orthographic projection at the top of the
scene graph. When I do so all objects in the background of the scene that have transparency are no longer visible.

What am I doing wrong?

The texture is a png with transparency applied to a quad and GL_BLEND is turned on. Objects without
transparency can still be seen.

stateset->setMode(GL_BLEND,osg::StateAttribute::ON);

Thank you!

Cheers,
Steven

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

Nick Modly | 17 Apr 07:29 2014
Picon

osgQt QWidgetImage as HUD not getting events

I have a Composite Viewer setup with multiple views/cameras, and a 2D Ortho HUD camera that I add to the root
node of my scene to render HUD elements.

One of these elements is a textured quad with a QWidgetImage. I set up the InteractiveImageHandler and gave
it to the drawable as event and cull callbacks. However, it is not handling my click presses. I think that it
is because it is a child of the HUD camera, and not of the camera that I give to the views?

How do I get events to the interactive image handler?

Code:

//HUD Camera
osg::Camera *HUDCam = new osg::Camera();
group->addChild(HUDCam);
HUDCam->setProjectionMatrix(osg::Matrix::ortho2D(0, 1280, 0, 1024));
HUDCam->setViewMatrix(osg::Matrix::identity());
HUDCam->setReferenceFrame(osg::Transform::ABSOLUTE_RF);
HUDCam->setClearMask(GL_DEPTH_BUFFER_BIT);
HUDCam->setRenderOrder(osg::Camera::POST_RENDER);
HUDCam->setAllowEventFocus(true);

//Quad
 osg::PositionAttitudeTransform *pat = new osg::PositionAttitudeTransform();
QWidget* widget = new HudWidget();
osg::ref_ptr<osgQt::QWidgetImage> widgetImage = new osgQt::QWidgetImage(widget);
widgetImage->getQGraphicsViewAdapter()->setBackgroundColor(QColor(0,0,0,0));
osg::ref_ptr<osgViewer::InteractiveImageHandler> handler = new
osgViewer::InteractiveImageHandler( widgetImage.get() );
osg::ref_ptr<osg::Texture2D> texture = new osg::Texture2D;
texture->setImage( widgetImage.get() );
(Continue reading)

Peter Bako | 16 Apr 18:53 2014
Picon

Text with border

Hello!

Does anyone have an idea, how to create osgText with border? for example white text with black border. I need
this, because I want to make screenshots of scenes with texts but the background can be any color so the
white text as I use it now, is not readable every time.

My only idea is to create two osgText::text objects, one with normal font (white), one with bold (black) and
put the black text a little bit behind the white. The problem is that the text is always facing to the camera
eye (setAutoRotateToScreen(true)), so this wouldn't work. 
If there is no other solution, I can switch this option off.

Thank you for your ideas.

Cheers,
Peter

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

Cary, Karl A. | 16 Apr 15:21 2014

Understanding Node Clone Options

As our simulation runs we can add and remove models and many times the same model repeatedly. We only load the physical model once and then clone it for each instance we need. Each model can contain matrix transforms, switches, LODs, and update callbacks that all need to be unique. I am trying to limit how much we are actually cloning now since we don’t necessarily have all of these things in every model. For example if we have a light pole that is use 100 times, we don’t even need to clone, we can just add the child directly to the scene under different matrix transforms. The problem is in understanding when I actually need to clone and what type of options I need.

 

I know I need to use the DEEP_COPY_ARRAYS when I need the actual vertices to be different, which does happen sometimes when I add a matrix that gets flattened on to the model. However, for switches, dynamic matrixTransforms, LODS, and callbacks, when do I use the different options? So far I have only gotten everything to work for those when I do a DEEP_COPY_NODES. Do I really need this, or would some subset of other options work?

 

I guess my main question is when are each of the various DEEP_COPY_ options needed?

<div>
<div class="WordSection1">
<p class="MsoNormal">As our simulation runs we can add and remove models and many times the same model repeatedly. We only load the physical model once and then clone it for each instance we need. Each model can contain matrix transforms, switches, LODs, and
 update callbacks that all need to be unique. I am trying to limit how much we are actually cloning now since we don&rsquo;t necessarily have all of these things in every model. For example if we have a light pole that is use 100 times, we don&rsquo;t even need to clone,
 we can just add the child directly to the scene under different matrix transforms. The problem is in understanding when I actually need to clone and what type of options I need.<p></p></p>
<p class="MsoNormal"><p>&nbsp;</p></p>
<p class="MsoNormal">I know I need to use the DEEP_COPY_ARRAYS when I need the actual vertices to be different, which does happen sometimes when I add a matrix that gets flattened on to the model. However, for switches, dynamic matrixTransforms, LODS, and callbacks,
 when do I use the different options? So far I have only gotten everything to work for those when I do a DEEP_COPY_NODES. Do I really need this, or would some subset of other options work?<p></p></p>
<p class="MsoNormal"><p>&nbsp;</p></p>
<p class="MsoNormal">I guess my main question is when are each of the various DEEP_COPY_ options needed?<p></p></p>
</div>
</div>
F Lallauret | 16 Apr 10:45 2014

snapshot with fixed size

Hi,

I have a scene render with RTT and quad geode for some postprocesses (e.g. a pseudo "night vision" shader). I
want to get a snapshot of the displayed image but with a given size (e.g. always 512x512) independently of
the real screen size. How can I do that ? The examples I found are always dependent of the screen size.

Cheers,
FL

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

Alexey Pavlov | 16 Apr 10:00 2014
Picon

osgQt build error

Hi!

I can't build OSG with Qt builded with ANGLE under Windows using
Mingw-w64 toolchain. I get conflict types between ANGLE and OpenGL
headers:
http://pastebin.kde.org/pitat7w4x

Regards,
Alexey.
Tianlan Shao | 15 Apr 17:43 2014
Picon

A suspicious bug of MatrixD

Dear all,
The following code in the header file MatrixD looks very suspicious to me:

inline Vec3d getScale() const {
          Vec3d x_vec(_mat[0][0],_mat[1][0],_mat[2][0]); 
          Vec3d y_vec(_mat[0][1],_mat[1][1],_mat[2][1]); 
          Vec3d z_vec(_mat[0][2],_mat[1][2],_mat[2][2]); 
          return Vec3d(x_vec.length(), y_vec.length(), z_vec.length()); 
        }

Shouldn't the index order be the other way around? I mean it should be

inline Vec3d getScale() const {
          Vec3d x_vec(_mat[0][0],_mat[0][1],_mat[0][2]); 
          Vec3d y_vec(_mat[1][0],_mat[1][1],_mat[1][2]); 
          Vec3d z_vec(_mat[2][0],_mat[2][1],_mat[2][2]); 
          return Vec3d(x_vec.length(), y_vec.length(), z_vec.length()); 
        }

The behaviour of my program was strange before I fix this problem. I'm not 100% percent sure, but since it's of fundamental importance, I still decided to report.

Best regards,
Tianlan Shao

<div><div dir="ltr">Dear all,<div>The following code in the header file MatrixD looks very suspicious to me:</div>
<div>
<div><br></div>
<div><span>inline Vec3d getScale() const {</span></div>
<div><span>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Vec3d x_vec(_mat[0][0],_mat[1][0],_mat[2][0]);&nbsp;</span></div>
<div><span>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Vec3d y_vec(_mat[0][1],_mat[1][1],_mat[2][1]);&nbsp;</span></div>
<div><span>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Vec3d z_vec(_mat[0][2],_mat[1][2],_mat[2][2]);&nbsp;</span></div>
<div><span>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; return Vec3d(x_vec.length(), y_vec.length(), z_vec.length());&nbsp;</span></div>
<div><span>&nbsp; &nbsp; &nbsp; &nbsp; }</span></div>
</div>
<div><br></div>
<div>Shouldn't the index order be the other way around? I mean it should be</div>
<div><br></div>
<div>
<div><span>inline Vec3d getScale() const {</span></div>
<div><span>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Vec3d x_vec(_mat[0][0],_mat[0][1],_mat[0][2]);&nbsp;</span></div>
<div><span>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Vec3d y_vec(_mat[1][0],_mat[1][1],_mat[1][2]);&nbsp;</span></div>
<div><span>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Vec3d z_vec(_mat[2][0],_mat[2][1],_mat[2][2]);&nbsp;</span></div>
<div><span>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; return Vec3d(x_vec.length(), y_vec.length(), z_vec.length());&nbsp;</span></div>
<div><span>&nbsp; &nbsp; &nbsp; &nbsp; }</span></div>
</div>
<div><br></div>
<div>The behaviour of my program was strange before I fix this problem. I'm not 100% percent sure, but since it's of fundamental importance, I still decided to report.</div>
<div><br></div>
<div>Best regards,</div>
<div>Tianlan Shao</div>
<div><br></div>
</div></div>
Thierry Pébayle | 15 Apr 15:29 2014
Picon

multi-threading troubles with 2 graphic cards

Dear all,

I'm trying to render a town with 2 graphic cards in the same computer: i7-3770 (quad core with
hyper-threading = 8 cores virtual), 2x gtx780ti, xubuntu 12.04, OSG3.2.0.

A separate X server run on each card and there is only one monitor(screen) attach to each card.
So I run the application twice (one per X server) with separate graphical context and
"DrawThreadPerContext" threading model.

I monitor cpu core usage with "sar" command (from sysstat package).
The system sees 8 cores as expected.

The two "Application+cull" threads are running on two separate cores (that's nice) but the two "draw"
threads are allways running on the same core resulting in a lack of performance...

Have you got any idea to solve this trouble ?

Thank you!

Cheers,
Thierry

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

alexis pierre | 14 Apr 23:42 2014
Picon

Iterator bug

Hi,

I think I found a bug in osg 3.2.0
I needed to use osgUtil::SmoothingVisitor. For some reason my compiler couldn't find some of the
functions so I just added SmoothingVisitor.cpp to my project (I may have taken that file from 3.2.1 rc2),
and I got a big bug:

in the function normalize I got an ERR_BAD_ACCESS

Code:
void normalize()
    {
        if (!_normals) return;

        for(osg::Vec3Array::iterator itr = _normals->begin();
            itr != _normals->end();
            ++itr)
        {
            (*itr).normalize();
        }
    }

So I modified the function as follows:

Code:
 void normalize()
    {
        if (!_normals) return;
		unsigned long a,b;
		a=0;
		b=_normals->size();
		
        for(osg::Vec3Array::iterator itr = _normals->begin();
            itr != _normals->end()&&a<=(b+1);
            ++itr)
        {
			if (a>=b){
				std::cout<<std::hex<<long(itr.base())<<" "<<long(_normals->end().base())<<std::endl;
			}
			a++;
            (*itr).normalize();
        }
    }

And I got

Code:
101f1ce18 101f1ce1c
101f1ce24 101f1ce1c

So This means that the condition itr != _normals->end() is never false!

Is it something I am missing?

Thank you!

Cheers,
alexis

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


Gmane