Re: [osg-users] How to track down memory leaks?

2018-07-12 Thread Wojciech Lewandowski
Hi, Igor,

I  got interested in this problem and checked your code by converting it to
pure osgViewer. Here are my observations:

I believe you do have circular reference. Your class Scene is a callback.
So RootNode points to callback but Scene callback points to RootNode. Hence
circular ref.
However, this does not explain increased ref count of your geometries. But
I believe this issue can be explained by by lazy clearing of render bins.
RenderBins are not
cleared after Draw but before next frame Draw. So after your Update, your
geometry is Culled/Drawn and lands in RenderLeaves of RenderBin. This
RenderBin is used to draw visible geometries but its not cleared after
Draw. Its cleared later, ie on next Cull/Draw traversal when RenderLeaves
container cleared before it gets filled again. So on next Update you will
notice increased ref count because its also added to RenderLeaves
container. But the next Cull/Draw will clear RenderLeaves and your geometry
will be finally released. Here is your modified test applet code ported to
vanilla osgViewer and modified to use observer_ptr instead of ref_ptr for
RootNode. I have put breakpoint in MyGeometry Destructor to see the call
stack and the call where the geometry is actually released and that way I
found the explanation.

Cheers, hth,
Wojtek Lewandowski

czw., 12 lip 2018 o 21:49 Igor Spiridonov  napisał(a):

> Here is simple project which reproduces this issue - RefCountTest (
> https://bitbucket.org/OmegaDoom/osgrefcounttest)
>
> It's a visual studio project with qt and osg. Not sure you are using
> windows but the main code in scene.cpp. ref count checks inside
> "Scene::operator()(osg::Node* node, osg::NodeVisitor* nv)"
>
> I expect both checks to return 1 but first one returns 2 as I explained
> earlier.
>
> I suppose it's the cause of memleak. I use osg 3.2.
>
> --
> Read this topic online here:
> http://forum.openscenegraph.org/viewtopic.php?p=74334#74334
>
>
>
>
>
> ___
> osg-users mailing list
> osg-users@lists.openscenegraph.org
> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
>
#include 
#include 
#include 
#include 
#include 
#include 
#include 

class Scene : public osg::NodeCallback
{
public:
  Scene();
  osg::Node* getRoot();

private:
  void operator()(osg::Node*, osg::NodeVisitor*) override;
  void UpdateScene() const;

  osg::observer_ptr m_rootNode;
};

Scene::Scene()
  : m_rootNode(new osg::Group)
{
  m_rootNode->addChild(new osg::Geode);
  m_rootNode->addUpdateCallback(this);
}

osg::Node* Scene::getRoot()
{
  return m_rootNode.get();
}

void PrintDtor(int refcount)
{
  printf("Dtor Refcount: %d \n", refcount);
}

class MyGeometry : public osg::Geometry
{
public:
  ~MyGeometry()
  {
int refcount = referenceCount();

PrintDtor(refcount);
  }
};

void Scene::operator()(osg::Node* node, osg::NodeVisitor* nv)
{
  //check refcount
  if (static_cast(m_rootNode->getChild(0))->getNumDrawables())
  {
auto drawable = 
static_cast(m_rootNode->getChild(0))->getDrawable(0);
int refcount = drawable->referenceCount();
printf("Callback 1 Refcount: %d \n", refcount);
  }

  UpdateScene();

  //check refcount
  if (static_cast(m_rootNode->getChild(0))->getNumDrawables())
  {
auto drawable = 
static_cast(m_rootNode->getChild(0))->getDrawable(0);
int refcount = drawable->referenceCount();
printf("Callback 2 Refcount: %d \n", refcount);
  }


  OpenThreads::Thread::microSleep(10);
};

void Scene::UpdateScene() const
{
  auto childNode = static_cast(m_rootNode->getChild(0));
  childNode->removeDrawables(0, childNode->getNumDrawables());

  osg::ref_ptr geometry(new MyGeometry);
  childNode->addDrawable(geometry);

  int refcount = geometry->referenceCount();  
  printf("UpdateScene Refcount: %d \n", refcount);

}

int main(int argc, char** argv)
{
osg::ArgumentParser arguments(, argv);
osgViewer::Viewer viewer( arguments );

// add the state manipulator
viewer.addEventHandler(new 
osgGA::StateSetManipulator(viewer.getCamera()->getOrCreateStateSet()));

// add the thread model handler
viewer.addEventHandler(new osgViewer::ThreadingHandler);

// add the window size toggle handler
viewer.addEventHandler(new osgViewer::WindowSizeHandler);

// add the stats handler
viewer.addEventHandler(new osgViewer::StatsHandler);

// add the help handler
viewer.addEventHandler(new 
osgViewer::HelpHandler(arguments.getApplicationUsage()));

Scene view;
viewer.setSceneData(view.getRoot());

viewer.run();
}___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] osglight demo problems with Intel graphics on Windows

