Re: [osg-users] OpenSceneGraph-3.6.5 release candidate 2 tagged, please test

2020-01-29 Thread OpenSceneGraph Users
Hi Chris,

Thanks the links.  I've tracked down the example you created and re-run it
on my system and on the scene graph creation of the second window/view I
get text without textures.

In summary:
>
>- Fabian has done something weird with either OSG or OpenMW that
>hasn't been specified yet.
>
> If the codebase is the same perhaps it comes down to a sensitivity to
compiler version or dependencies?

>
>- It's beginning to feel like you're misspelling OpenMW deliberately.
>
> Sigh.  I likely have dyslexia, while I've never been formally diagnosed I
have the traits, the downside is that I regularily get letters wrong, don't
spot mispellings.  This isn't personal, it's just an issue I have to deal
with, and unfortunately as I read/wrote code and read/write email the
community also have to accept that I don't get everything right every
time.  In other ways my brain functions pretty well so overall I can still
be productive.


>- Regarding the as-yet unresolved default font/object cache not being
>released issue I reported in March, the ball was left in your court with
>nothing more I could do. Hopefully enough has been linked above that we can
>move forward with that again if you've got more time now.
>
>
If this is the one that the attached example recreates then I will be
looking into this today.

-- 
You received this message because you are subscribed to the Google Groups 
"OpenSceneGraph Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to osg-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/osg-users/mailman.67380.1580309147.7166.osg-users-openscenegraph.org%40lists.openscenegraph.org.
cmake_minimum_required(VERSION 2.6)

SET(PROJECT_NAME viewtest)

PROJECT(${PROJECT_NAME})

FIND_PACKAGE(OpenThreads)
FIND_PACKAGE(osg)
FIND_PACKAGE(osgDB)
FIND_PACKAGE(osgUtil)
FIND_PACKAGE(osgGA)
FIND_PACKAGE(osgText)
FIND_PACKAGE(osgViewer)

SET(SOURCES
main.cpp
)

INCLUDE_DIRECTORIES(${OPENTHREADS_INCLUDE_DIR} ${OSG_INCLUDE_DIR})

LINK_DIRECTORIES(${OSG_LIB_DIR})

ADD_EXECUTABLE(${PROJECT_NAME} ${SOURCES})

TARGET_LINK_LIBRARIES(${PROJECT_NAME} ${OSG_LIBRARIES} ${OSGVIEWER_LIBRARIES} 
${OSGUTIL_LIBRARIES} ${OSGDB_LIBRARIES} ${OSGGA_LIBRARIES}  
${OSGTEXT_LIBRARIES} ${OPENTHREADS_LIBRARIES})
#include 

#include 

#include 

#include 

#include 

class AddViewOperation : public osg::Operation
{
public:
AddViewOperation(osg::ref_ptr view)
: osg::Operation("AddView", false)
, _view(view)
{}

void operator() (osg::Object * compositeViewer) override
{
OSG_NOTICE << "AddView operator()" << std::endl;
osgViewer::CompositeViewer * viewer = dynamic_cast(compositeViewer);
viewer->stopThreading();
viewer->addView(_view);
viewer->startThreading();
}

protected:
osg::ref_ptr _view;
};

class RemoveViewOperation : public osg::Operation
{
public:
RemoveViewOperation(osg::ref_ptr view)
: osg::Operation("RemoveView", false)
, _view(view)
{
OSG_NOTICE<<"RemoveViewOperation::RemoveViewOperation()"<(compositeViewer);
viewer->stopThreading();
viewer->removeView(_view);
viewer->startThreading();
}

protected:
osg::ref_ptr _view;
};

