Hyunsoo | 31 Oct 11:58 2014

Re: Someone help me with false positive memory leak.

I didn't use anything but visual studio 2013 and osg 3.2.1 and other third-party libraries.
 
Maybe it is Visual sutdio debug runtime.
 
When the osgViewerMFC stops,  memory leaks list popping in Visual Studio Output window.
 
Anyway thanks for reply.
 
I am struggling with this problem for a week...and more....
------ Original Message ------

Date: Friday, Oct 31, 2014 06:50:01 PM
From: "Christian Buchner" <christian.buchner <at> gmail.com>
To: "OpenSceneGraph Users" <osg-users <at> lists.openscenegraph.org>
Subject: Re: [osg-users] Someone help me with false positive memory leak.


Hi,

the most important information is missing: how do you test your application for memory leaks?
The heap debugger built into the Visual Studio Debug runtime?

 
 
 
 
 
 
 
 
 
당신과 제가 다름이 세상을 풍요롭게 합니다...^^v
Differences between U and me make the world plentiful...^^v
<div><div class="wc_wrapper">
<div class="wc_cite_wrapper">I didn't use anything but visual studio 2013 and osg 3.2.1 and other third-party libraries.</div>
<div class="wc_cite_wrapper">&nbsp;</div>
<div class="wc_cite_wrapper">Maybe it is Visual sutdio debug runtime.</div>
<div class="wc_cite_wrapper">&nbsp;</div>
<div class="wc_cite_wrapper">When the osgViewerMFC stops,&nbsp; memory leaks list popping in Visual Studio Output window.</div>
<div class="wc_cite_wrapper">&nbsp;</div>
<div class="wc_cite_wrapper">Anyway thanks for reply.</div>
<div class="wc_cite_wrapper">&nbsp;</div>
<div class="wc_cite_wrapper">I am struggling with this problem for a week...and more....<br>
</div>
<blockquote class="wc_cite_wrapper" dir="ltr">------ Original Message ------<br><br>Date: Friday, Oct 31, 2014 06:50:01 PM<br>From: "Christian Buchner" &lt;christian.buchner <at> gmail.com&gt;<br>To: "OpenSceneGraph Users" &lt;osg-users <at> lists.openscenegraph.org&gt;<br>Subject: Re: [osg-users] Someone help me with false positive memory leak.<br><br><div dir="ltr">
<div>
<div>
<br>Hi,<br><br>
</div>the most important information is missing: how do you test your application for memory leaks?<br>
</div>
<div>The heap debugger built into the Visual Studio Debug runtime?<br><br>
</div>
</div>
</blockquote>
<div class="_wcSign"><div>
<div>&nbsp;</div>
<div>&nbsp;</div>
<div>&nbsp;</div>
<div>&nbsp;</div>
<div>&nbsp;</div>
<div>&nbsp;</div>
<div>&nbsp;</div>
<div>&nbsp;</div>
<div>&nbsp;</div>
<div>&#45817;&#49888;&#44284; &#51228;&#44032; &#45796;&#47492;&#51060; &#49464;&#49345;&#51012; &#54413;&#50836;&#47213;&#44172; &#54633;&#45768;&#45796;...^^v</div>
<div>Differences between U and me make the world plentiful...^^v</div>
</div></div>
</div></div>
Hyunsoo | 31 Oct 06:02 2014

Someone help me with false positive memory leak.

I am developing an application that using osg 3.2.1 with mfc( visual studio 2013 )
 
When I test the example osgviewerMFC, it produce some memory leaks.
 
After googling... I found the leaks are caused by false positives.....
 
But I couldn't find How to fix it..
 
Please Help me to fit it....thanks.
<div><div class="wc_wrapper">
<div class="wc_cite_wrapper">I am developing an application that using osg 3.2.1 with mfc( visual studio 2013 )</div>
<div class="wc_cite_wrapper">&nbsp;</div>
<div class="wc_cite_wrapper">When I test the example osgviewerMFC, it produce some memory leaks.</div>
<div class="wc_cite_wrapper">&nbsp;</div>
<div class="wc_cite_wrapper">After googling... I found the leaks are caused by false positives.....</div>
<div class="wc_cite_wrapper">&nbsp;</div>
<div class="wc_cite_wrapper">But I couldn't find How to fix it..</div>
<div class="wc_cite_wrapper">&nbsp;</div>
<div class="wc_cite_wrapper">Please Help me to fit it....thanks.</div>
</div></div>
Glen | 31 Oct 04:27 2014