2018-07-12 Thread Ryan Thoryk


robertosfield wrote:
> 
> What you describe sounds like an Intel driver bug.  The best thing you
> can do is check for latest Intel drivers.
> 


I checked over some things and found that the FFP was removed in GL 3.1, and 
that the Intel driver is reporting as that version.  I tested on an older 
laptop with Intel graphics, and it works, reporting as version 2.1.  Linux 
works and is using GL 3.0.  I'm wondering if 3.1 is what the problem is.

Ryan

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





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


Re: [osg-users] How to track down memory leaks?

2018-07-12 Thread Igor Spiridonov
Here is simple project which reproduces this issue - RefCountTest 
(https://bitbucket.org/OmegaDoom/osgrefcounttest)

It's a visual studio project with qt and osg. Not sure you are using windows 
but the main code in scene.cpp. ref count checks inside 
"Scene::operator()(osg::Node* node, osg::NodeVisitor* nv)"

I expect both checks to return 1 but first one returns 2 as I explained earlier.

I suppose it's the cause of memleak. I use osg 3.2.

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





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


[osg-users] OpenThreads Mutex::lock() crash

2018-07-12 Thread Guy Volckaert
Hi,

Has anyone experienced issues with OpenThreads Mutext::lock()? Occasionally a 
crash occurs when starting my application but only if the threading model is 
not SingleThreaded. The crash occurs in the following functions of OpenThreads:


Code:

int Mutex::lock() {
Win32MutexPrivateData *pd =
static_cast(_prvData);

#ifdef USE_CRITICAL_SECTION

// Block until we can take this lock.
EnterCriticalSection( &(pd->_cs) );

return 0;

#else
[...]
#endif
}




What I noticed is that sometimes "pd" is 0 eventhough "_prvData" is not 0!! I 
can't understand how that can occur unless there's a concurency issue. As a 
test, I added a sanity check after initializing the "pb" local variable, as 
follows:


Code:

while( pd == 0 )
{
Sleep( 10 ); // sleep for 10ms and try again...
pd = static_cast(_prvData);
}




I know it's dumb... but it works. I've been chasing this problem for a long 
time now and I haven't found a solution yet (except my dumb one). 

This issue occurs with v3.4.0 and v3.6.2. The crash occurs on Win7 and Win10 
when build with VS2013. 

Any help on this topic would be much appreciated.


Thank you!

Cheers,
Guy

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





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


Re: [osg-users] How to track down memory leaks?

2018-07-12 Thread Robert Osfield
On Thu, 12 Jul 2018 at 17:59, Igor Spiridonov  wrote:
> No, why would I have a circular reference?

The OSG doesn't generally leak unless you do something pretty odd, the
codebase is pretty heavily tested now.

So we can only guess as to what might be wrong.  Circular references
is one possibility.  It might be something else odd that you are
doing.   The small example that reproduces will be really helpful, as
there isn't else we can suggest at this point, so we just have to look
at code that illustrates the issue.

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


Re: [osg-users] [build] ViewerBase::setThreadingModel() not working

2018-07-12 Thread Robert Osfield
On Thu, 12 Jul 2018 at 17:52, Guy Volckaert  wrote:
> I also looked at the osg-submissions archives and could not find any trace of 
> this change. I went back as far as June 2017.

Most submissions now come it via pull requests on github.

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


Re: [osg-users] [build] ViewerBase::setThreadingModel() not working

2018-07-12 Thread Guy Volckaert
Actually, if we want to adjust the threading affinity when cycling through the 
threading model, then would`t be better to if we replaced:


Code:
 
if (isRealized() && _threadingModel!=SingleThreaded) startThreading();




by


Code:
 
if (isRealized() && _threadingModel!=SingleThreaded) setUpThreading();




Guy

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





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


Re: [osg-users] [build] ViewerBase::setThreadingModel() not working

2018-07-12 Thread Guy Volckaert
Hi,

I also looked at the osg-submissions archives and could not find any trace of 
this change. I went back as far as June 2017.

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





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


Re: [osg-users] How to track down memory leaks?

2018-07-12 Thread Igor Spiridonov
No, why would I have a circular reference? And yes, I'm aware that circular 
references don't work with smart pointers. I will create a simple example which 
reproduces this issue.

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





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


Re: [osg-users] [build] ViewerBase::setThreadingModel() not working

2018-07-12 Thread Guy Volckaert
Hi,

I looked at the commit but the description does not clearly provide a reason 
for the change. I looked at the forum but could not find anything. I'll try the 
mailing list next. 

Thank you!

Cheers,
Guy

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





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


Re: [osg-users] How to track down memory leaks?

2018-07-12 Thread Robert Osfield
Hi Igor,

On Thu, 12 Jul 2018 at 16:24, Igor Spiridonov  wrote:
> I have found the memory leak cause. Look like I don't understand how osg 
> works.
> I have a root node and its child node. I add UpdateCallback to the root node 
> and inside this callback i remove child nod's drawables and add another ones. 
> I check reference count before I remove them and it's 2 for some reason. My 
> remove decreases it on 1 but it's not enough. Looks like viewer or something 
> else keeps these drawables and therefore memleak happens.
>
> I checked reference count of drawables after I add them to child's node and 
> it's always 1 but when drawables come again to UpdateCallback it becomes 2.

The OSG's rendering backend retains a ref_ptr<> to the StateSet and
Drawables required for the current frame, but nothing beyond this.
It's not a memory leak at though, this is all cleaned up robustly.

If there is an actual leak in your program then perhaps you've created
a circular reference somewhere, could you have a child object, or
callback perhaps that holds a ref_ptr<> to a parent?

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


Re: [osg-users] [build] ViewerBase::setThreadingModel() not working

2018-07-12 Thread Robert Osfield
Hi Guy,

The commit that changes this was:

ommit bb84f1ea3c23625a645b9c2848202bca7c566efb
Author: Konstantin S. Matveyev 
Date:   Sat Jan 13 15:46:53 2018 +0300

osgViewer::ViewerBase setThreadingModel func fix: should not start
threading, must only restart

Off the top of my head I only vaguely recall the motivation for the
change.  Have a look at the mailing list/forum archives and the commit
on github to see any discussions about this from early January,

Robert.

On Thu, 12 Jul 2018 at 16:21, Guy Volckaert  wrote:
>
> Hi,
>
> When I try to cycle through the threading models by pressing the 'm' key 
> (when the ThreadingHandler is registered) the stats would indicates the 
> correct threading model, but the engine would remain in SingleThreaded. So I 
> started investigating the issue and I noticed that, with OSG v3.6.2, the 
> ViewerBase::setThreadingModel() changed compared with v3.4.0. Below is a 
> snipit of function:
>
>
> Code:
>
> void ViewerBase::setThreadingModel(ThreadingModel threadingModel)
> {
> if (_threadingModel == threadingModel) return;
>
> bool needSetUpThreading = _threadsRunning
>
> if (_threadsRunning) stopThreading();
>
> _threadingModel = threadingModel;
>
> if (needSetUpThreading) setUpThreading();
> }
>
>
>
>
>
> If the current threading model is SingleThreaded then _threadsRunning will be 
> false which means that needSetUpThreading will also be false. Therefore, 
> setUpThreading() will never be called if we are in SingleThreaded.
>
> Rolling back the function to v3.4.0 seems to resolve the problem, but I'm not 
> sure if that will cause other issues. There's obviously a reason why it was 
> changed. I would like someone with more experience that I to way in. Below is 
> a snipit of the rolled-back function.
>
>
> Code:
>
> void ViewerBase::setThreadingModel(ThreadingModel threadingModel)
> {
> if (_threadingModel == threadingModel) return;
>
> if (_threadsRunning) stopThreading();
>
> _threadingModel = threadingModel;
>
> if (isRealized() && _threadingModel!=SingleThreaded) startThreading();
> }
>
>
>
>
> Regards,
>
> Guy
>
> --
> Read this topic online here:
> http://forum.openscenegraph.org/viewtopic.php?p=74324#74324
>
>
>
>
>
> ___
> 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] [build] ViewerBase::setThreadingModel() not working

2018-07-12 Thread Guy Volckaert
Hi,

When I try to cycle through the threading models by pressing the 'm' key (when 
the ThreadingHandler is registered) the stats would indicates the correct 
threading model, but the engine would remain in SingleThreaded. So I started 
investigating the issue and I noticed that, with OSG v3.6.2, the 
ViewerBase::setThreadingModel() changed compared with v3.4.0. Below is a snipit 
of function:
 

Code:

void ViewerBase::setThreadingModel(ThreadingModel threadingModel)
{
if (_threadingModel == threadingModel) return;

bool needSetUpThreading = _threadsRunning

if (_threadsRunning) stopThreading();

_threadingModel = threadingModel;

if (needSetUpThreading) setUpThreading();
}





If the current threading model is SingleThreaded then _threadsRunning will be 
false which means that needSetUpThreading will also be false. Therefore, 
setUpThreading() will never be called if we are in SingleThreaded. 

Rolling back the function to v3.4.0 seems to resolve the problem, but I'm not 
sure if that will cause other issues. There's obviously a reason why it was 
changed. I would like someone with more experience that I to way in. Below is a 
snipit of the rolled-back function. 
  

Code:

void ViewerBase::setThreadingModel(ThreadingModel threadingModel)
{
if (_threadingModel == threadingModel) return;

if (_threadsRunning) stopThreading();

_threadingModel = threadingModel;

if (isRealized() && _threadingModel!=SingleThreaded) startThreading();
}




Regards,

Guy

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





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


Re: [osg-users] How to track down memory leaks?

2018-07-12 Thread Igor Spiridonov
Hello Robert.

I have found the memory leak cause. Look like I don't understand how osg works.
I have a root node and its child node. I add UpdateCallback to the root node 
and inside this callback i remove child nod's drawables and add another ones. I 
check reference count before I remove them and it's 2 for some reason. My 
remove decreases it on 1 but it's not enough. Looks like viewer or something 
else keeps these drawables and therefore memleak happens.

I checked reference count of drawables after I add them to child's node and 
it's always 1 but when drawables come again to UpdateCallback it becomes 2.

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





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


Re: [osg-users] World space normal.

2018-07-12 Thread Wojciech Lewandowski
Hi,

Was going to propose what Glenn already proposed. This should work with
uniform scales on x,y,z coord. And IMHO that formula is more precise when
dealing with normals than vertices. Thats because the precision issues are
somewhat related to huge earth translation offsets in ModelView matrix.
NormalMatrix and mat3(osg_ViewMatrixInvers) not include the translation
offset part.

Cheers,
Wojtek Lewandowski

czw., 12 lip 2018 o 15:22 Glenn Waldron  napisał(a):

> Marlin,
> This might work:
>
> vec3 normalWorld = mat3(osg_ViewMatrixInverse) * gl_NormalMatrix *
> gl_Normal;
>
> But like Robert says, world coordinates on the GPU will lead to precision
> loss, so only do it if you are content with a low-precision result.
>
> Glenn Waldron
>
>
> On Wed, Jul 11, 2018 at 9:34 AM Rowley, Marlin R 
> wrote:
>
>> I have a world space vertex computed as follows:
>>
>>
>>
>> WorldVertex = osg_ViewMatrixInverse * gl_ModelViewMatrix * aVertex;
>>
>>
>>
>> I would like to get the world space normal from this vertex.  Is there an
>> equivalent osg_* matrix that does the same thing?
>>
>>
>>
>> I tried this:
>>
>>
>>
>> NormalWorld = gl_NormalMatrix * gl_Normal;
>>
>>
>>
>> But I know that is only putting the normal in view space.
>>
>>
>>
>> 
>>
>> Marlin Rowley
>>
>> Software Engineer, Staff
>>
>> [image: cid:image002.jpg@01D39374.DEC5A2E0]
>>
>> *Missiles and Fire Control*
>>
>> 972-603-1931 (office)
>>
>> 214-926-0622 (mobile)
>>
>> marlin.r.row...@lmco.com
>>
>>
>> ___
>> 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 mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] World space normal.

2018-07-12 Thread Glenn Waldron
Marlin,
This might work:

vec3 normalWorld = mat3(osg_ViewMatrixInverse) * gl_NormalMatrix *
gl_Normal;

But like Robert says, world coordinates on the GPU will lead to precision
loss, so only do it if you are content with a low-precision result.

Glenn Waldron


On Wed, Jul 11, 2018 at 9:34 AM Rowley, Marlin R 
wrote:

> I have a world space vertex computed as follows:
>
>
>
> WorldVertex = osg_ViewMatrixInverse * gl_ModelViewMatrix * aVertex;
>
>
>
> I would like to get the world space normal from this vertex.  Is there an
> equivalent osg_* matrix that does the same thing?
>
>
>
> I tried this:
>
>
>
> NormalWorld = gl_NormalMatrix * gl_Normal;
>
>
>
> But I know that is only putting the normal in view space.
>
>
>
> 
>
> Marlin Rowley
>
> Software Engineer, Staff
>
> [image: cid:image002.jpg@01D39374.DEC5A2E0]
>
> *Missiles and Fire Control*
>
> 972-603-1931 (office)
>
> 214-926-0622 (mobile)
>
> marlin.r.row...@lmco.com
>
>
> ___
> 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] [build] Missing OpenThreads PDB when building INSTALL

2018-07-12 Thread Guy Volckaert
Hi,

This is not really a big issue, but I noticed that the OpenThreads PDB file is 
not copied to the INSTALL directory when building OSG v3.6.2 on Windows with 
VS2013. 

I looked at  .\src\OpenThreads\win32\cmake_install.cmake and the lines required 
to copy the PDB are missings. 

Thanks,

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





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


Re: [osg-users] Can't access to assets in Android

2018-07-12 Thread michael kapelko
Hi.

In OpenSceneGraph cross-platform guide application I first unpacked
the resource into local drive, then accessed it the usual way.
Here's the sample:
https://github.com/OGStudio/openscenegraph-cross-platform-guide-application/blob/master/android/app/src/main/java/org/opengamestudio/osgapp/RenderActivity.java#L27

On 11 July 2018 at 16:40, Daniel Ponsoda  wrote:
> Hi everyone,
>
> I just compiled the example project for Android (osgAndroidExampleGLES2) and 
> can't figure out how to load osgt files I've put inside the apk (assets 
> folder).
>
> I'm trying to load cow.osgt using the load option that appears in the app's 
> menu with no luck (no matter what path I give). The error message appearing 
> in logcat is:
>
> -
> E/Osg Viewer: There are 1 models to load
>   Loading: cow.osgt
> W/Osg Viewer: Error reading file cow.osgt: file not found
> E/Osg Viewer: Model not loaded
> -
>
> The file is located inside the assets folder in the apk root: /assets/cow.osgt
>
> I tried these paths when loading:
> assets/cow.osgt
> /assets/cow.osgt
> cow.osgt
> /cow.osgt
>
> The last thing I tried after read a solution in another topic on this forum 
> is to copy the file cow.osgt to the external sdcard and set read permissions 
> in the manifest but still appears the same error (file not found). The path I 
> used for this was /storage/emulated/0/cow.osgt (anyway, I don't want to use 
> the sd card in my app)
>
> Any ideas on why is this happening?
>
> Thank you, in advance!
>
> Cheers,
> j
>
> --
> Read this topic online here:
> http://forum.openscenegraph.org/viewtopic.php?p=74309#74309
>
>
>
>
>
> ___
> 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] [osgOcean] osgOcean - Render to Texture Camera

2018-07-12 Thread Robert Osfield
On Wed, 11 Jul 2018 at 23:39, Rob Ewbank  wrote:
>
> Thanks Robert, I have been looking through the code and have merged two 
> branches, one which has been changed to work with OSG 3.4.1 and the master.
>
> Osgocean seems to do a few weird tricks with shaders and rendering that cause 
> issues in places such as transparency, when it works, its really nice.
>
> Do you know if the author kbale has been around these parts lately?

I haven't seen him post for quite a few years.  I believe osgOcean was
related to a university research project, folk move on.

> This should prob be in another post, but anyway. When using the primitives 
> such as sphere, box etc in OSG 3.6 they don't respond to changing position, 
> size etc. Works fine in 3.4.

In 3.6 the osg::ShapeDrawable is now implemented as an osg::Geometry,
broadly it should work the same, if there is a usage case that it
isn't working the same could you create a small test example (such as
modifying an existing OSG example) to illustrate the problem, it could
well be a bug that we can fix once we know what might be amiss.

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


Re: [osg-users] EXTERNAL: Re: World space normal.

2018-07-12 Thread Robert Osfield
Hi Marlin,

On Wed, 11 Jul 2018 at 19:59, Rowley, Marlin R 
wrote:

> Are you suggesting that I compute the world space normal in the
> application and pass it to the shader?  I absolutely need world space
> coordinates. If so, how would I get the normal of the triangle before
> evaluating the shader?
>
> No, I'm suggesting that you shouldn't be computing anything on the GPU in
world coordinates, not positions, not normals, not anything.  Any time you
convert coordinates from local object coordinates into world coordinates
you introduce issues with precision.  On the CPU you can workaround this by
using doubles, but on the GPU this is typically an option, so you are using
floats that just can't handle the precision issues.

So if you say you "absolutely need word space coordinates" but I'd say,
take a step back, come up with a algorithm that use eye coordinates or
local coordinate for doing calculations as this is (absolutely:-) required
to avoid precision issues.

This may require being a bit creative, but in the end you whole system will
work far better, it'll scale better, it'll avoid precision issues.

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


[osg-users] Can't access to assets in Android

2018-07-12 Thread Daniel Ponsoda
Hi everyone,

I just compiled the example project for Android (osgAndroidExampleGLES2) and 
can't figure out how to load osgt files I've put inside the apk (assets folder).

I'm trying to load cow.osgt using the load option that appears in the app's 
menu with no luck (no matter what path I give). The error message appearing in 
logcat is:

-
E/Osg Viewer: There are 1 models to load
  Loading: cow.osgt
W/Osg Viewer: Error reading file cow.osgt: file not found
E/Osg Viewer: Model not loaded
-

The file is located inside the assets folder in the apk root: /assets/cow.osgt

I tried these paths when loading:
assets/cow.osgt
/assets/cow.osgt
cow.osgt
/cow.osgt

The last thing I tried after read a solution in another topic on this forum is 
to copy the file cow.osgt to the external sdcard and set read permissions in 
the manifest but still appears the same error (file not found). The path I used 
for this was /storage/emulated/0/cow.osgt (anyway, I don't want to use the sd 
card in my app)

Any ideas on why is this happening?

Thank you, in advance!

Cheers,
j

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





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