class ViewAdder : public osgGA::GUIEventHandler
{
public:
ViewAdder(osgViewer::CompositeViewer * viewer)
: _viewer(viewer)
, _view(nullptr)
{}

bool handle(const osgGA::GUIEventAdapter& ea, osgGA::GUIActionAdapter& aa)
{
if (ea.getEventType() == osgGA::GUIEventAdapter::KEYUP && (ea.getKey() == 'v' || ea.getKey() == 'V'))
{
if (_view)
{
OSG_NOTICE << "Existing view, remove it" << std::endl;
// parts of the scene get removed before the view gets destroyed.
// normally this is fine as things get handled by destructors.
// however, things that are still cached require the cache to be released
_view->setSceneData(nullptr);
// We need to remove the view after the event traversal is done to avoid invalidating iterators
_viewer->addUpdateOperation(new RemoveViewOperation(_view));
_view = nullptr;
}
else
{
OSG_NOTICE << "No existing view, create one" << std::endl;
_view = new osgViewer::View;
_view->setName("View two");

_view->setUpViewInWindow(800, 200, 1024, 768);


osg::ref_ptr text2 = new osgText::Text();
text2->setFont("times.ttf");
text2->setText("Here's some other text. It appears in the dynamically-added view. It ensures the default font gets used with a context that goes away, and that lives in the cache.");
osg::ref_ptr autoTransform2 = new osg::AutoTransform();
 

[osg-users] Bug with applying global default attributes?

2020-01-29 Thread OpenSceneGraph Users


I have been testing with trunk and have only come across one problem so 
far (this might not be a new issue).


I have a simple viewer set up with two nodes.  The first is loaded from 
an osgb.  Internally it sets the glBlendFunci(0, GL_MAX) via 
osg::BlendFunci.


The second node also sets glBlendFunci(0, GL_MAX).  This is a geode with 
a geometry node under it.  I am setting the blend attributes on the 
geometry state set.


At runtime the attribute on node two is set correctly but then 
immediately changed again by State::ApplyGlobalDefaultAttribute to 
GL_FUNC_ADD.  The blend equation is also stepped on in a similar way.  I 
am using apitrace to see the GL calls.


GL_FUNC_ADD is not part of either node that I can see.  However, this 
problem does not occur with, for example, axes.osgt used as node one.


I could use some advice on tracking down where this default value is 
coming from, and why it is overriding a specific node attribute like this.


Thanks,

Rob






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


Re: [osg-users] OpenSceneGraph-3.6.5 release candidate 2 tagged, please test

2020-01-29 Thread OpenSceneGraph Users
Hi Robert,

I'm reasonably sure that Fabian's crash isn't the same issue as that 
example exposes.


>>- Fabian has done something weird with either OSG or OpenMW that 
>>hasn't been specified yet.
>>
>> If the codebase is the same perhaps it comes down to a sensitivity to 
> compiler version or dependencies?
>

We have official builds for a variety of Linux distros, Windows and MacOS 
(and semi-official builds for Android that are generally less reliable) so 
we should have pretty good coverage with known-good dependency and tooling 
versions. As I've mentioned before, the most likely culprit for this 
suddenly appearing for Fabian is that we pretty much never link to OSG 
statically. It's a nightmare on Windows (I don't think anyone's even 
attempted it in the last five years) but is more feasible on Linux, where 
the majority of our contributors are, so I've put out a call for other 
testers to try and reproduce the problem.



Also, Robert, I'm assuming you don't have a copy of Morrowind to test 
OpenMW with. Right now, Steam, GreenManGaming and Fanatical are all 
offering it for less than £4, but at least one of those sales ends in less 
than twenty hours. If you're not keen, £4 is a reasonable investment for me 
to make to increase cooperation between our projects, but it would help if 
you got back to me quickly.

Thanks,

Chris

On Wednesday, 29 January 2020 14:46:02 UTC, OpenSceneGraph Users wrote:
>
> Hi Chris,
>
> Thanks the links.  I've tracked down the example you created and re-run it 
> on my system and on the scene graph creation of the second window/view I 
> get text without textures.  
>
> In summary:
>>
>>- Fabian has done something weird with either OSG or OpenMW that 
>>hasn't been specified yet.
>>
>> If the codebase is the same perhaps it comes down to a sensitivity to 
> compiler version or dependencies?
>
>>
>>- It's beginning to feel like you're misspelling OpenMW deliberately.
>>
>> Sigh.  I likely have dyslexia, while I've never been formally diagnosed I 
> have the traits, the downside is that I regularily get letters wrong, don't 
> spot mispellings.  This isn't personal, it's just an issue I have to deal 
> with, and unfortunately as I read/wrote code and read/write email the 
> community also have to accept that I don't get everything right every 
> time.  In other ways my brain functions pretty well so overall I can still 
> be productive.
>
>
>>- Regarding the as-yet unresolved default font/object cache not being 
>>released issue I reported in March, the ball was left in your court with 
>>nothing more I could do. Hopefully enough has been linked above that we 
>> can 
>>move forward with that again if you've got more time now.
>>
>>
> If this is the one that the attached example recreates then I will be 
> looking into this today.
>  
>

-- 
You received this message because you are subscribed to the Google Groups 
"OpenSceneGraph Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to osg-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/osg-users/73cd3f2d-7a89-4ded-b247-e3586cea02ca%40googlegroups.com.
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


[osg-users] DefaultFont crash issue

2020-01-29 Thread OpenSceneGraph Users
Hi Robert,

In relation to the DefaultFont crash issue, I noticed that my code would
occasionally crash on creation of osgText::Text.
Most of my osgText::Text is not created on the main thread.
In order to avoid the DefaultFont crash, I created a
osg::ref_ptr necessaryFont = osgText::Font::getDefaultFont();
which sticks around from the beginning of the program to the end and
doesn't get used by anything.
After I did this, my code no longer crashed on osgText::Text creation.
The OpenSceneGraph version used is 3.6.4 and on both Windows (7 64-bit) and
Linux (Ubuntu 16.04).
Also when I was previously using OpenSceneGraph version 3.6.2,
osgText::Text creation never crashed.

Regards,
Anna



On Wed, Jan 29, 2020 at 5:15 PM OpenSceneGraph Users <
osg-users@lists.openscenegraph.org> wrote:

> Hi Robert,
>
> I'm reasonably sure that Fabian's crash isn't the same issue as that
> example exposes.
>
>
>>>- Fabian has done something weird with either OSG or OpenMW that
>>>hasn't been specified yet.
>>>
>>> If the codebase is the same perhaps it comes down to a sensitivity to
>> compiler version or dependencies?
>>
>
> We have official builds for a variety of Linux distros, Windows and MacOS
> (and semi-official builds for Android that are generally less reliable) so
> we should have pretty good coverage with known-good dependency and tooling
> versions. As I've mentioned before, the most likely culprit for this
> suddenly appearing for Fabian is that we pretty much never link to OSG
> statically. It's a nightmare on Windows (I don't think anyone's even
> attempted it in the last five years) but is more feasible on Linux, where
> the majority of our contributors are, so I've put out a call for other
> testers to try and reproduce the problem.
>
>
>
> Also, Robert, I'm assuming you don't have a copy of Morrowind to test
> OpenMW with. Right now, Steam, GreenManGaming and Fanatical are all
> offering it for less than £4, but at least one of those sales ends in less
> than twenty hours. If you're not keen, £4 is a reasonable investment for me
> to make to increase cooperation between our projects, but it would help if
> you got back to me quickly.
>
> Thanks,
>
> Chris
>
> On Wednesday, 29 January 2020 14:46:02 UTC, OpenSceneGraph Users wrote:
>>
>> Hi Chris,
>>
>> Thanks the links.  I've tracked down the example you created and re-run
>> it on my system and on the scene graph creation of the second window/view I
>> get text without textures.
>>
>> In summary:
>>>
>>>- Fabian has done something weird with either OSG or OpenMW that
>>>hasn't been specified yet.
>>>
>>> If the codebase is the same perhaps it comes down to a sensitivity to
>> compiler version or dependencies?
>>
>>>
>>>- It's beginning to feel like you're misspelling OpenMW deliberately.
>>>
>>> Sigh.  I likely have dyslexia, while I've never been formally diagnosed
>> I have the traits, the downside is that I regularily get letters wrong,
>> don't spot mispellings.  This isn't personal, it's just an issue I have to
>> deal with, and unfortunately as I read/wrote code and read/write email the
>> community also have to accept that I don't get everything right every
>> time.  In other ways my brain functions pretty well so overall I can still
>> be productive.
>>
>>
>>>- Regarding the as-yet unresolved default font/object cache not
>>>being released issue I reported in March, the ball was left in your court
>>>with nothing more I could do. Hopefully enough has been linked above that
>>>we can move forward with that again if you've got more time now.
>>>
>>>
>> If this is the one that the attached example recreates then I will be
>> looking into this today.
>>
>>
> --
> You received this message because you are subscribed to the Google Groups
> "OpenSceneGraph Users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to osg-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/osg-users/73cd3f2d-7a89-4ded-b247-e3586cea02ca%40googlegroups.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


Re: [osg-users] DefaultFont crash issue

2020-01-29 Thread OpenSceneGraph Users
Hi all,

I have new information about what Fabian has done that's weird. When he's 
been saying he's doing static linking, he's not doing what most people 
would associate that phrase with (i.e. building OSG to a library file such 
that all code is contained within and consuming that when linking OpenMW). 
Instead, it's more like what CMake calls an object library - he's building 
dependencies to intermediate-representation object files, but only doing 
translation to native code and linking once when everything's an object 
file. I wouldn't be surprised if this puts static initialisers and 
destructors in orders they've never been in before and that's what's 
causing the problem.

Hopefully this will point the investigation in the right direction.

Cheers,

Chris

On Wednesday, 29 January 2020 22:38:08 UTC, OpenSceneGraph Users wrote:
>
> Hi Robert,
>
> In relation to the DefaultFont crash issue, I noticed that my code would 
> occasionally crash on creation of osgText::Text. 
> Most of my osgText::Text is not created on the main thread. 
> In order to avoid the DefaultFont crash, I created a 
> osg::ref_ptr necessaryFont = 
> osgText::Font::getDefaultFont();
> which sticks around from the beginning of the program to the end and 
> doesn't get used by anything.
> After I did this, my code no longer crashed on osgText::Text creation.
> The OpenSceneGraph version used is 3.6.4 and on both Windows (7 64-bit) 
> and Linux (Ubuntu 16.04).
> Also when I was previously using OpenSceneGraph version 3.6.2, 
> osgText::Text creation never crashed.
>
> Regards,
> Anna
>
>
>
> On Wed, Jan 29, 2020 at 5:15 PM OpenSceneGraph Users <
> osg-...@lists.openscenegraph.org > wrote:
>
>> Hi Robert,
>>
>> I'm reasonably sure that Fabian's crash isn't the same issue as that 
>> example exposes.
>>
>>
- Fabian has done something weird with either OSG or OpenMW that 
hasn't been specified yet.

 If the codebase is the same perhaps it comes down to a sensitivity to 
>>> compiler version or dependencies?
>>>
>>
>> We have official builds for a variety of Linux distros, Windows and MacOS 
>> (and semi-official builds for Android that are generally less reliable) so 
>> we should have pretty good coverage with known-good dependency and tooling 
>> versions. As I've mentioned before, the most likely culprit for this 
>> suddenly appearing for Fabian is that we pretty much never link to OSG 
>> statically. It's a nightmare on Windows (I don't think anyone's even 
>> attempted it in the last five years) but is more feasible on Linux, where 
>> the majority of our contributors are, so I've put out a call for other 
>> testers to try and reproduce the problem.
>>
>>
>>
>> Also, Robert, I'm assuming you don't have a copy of Morrowind to test 
>> OpenMW with. Right now, Steam, GreenManGaming and Fanatical are all 
>> offering it for less than £4, but at least one of those sales ends in less 
>> than twenty hours. If you're not keen, £4 is a reasonable investment for me 
>> to make to increase cooperation between our projects, but it would help if 
>> you got back to me quickly.
>>
>> Thanks,
>>
>> Chris
>>
>> On Wednesday, 29 January 2020 14:46:02 UTC, OpenSceneGraph Users wrote:
>>>
>>> Hi Chris,
>>>
>>> Thanks the links.  I've tracked down the example you created and re-run 
>>> it on my system and on the scene graph creation of the second window/view I 
>>> get text without textures.  
>>>
>>> In summary:

- Fabian has done something weird with either OSG or OpenMW that 
hasn't been specified yet.