64bit osgviewer.exe can't be launched in command prompt window

Hello everyone,
	I met a strange problem. Below are the steps I operated.
	1. Finished the building process of OSG 64 bit ( In CMake GUI,
select Visual Studio 2012 64 ,then started building in VS2012 )
	2. Open command prompt window, set environment variables to correct
values, then run command "osgviewer cow.osg"
	3. Got the prompt "The application can't be launched(0xc000007b)"
	4. In Visual Studio 2012, start osgviewer by entering debug mode,
the cow can be displayed normally.
	It makes me wonder why these two modes differ?

Glen
AntonPopov | 30 Oct 14:28 2014

calculate the scale of a pixel

Hi,

I would like to calculate the scale of a pixel. In a program in OpenGL, I hate it posted a Function. How can I
make it for OSG?

Code:

Public Function get_Massstab() As Double

    Dim modelmatrix(15) As Double
    Dim projMatrix(15) As Double
    Dim viewMatrix(3) As Integer

    Dim tx1 As Double
    Dim ty1 As Double
    Dim tz1 As Double
    Dim tx2 As Double
    Dim ty2 As Double
    Dim tz2 As Double
    Dim dist As Double

    Gl.glGetDoublev(Gl.GL_MODELVIEW_MATRIX, modelmatrix)
    Gl.glGetDoublev(Gl.GL_PROJECTION_MATRIX, projMatrix)
    Gl.glGetIntegerv(Gl.GL_VIEWPORT, viewMatrix)

    gluUnProject(0, 0, 0, modelmatrix, projMatrix, viewMatrix, tx1, ty1, tz1)
    gluUnProject(0, 1, 0, modelmatrix, projMatrix, viewMatrix, tx2, ty2, tz2)

    'einen Pixel
    dist = Math.Sqrt((tx1 - tx2) ^ 2 + (ty1 - ty2) ^ 2 + (tz1 - tz2) ^ 2)
    Return dist

  End Function

Thank you!

Cheers,
Anton[/code]

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

Attachments: 
http://forum.openscenegraph.org//files/size2_801.png
http://forum.openscenegraph.org//files/size1_776.png

Émeric MASCHINO | 30 Oct 16:52 2014
Picon

Handling double precision data: node's meta-data or plugin data or what?

Hi,

I have to deal with double precision data files.