 If the codebase is the same perhaps it comes down to a sensitivity to 
>>> compiler version or dependencies?
>>>

- It's beginning to feel like you're misspelling OpenMW 
deliberately.

 Sigh.  I likely have dyslexia, while I've never been formally diagnosed 
>>> I have the traits, the downside is that I regularily get letters wrong, 
>>> don't spot mispellings.  This isn't personal, it's just an issue I have to 
>>> deal with, and unfortunately as I read/wrote code and read/write email the 
>>> community also have to accept that I don't get everything right every 
>>> time.  In other ways my brain functions pretty well so overall I can still 
>>> be productive.
>>>
>>>
- Regarding the as-yet unresolved default font/object cache not 
being released issue I reported in March, the ball was left in your 
 court 
with nothing more I could do. Hopefully enough has been linked above 
 that 
we can move forward with that again if you've got more time now.


>>> If this is the one that the attached example recreates then I will be 
>>> looking into this today.
>>>  
>>>
>> -- 
>> You received this message because you are subscribed to the Google Groups 
>> "OpenSceneGraph Users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an 
>> email to osg-...@googlegroups.com .
>> To view this 

Re: [osg-users] Osg Text issues

2020-01-29 Thread OpenSceneGraph Users
Hi Dan,

Thanks for all the details.  Seeing a difference between the same scene 
graph in our Qt based viewer vs OSG suggests that the Qt side is changing 
OpenGL state, or setting up the graphics context+frame buffers in a 
different way to the OSG does.

I don't have any Qt expertise so can't help with that side of things, 
perhaps other OSG/Qt users can help, or perhaps the Qt community can 
provide guidance on what OpenGL state it sets.  The OSG can't change OpenGL 
state that it isn't aware of, but if you can tell the OSG about this state 
via the osg::State::haveApplied*() calls:


   /** Mode has been set externally, update state to reflect this 
setting.*/
void haveAppliedMode(StateAttribute::GLMode 
mode,StateAttribute::GLModeValue value);

/** Mode has been set externally, therefore dirty the associated 
mode in osg::State
  * so it is applied on next call to osg::State::apply(..)*/
void haveAppliedMode(StateAttribute::GLMode mode);

/** Attribute has been applied externally, update state to reflect 
this setting.*/
void haveAppliedAttribute(const StateAttribute* attribute);

/** Attribute has been applied externally,
  * and therefore this attribute type has been dirtied
  * and will need to be re-applied on next osg::State.apply(..).
  * note, if you have an osg::StateAttribute which you have applied 
externally
  * then use the have_applied(attribute) method as this will cause 
the osg::State to
  * track the current state more accurately and enable lazy state 
updating such
  * that only changed state will be applied.*/
void haveAppliedAttribute(StateAttribute::Type type, unsigned int 
member=0);

At a guess I'd suggest it's the blending or texture filter that could amiss.

Robert.

-- 
You received this message because you are subscribed to the Google Groups 
"OpenSceneGraph Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to osg-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/osg-users/5e1fdbad-48f0-4a9e-8df8-42a9330cd3c5%40googlegroups.com.
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] OpenSceneGraph-3.6.5 release candidate 2 tagged, please test