By contrast to what's stated in [1], it seems to me that osg::Geometry
can be passed double precision vertex data. At least in OSG 3.2.1 that
may have fixed things since then. Allright. Great. But e.g.
osgUtil::SmoothingVisitor fails to compute the normals of such vertex
data, as osgUtil/SmoothingVisitor.cpp explicitely dynamic_casts vertex
data as osg::Vec3Array*, probably because a TriangleFunctor (that
doesn't seem to support anything else than osg::Vec3Array) is
required.

Now, reading in [2], [3] and the DAE/FBX readers source code, it
appears that handling double precision data is a reality. At least for
serialization. But what I'm missing is how to render them actually? I
don't understand how the conversion from double to simple precision
data is done for rendering. I don't seem to find any
duplicated-with-different-precision-vertex-data in the DAE/FBX
readers. BTW, [3] also mentions the newly (at the time) introduced
osgDB::Options::PrecisionHint thing that is only used by the DAE/FBX
to decide whether serialize the vertex data in osg::Vec3Array or
osg::Vec3dArray. But nothing about rendering.

I was thus wondering of maintaining my double precision vertex data as
node's meta-data. So I read the brilliant discussion and PDF file [4]
that seems to have led to the introduction of the UserDataContainer in
core OSG. But here again, I'm coming short of determining if that's
the right way to do so, as this API is only used to serialize
presentation settings by the Present3D plugin. And while I'm thinking
at "externalizing" my double precision data as meta-data (hence
duplicating them with simple precision data for rendering), why not
pass them as a separate object as plugin data? But here too, the
examples using the {set|get}PluginData API are scarce: namely the DAE
(once again) and FFmpeg plugins.

In short:
- how do you deal with double precision data?
- how do you deal with any non-standard data (well, not related to
geometry data)? How do you decide whether to use UserDataContainer to
store them as meta-data in nodes or as plugin data?

Thanks gurus,

     Émeric

[1] http://lists.openscenegraph.org/htdig.cgi/osg-users-openscenegraph.org/2007-August/133876.html
[2] http://lists.openscenegraph.org/htdig.cgi/osg-users-openscenegraph.org/2011-October/187722.html
[3] http://lists.openscenegraph.org/htdig.cgi/osg-users-openscenegraph.org/2010-April/173920.html
[4] http://lists.openscenegraph.org/htdig.cgi/osg-users-openscenegraph.org/2011-April/183451.html
_______________________________________________
osg-users mailing list
osg-users <at> lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Olivier Migliorini | 30 Oct 16:03 2014
Picon

Proper way for setting uniforms in drawable cullcallback

Hi everyone,

I have read about how to set uniforms in a node cullcallback.

Code:

class LightingCullCallback : public osg::NodeCallback
{
	std::unordered_map<osgUtil::CullVisitor*, osg::ref_ptr<osg::StateSet>> mCullVisitorStateSetMap;
public:
	LightingCullCallback (int maxLightNb){}

	virtual void operator() (osg::Node* node, osg::NodeVisitor* nv)
	{
		osgUtil::CullVisitor* pCullVisitor = dynamic_cast<osgUtil::CullVisitor*>(nv);
		if (pCullVisitor)
		{
			std::unordered_map<osgUtil::CullVisitor*, osg::ref_ptr<osg::StateSet>>::iterator
itStateSet = mCullVisitorStateSetMap.find(pCullVisitor);
			osg::ref_ptr<osg::StateSet> pStateSet = NULL;
			if (itStateSet != mCullVisitorStateSetMap.end())
			{
				pStateSet = itStateSet->second;
			}
			else
			{
				pStateSet = new osg::StateSet;
				InitUniform(pStateSet);
				mCullVisitorStateSetMap.insert(std::make_pair(pCullVisitor, pStateSet));
			}
			UpdateUniform(pStateSet);
			pCullVisitor->pushStateSet(pStateSet);
			traverse(node, nv);
			pCullVisitor->popStateSet();
		}
	}
};

I am looking for a similar way to do this with Drawable::CullCallback.
But as far as I understand traversal and stateset mechanisms, I can not find a way to use pushStateSet and
popStateSet in the Drawable::CullCallback. 

I have tried to do this instead

Code:

struct SCameraStateSetMap
{
	std::unordered_map<osg::Camera*, osg::ref_ptr<osg::StateSet>> mCameraStateSetMap;
}
class LightingGeometryCullCallback : public osg::Drawable::CullCallback
{
	SCameraStateSetMap* mpCameraStateSetMap;
public:
	LightingGeometryCullCallback( SCameraStateSetMap* pCameraStateSetMap) :
mpCameraStateSetMap(pCameraStateSetMap) {}

	virtual bool cull(osg::NodeVisitor* nv, osg::Drawable* drawable, osg::RenderInfo* renderInfo) const
	{
		osgUtil::CullVisitor* pCullVisitor = dynamic_cast<osgUtil::CullVisitor*>(nv);
		if (pCullVisitor != NULL)
		{
			osg::Camera* pCamera = pCullVisitor->getCurrentCamera();
			if (pCamera != NULL)
			{
				std::unordered_map<osg::Camera*, osg::ref_ptr<osg::StateSet>>::iterator itStateSet = mpCameraStateSetMap->mCameraStateSetMap.find(pCamera);
				osg::ref_ptr<osg::StateSet> pStateSet = NULL;
				if (itStateSet != mpCameraStateSetMap->mCameraStateSetMap.end())
				{
					pStateSet = itStateSet->second;
				}
				else
				{
					pStateSet = new osg::StateSet;
					InitUniform(pStateSet);
					mpCameraStateSetMap->mCameraStateSetMap.insert(std::make_pair(pCamera, pStateSet));
				}
				UpdateUniform(pStateSet);
				return IsCulled(drawable);
			}
		}
		return true;
	}
};

class LightingGeometryDrawCallback : public osg::Drawable::DrawCallback
{
	SCameraStateSetMap* mpCameraStateSetMap;
public:
	LightingGeometryDrawCallback( SCameraStateSetMap* pCameraStateSetMap) :
mpCameraStateSetMap(pCameraStateSetMap) {}
	
	virtual void drawImplementation(osg::RenderInfo& renderInfo, const osg::Drawable* drawable) const
	{
		osg::Camera* pCamera = renderInfo.getCurrentCamera();
		if (pCamera != NULL)
		{
			std::unordered_map<osg::Camera*, osg::ref_ptr<osg::StateSet>>::iterator itStateSet = mpCameraStateSetMap->mCameraStateSetMap.find(pCamera);
			if (itStateSet != mpCameraStateSetMap->mCameraStateSetMap.end())
			{
				renderInfo.getState()->pushStateSet(pStateSet);
				renderInfo.getState()->apply();
				drawable->drawImplementation(renderInfo);
				renderInfo.getState()->popStateSet();
				renderInfo.getState()->apply();
			}
			else
			{
				drawable->drawImplementation(renderInfo);
			}
		}
	}
};

But not successful. Do I have a chance to get this work this way? Or another?

Thanks for taking the time to read.

Cheers,
Olivier[/code]

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

Liu Xiao | 29 Oct 12:45 2014

[osgPlugins] osgConv tool crash when converting FBX file with binding Matrices

Hi,

I tried to use the source of trunk (3.3.3) of osgConv to convert fbx, but it crashed in function
resolveBindMatrices of osgdb_fbx:
The code is:

Code:
nodeNames.insert(it->second->getName());

Which seems that there is no name node.
The fbx sdk version is 2015.1.

I attached a fbx file here, can any body help with it?

Thank you!

Cheers,
Liu

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

Attachments: 
http://forum.openscenegraph.org//files/youngfbx_445.zip

Björn Blissing | 29 Oct 13:00 2014
Picon

Strange flickering in Linux when using FRAME_BUFFER_OBJECT

Hi,

Some of the linux users of my OsgOculus implementation are reporting flickering images. The piece of code
which seems to be the offender is the renderToTexture camera setup:

Code:

...
camera->setDrawBuffer(GL_FRONT);
camera->setReadBuffer(GL_FRONT);
camera->setRenderTargetImplementation(osg::Camera::FRAME_BUFFER_OBJECT);
...

If they change the setDrawBuffer() and setReadBuffer() to GL_BACK instead the flickering disappears.
Same thing if they remove the setDrawBuffer() and setReadBuffer() calls entirely.

I was under the impression that GL_FRONT should be used when working with frame buffer objects. Could
someone educate me why they are seeing this behavior? 

Cheers,
Björn

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

_______________________________________________
osg-users mailing list
osg-users <at> lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Trajce Nikolov NICK | 29 Oct 12:02 2014
Picon

frequently modified osg::Image uploads

Hi Community,

I have a case where I work with osg::Image on the CPU and uploading it to a osg::Texture object. However, it is terribly slow - the osg::Image is modified on each frame.

Any hints techniques for this tip of task?

Thanks a bunch as always!

Nick

--
trajce nikolov nick
<div><div dir="ltr">Hi Community,<div><br></div>
<div>I have a case where I work with osg::Image on the CPU and uploading it to a osg::Texture object. However, it is terribly slow - the osg::Image is modified on each frame.</div>
<div><br></div>
<div>Any hints techniques for this tip of task?</div>
<div><br></div>
<div>Thanks a bunch as always!</div>
<div><br></div>
<div>Nick<br clear="all"><div><br></div>-- <br>trajce nikolov nick<br>
</div>
</div></div>
Srinivas Prabhu | 29 Oct 04:58 2014
Picon

Re: Rotating a geometry along the vertex axis normal of another geometry.

Hi,

My scene graph looks like the image attached below:

Here, I want to rotate the geode1 along the axis normal of one of the vertices of geometry that attached to the
geode2. Imagine that the normal at the vertex(0.0,0.0,0.0) of geode2 is (0.0,-1.0,0.0). i.e facing
outwards from the screen.

I have done something like this:

osg::Matrix localToWorld = osg::computeLocalToWorld(geode2>getParentalNodePaths()[0] );
osg::Matrixd mat1,mat2;						mat1.makeTranslate(osg::Vec3d(0.0,0.0,0.0) * localToWorld);
osg::Vec3 vec(osg::Vec3(0.0,-1.0,0.0) *
localToWorld);
vec.normalize();						mat2.makeRotate(osg::DegreesToRadians(45.f),vec);						trans->setMatrix(
mat1 * mat2);

But the rotation is happening in a weird way. 
Please let me know what could be the issue ?
Thank you!

Cheers,
Srinivas[/img]

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

Attachments: 
http://forum.openscenegraph.org//files/osgtransforms_142.png

Glen | 29 Oct 03:48 2014

How to configure CMake to compile X64 OSG

Hello Guru,
	My question is as the title say. I didn’t find any resource to describe the steps.

Best regards.

Glen

_______________________________________________
osg-users mailing list
osg-users <at> lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Gmane