2020-01-29 Thread OpenSceneGraph Users
Hi Fabian,

On Wednesday, 29 January 2020 00:24:35 UTC, Fabian Roth wrote:
>
> Hi Chris,
> I am using the latest openmw master with the compatibility patch from the 
> pull request cherry picked, my build changes and minor other tweaks.
> I use the osg rc with a only a cmake version change.
> The branches are here:
> https://github.com/Eli2/openmw/tree/eli2-openmw-static
> https://github.com/Eli2/OpenSceneGraph/tree/eli2-openmw-static
>
> By now i strongly suspect i run into the "Static Initialization Order 
> Fiasco", as described here:
> https://cryptopp.com/wiki/Static_Initialization_Order_Fiasco
>
> I am currently looking into why my build uses the default font.
>

The way that the singleton methods are done is an attempt to resolve the 
construction order issue, but l don't recall a focus on the destruction 
side.  It could well be an issue.

One workaround might be to add a mutex directly to the Font objects that 
are being destructed rather than using the global one.  Or, to explicitly 
clear the ObjectCache on destruction rather than leaving it to static clean 
up.  The later would be my preferred approach.

A call to:

   osgDB::Registry::instance()->getObjectCache()->clear();

In application clean up should be sufficient, or force the destruction of 
the Registry singleton:

   osgDB::Registry::instance(true);   // passing in true forces the 
destruction, yes a bit hacky... the OSG has a long history so can't recall 
the circumstances of that addition...

I will hold the 3.6.5 release back till we have some conclusion on this 
issue, in case we need to make changes to the core OSG.

Cheers,
Robert.





 

-- 
You received this message because you are subscribed to the Google Groups 
"OpenSceneGraph Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to osg-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/osg-users/dff4e0d7-343b-4893-bdeb-23e60528f42d%40googlegroups.com.
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org