[osg-users] Shader composition with multiple function injection

2018-05-12 Thread Hartwig Wiesmann
Hi,

I had a look at the shader composition example. The main shader looks like this:

Code:

#pragma import_defines ( LIGHTING, TEXTURE_2D, VERTEX_FUNC(v) )

#ifdef LIGHTING
// forward declare lighting computation, provided by lighting.vert shader
void directionalLight( int lightNum, vec3 normal, inout vec4 color );
#endif

#ifdef TEXTURE_2D
varying vec2 texcoord;
#endif

#ifdef VERTEX_FUNC
uniform float osg_SimulationTime;
#endif

varying vec4 basecolor;

void main(void)
{
basecolor = gl_Color;

#ifdef LIGHTING
directionalLight( 0, gl_Normal.xyz, basecolor);
#endif

#ifdef TEXTURE_2D
// if we want texturing we need to pass on texture coords
texcoord = gl_MultiTexCoord0.xy;
#endif

#ifdef VERTEX_FUNC
gl_Position   = gl_ModelViewProjectionMatrix * VERTEX_FUNC(gl_Vertex);
#else
gl_Position   = gl_ModelViewProjectionMatrix * gl_Vertex;
#endif

}




In the example code one directional light computation can be injected. What is 
the best solution if I like to inject 0 to N directional lights where N is 
runtime dependent?

I could do something like:

Code:

#ifdef LIGHTING0
directionalLight( 0, gl_Normal.xyz, basecolor);
#endif
#ifdef LIGHTING1
directionalLight( 1, gl_Normal.xyz, basecolor);
#endif
#ifdef LIGHTING2
directionalLight( 2, gl_Normal.xyz, basecolor);
#endif
...




but this is not very elegant. Though I do not see any other possibility. Am I 
missing a better solution?

Thank you!

Cheers,
Hartwig

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





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


[osg-users] Draping polygons on existing objects using stencil shadow volumes

2018-04-05 Thread Hartwig Wiesmann
Hi,

I would like to implement draping of objects using stencil shadow volumes. To 
do so I have to do the following steps:

1) Draw the scene's objects
2) Start multi-pass rendering for the stencil shadow volumes
2a) Clear the stencil buffer
2b) Set the attributes for the first pass and draw the volume mask
2c) Set the attributes for the second pass and draw the to be draped polygons

As also other parts of the scene might use the stencil buffer I cannot just 
clear the stencil buffer.
Any ideas how to solve this issue? Or do I have to move all this stuff in the 
last run render bin?

I had a look at ShadowVolume (that should be similar) but I have no clue what 
kind of manipulations with respect to the render stage are done and why they 
are done (in "cull") because I am not so familiar with render bins and render 
stages.

Thank you!

Cheers,
Hartwig

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





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


Re: [osg-users] osgshadow.cpp option --sv (ShadowVolume) not working

2018-04-02 Thread Hartwig Wiesmann
Hi Robert,

I found out that no indices are generated for the occluder geometry. Though I 
do not know if this is required.

Furthermore, TriangleCollector (inside OccluderGeometry) defines 
_tempoaryTriangleVertices but I could not find anywhere a statement that 
actually assigns anything to the list.

Thank you!

Cheers,
Hartwig

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





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


[osg-users] osgshadow.cpp option --sv (ShadowVolume) not working

2018-04-02 Thread Hartwig Wiesmann
Hi,

I am using OSG 3.5.10 and trying to run the example osgshadow.cpp with the --sv 
(ShadowVolume) option. Unfortunately, no shadows are shown. All other 
techniques are showing shadows.
Any ideas? Are there any known shortcomings with ShadowVolume?

I am running the example on

mac OS 11.3
OSG 3.5.10
ShaderPipeline disabled

Thank you!

Cheers,
Hartwig

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





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


Re: [osg-users] AutoTransform, ROTATE_TO_SCREEN and small feature culling

2018-03-30 Thread Hartwig Wiesmann
Hi Robert,

I want to come back to my original remark that culling does not work correctly 
with AutoTransforms and ROTATE_TO_SCREEN.

I have modified the example osgautotransform.cpp by adding a new class that 
contains an AutoTransform and a drawable. An object of this class is added to 
the scene (createScene has been extended; basically the shown code replaces the 
original createScene method):


Code:

class AutoScaledBox : public osg::Node
{
public:

AutoScaledBox(void) : m_AutoTransformPtr(nullptr)
{
this->initialize();
}

AutoScaledBox(AutoScaledBox const& autoScaledRectangle, osg::CopyOp 
const& copyOperator=osg::CopyOp::SHALLOW_COPY) : 
osg::Node(autoScaledRectangle,copyOperator), 
m_AutoTransformPtr(autoScaledRectangle.m_AutoTransformPtr)
{
}

META_Node("",AutoScaledBox)

virtual osg::BoundingSphere computeBound(void) const override
{
if (m_AutoTransformPtr)
return m_AutoTransformPtr->computeBound();
else
return osg::BoundingSphere();
}

virtual void traverse(osg::NodeVisitor& nodeVisitor) override
{
if (m_AutoTransformPtr)
m_AutoTransformPtr->accept(nodeVisitor);
}

void setPosition(osg::Vec3 const& position)
{
if (m_AutoTransformPtr)
m_AutoTransformPtr->setPosition(position);
}

protected:
void initialize(void)
{
osg::ShapeDrawable* shapeDrawablePtr(new osg::ShapeDrawable());

shapeDrawablePtr->setShape(new osg::Box(osg::Vec3(),4.0f));

m_AutoTransformPtr = new osg::AutoTransform();
m_AutoTransformPtr->addChild(shapeDrawablePtr);

m_AutoTransformPtr->setAutoRotateMode(osg::AutoTransform::ROTATE_TO_SCREEN);
m_AutoTransformPtr->setAutoScaleToScreen(true);
}

private:
osg::ref_ptr m_AutoTransformPtr;
};

osg::Node* createAutoScaledBox(osg::Vec3 const& position)
{
AutoScaledBox* autoScaledRectanglePtr(new AutoScaledBox());


autoScaledRectanglePtr->setPosition(position);
return autoScaledRectanglePtr;
}

osg::Node* createScene()
{
osg::Group* root = new osg::Group;

//int numReps = ;
int numReps = 10;

root->addChild(createAxis(osg::Vec3(0.0,0.0,0.0),osg::Vec3(1000.0,0.0,0.0),numReps,osg::AutoTransform::ROTATE_TO_CAMERA,osgText::Text::XY_PLANE,
 "ROTATE_TO_CAMERA"));

root->addChild(createAxis(osg::Vec3(0.0,0.0,0.0),osg::Vec3(0.0,1000.0,0.0),numReps,osg::AutoTransform::ROTATE_TO_SCREEN,osgText::Text::XY_PLANE,
 "ROTATE_TO_SCREEN"));

root->addChild(createAxis(osg::Vec3(0.0,0.0,0.0),osg::Vec3(0.0,0.0,1000.0),numReps,osg::AutoTransform::NO_ROTATION,osgText::Text::XZ_PLANE,
 "NO_ROTATION"));

root->addChild(createAutoScale(osg::Vec3(500.0,500.0,500.0), 25.0, 
"AutoScale with no min, max limits"));
root->addChild(createAutoScale(osg::Vec3(500.0,500.0,300.0), 25.0, 
"AutoScale with minScale = 1, maxScale = 2.0 ", 1, 2.0));
root->addChild(createAutoScale(osg::Vec3(500.0,500.0,700.0), 25.0, 
"AutoScale with minScale = 0.0, maxScale = 5.0 ", 0.0, 5.0));


root->addChild(createAutoScaledBox(osg::Vec3(100.0f,100.0f,100.0f)));

return root;
}




If nothing else is modified you will see an additional small box at 100; 100; 
100.

Now, I additionally set the small feature culling pixel size to a relatively 
large value during the initialisation of the view:

Code:
view->getCamera()->setSmallFeatureCullingPixelSize(200.0f);



Afterwards, all the axis labels disappear (as expected) but the small box is 
still visible! But from my understanding this small box should also be culled.
Zooming in and out let the labels appear and disappear but the box remains 
visible all the time.

Cheers,
Hartwig

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





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


Re: [osg-users] AutoTransform, ROTATE_TO_SCREEN and small feature culling

2018-03-29 Thread Hartwig Wiesmann
Hi Robert,

what I would like to produce is an object that is always oriented towards the 
user (screen) and has the same size independent of the zoom level. Though the 
zoom level is limited in a certain range by an additional LOD.
Therefore, I think that AutoTranslate is the only viable option, or?

Thank you!

Cheers,
Hartwig

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





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


Re: [osg-users] AutoTransform, ROTATE_TO_SCREEN and small feature culling

2018-03-27 Thread Hartwig Wiesmann
Hi Robert,

I was not talking about the cullingActive flag but the method isCullingActive! 
isCullingActive checks besides the cullingActive flag if the boundary sphere is 
valid. As long as the boundary sphere is invalid isCullingActive() returns 
false. This is the problem I reported.


Code:
inline bool isCullingActive() const { return _numChildrenWithCullingDisabled==0 
&& _cullingActive && getBound().valid(); }




Cheers,
Hartwig

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





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


Re: [osg-users] Show part of geometry which intersects a specific area

2018-03-26 Thread Hartwig Wiesmann
Hi,

you may use a PolytopeIntersector to get all items intersecting the rectangle. 
Afterwards, you may modify the node mask of the found items: set a specific bit 
of the node mask to one if it is found by the PolytopeIntersector and to zero 
if not (by implementing a visitor inspecting the scene). The camera will then 
cull all items that have a zero in the node mask.

You may also write your own visitor that is doing this checking and sets the 
node mask of the visited drawables at the same time.

Cheers,
Hartwig

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





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


[osg-users] AutoTransform, ROTATE_TO_SCREEN and small feature culling

2018-03-26 Thread Hartwig Wiesmann
Hi,

I found a very old article covering this issue: 
https://www.mail-archive.com/osg-users@lists.openscenegraph.org/msg15948.html. 
In the meantime it seems to be that proposal (2) has been implemented and the 
AutoTransform's computeBound() method returns an invalid bounding sphere during 
the first cull traversal. Nevertheless, when checking in the example 
osgautotransform.cpp the bounding spheres (of the text messages) remain 
invalid. To check this I have added an update callback to the AutoTransforms 
that only checks the validity of the bounding sphere.

Now, if the bounding sphere remains invalid culling of the AutoTransform's 
children will not be correctly performed because the AutoTransform's 
isCullingActive method will always return false (bounding sphere is invalid).

To solve this issue I was thinking to add a ComputeBoundingSphere callback or 
an update callback to the AutoTransform. But this is not a good solution 
because in this case I have to calculate always a new bounding sphere as I do 
not have access to the node's "_boundingSphereComputed" flag.

Another solution is to patch the node's getBound() method that will set the 
flag "_boundingSphereComputed" only to true if a valid "_boundingSphere" 
exists. This sounds reasonable in any case:

Code:
inline const BoundingSphere& getBound() const
{
if(!_boundingSphereComputed)
{
_boundingSphere = _initialBound;
if (_computeBoundCallback.valid())

_boundingSphere.expandBy(_computeBoundCallback->computeBound(*this));
else
_boundingSphere.expandBy(computeBound());

_boundingSphereComputed = _boundingSphere.valid();
}
return _boundingSphere;
}



But I do not know if this breaks anything.

Is there any other method to get a valid bounding sphere for the AutoTransform 
without sacrificing performance?

Thank you!

Cheers,
Hartwig

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





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


[osg-users] Encoding of text files

2018-03-25 Thread Hartwig Wiesmann
Hi,

I have coincidentally recognised (when looking at merge differences) that at 
least one text file (AUTHORS.txt) is encoded using ISO Latin 1. Wouldn't it be 
a good idea to use UTF-8 (or a different UTF encoding) for these type of files?

Probably, AUTHORS.txt is anyway the only file where it matters (because of all 
the non-alphabet characters people have in their names :D).

PS: It is not really important but as I said, just a coincidence.

Cheers,
Hartwig

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





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


Re: [osg-users] DatabasePager::DatabaseThread is crashing when DatabasePager has been deleted

2018-03-25 Thread Hartwig Wiesmann
Hi Robert,

I tested the modifications (using mac OS, modified OSG 3.5.10) and did not have 
any crashes anymore.

Thank you!

Cheers,
Hartwig

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





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


Re: [osg-users] DatabasePager::DatabaseThread is crashing when DatabasePager has been deleted

2018-03-25 Thread Hartwig Wiesmann
Hi Robert,

I will try. My problem is that in my test project the database pager seems to 
be (time wise) initialised differently than in my real project.

Let's see.

Cheers,
Hartwig

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





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


Re: [osg-users] DatabasePager::DatabaseThread is crashing when DatabasePager has been deleted

2018-03-25 Thread Hartwig Wiesmann
Hi Robert,

sorry, that it was not clear enough. What I tried to explain is in summary that 
the database pager starts twice as many threads as it should but keeps track of 
only half of them. Therefore, when the viewer is closed the database pager only 
cancels half of them while the other half is still running. And the still 
running threads then access via the "_pager" pointer the non-existing database 
pager.

This is what happens in details and what I tried to explain by pasting the 
relevant code previously:
The database pager keeps track of the running threads in "_databaseThreads". 
When setting up "_databaseThreads" (currently empty) in requestNodeFile the 
threads are immediately created and started (in "setUpThreads"). To be precise, 
the threads are actually started in Thread::start() which is called from 
"setUpThreads".
At this moment N threads have been created, started and are tracked in 
"_databaseThreads".
Afterwards, the mentioned for-loop starts again(!) N threads but uses the same 
list (namely "_databaseThreads") to track them. Therefore, from the now running 
2*N threads N are running untracked.

This can also be seen when looking with a debugger at the number of threads the 
database pager has been generated.

This bug can be solved by

a) moving the "_startThreadCalled" assignment further down

Code:
_done = false;
OSG_INFO<<"DatabasePager::startThread()"<getNumOfDatabaseThreadsHint(),

osg::DisplaySettings::instance()->getNumOfHttpDatabaseThreadsHint());
}

for(DatabaseThreadList::const_iterator 
dt_itr = _databaseThreads.begin();
dt_itr != _databaseThreads.end();
++dt_itr)
{
(*dt_itr)->startThread();
}
_startThreadCalled = true;




or 

b) inserting an else-statement to start either only newly added or the already 
existing threads


Code:
_startThreadCalled = true;
_done = false;
OSG_INFO<<"DatabasePager::startThread()"<getNumOfDatabaseThreadsHint(),

osg::DisplaySettings::instance()->getNumOfHttpDatabaseThreadsHint());
}
else
for(DatabaseThreadList::const_iterator 
dt_itr = _databaseThreads.begin();
dt_itr != _databaseThreads.end();
++dt_itr)
{
(*dt_itr)->startThread();
}




Which solution is chosen is a matter of taste.

I also recommend to document the functionality of "_startThreadCalled" because 
the wrong usage (or better hidden effects) of this flag in the above mentioned 
code causes the bug.

I can provide a patch but I first would like to make sure that my analysis are 
correct (I think so but I am not an expert).

Cheers,
Hartwig

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





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


Re: [osg-users] DatabasePager::DatabaseThread is crashing when DatabasePager has been deleted

2018-03-24 Thread Hartwig Wiesmann
Hi Robert,

I think that it has nothing to do with Clang or GCC. I did some further 
investigations and probably found the bug. In DatabasePager::requestNodeFile 
you find the following code:

Code:
if (!_startThreadCalled)
{
OpenThreads::ScopedLock lock(_run_mutex);

if (!_startThreadCalled)
{
_startThreadCalled = true;
_done = false;
OSG_INFO<<"DatabasePager::startThread()"<getNumOfDatabaseThreadsHint(),

osg::DisplaySettings::instance()->getNumOfHttpDatabaseThreadsHint());
}

#if 0
for(DatabaseThreadList::const_iterator 
dt_itr = _databaseThreads.begin();
dt_itr != _databaseThreads.end();
++dt_itr)
{
(*dt_itr)->startThread();
}
#endif




Thank you!

Cheers,
Hartwig

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





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


Re: [osg-users] DatabasePager::DatabaseThread is crashing when DatabasePager has been deleted

2018-03-24 Thread Hartwig Wiesmann
Hi,

I am using

 - OSG 3.5.10
 - mac OS 10.13
 - Clang 9.0


Cheers,
Hartwig

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





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


[osg-users] DatabasePager::DatabaseThread is crashing when DatabasePager has been deleted

2018-03-24 Thread Hartwig Wiesmann
Hi,

I have the following scenario:

1) A scene is using a database pager to load data by a pseudo-loader via the 
network; the viewer runs single threaded, the database pager uses default 
parameters 
2) When the database pager is still loading data via the network the viewer is 
closed.
3) Because of the closing of the viewer the database pager's destructor is 
called but it seems to be that the database threads are still running (I put 
some output at the end of the database pager's destructor and inside database 
pager's database threads and the database threads are still producing output).
Looking at the database pager's destructor the threads are not finished but 
will stop only when their current task has finished, I think.
4) The database thread will crash at

Code:
DatabasePager::FindCompileableGLObjectsVisitor stateToCompile(_pager, 
_pager->getMarkerObject());

 inside DatabasePager::DatabaseThread::run().
5) The reason for the crash is that DatabaseThread uses a simple pointer to the 
database pager. But the database pager is gone and therefore the stored pointer 
("_pager") became invalid!

Am I doing anything wrong or is this a bug in OSG?

I think that "_pager" should be at least an observer of the database pager 
pointer and not a bare pointer. Or the destructor of DatabasePager must 
invalidate all its references stored in DatabasePager::DatabaseThread.

Cheers,
Hartwig

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





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


Re: [osg-users] Prevention of near plane culling while moving camera

2018-03-10 Thread Hartwig Wiesmann
Hi,

sorry not to be precise. I actually meant clipping.

When the camera is placed perpendicular to the scene (a large plane with some 
objects on it) everything can be seen. If the camera is looking at the scene 
under an angle of 70 degrees (between look-vector and plane's normal) the lower 
part (or better the lower element fragments) is clipped(!).

I know it has to do with the clear/far ratio and therefore I would like to 
limit the camera movement. To do so I am checking if there are primitives that 
are going to be clipped. If this is the case I backtrack the camera.
But this leads to some flicker.

How can I implement a logarithmic z-buffer when not using shaders?


Thank you!

Cheers,
Hartwig

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





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


[osg-users] Prevention of near plane culling while moving camera

2018-03-09 Thread Hartwig Wiesmann
Hi,

In my dynamic scene (objects can be added or removed) I use a perspective 
projection and automatic near and far plane calculation. To prevent during 
camera movement culling of objects between the camera and the near plane I 
calculate before each camera movement if there are objects in the pyramid built 
by the camera's location and the near plane. This is done by using a polytope 
intersector. If there are objects in-between I limit the camera movement.

If the movement of the camera is moderate everything works fine but if there 
are big steps in the camera movement I still see near plane culling (for one 
frame or so). Because due to the camera movement the near plane will also 
change and therefore my calculation is slightly wrong for the next frame, I 
suppose. But this change of the near plane will only be calculated in the next 
cull traversal and my correction will be again corrected in the next movement 
and therefore the flicker, I guess.

I have already tried to use a slightly larger FOV or further near plane for the 
pyramid but this does not really help (the flicker can still be seen). 
Especially when the camera is looking more parallel to the scene.

I fear that I have to give up automatic near and far calculation or what are 
you doing in such a case?

If I have to give up automatic near-far calculation I basically have to do 
before finalising the camera movement a new near-far calculation and if there 
are still collisions limit or correct the camera movement or adjust the near 
plane. But this basically means that I have to run my own cull traversal. Or 
are there any other solutions?

PS: As the scene is dynamic I cannot pre-calculate the near and far planes.

Thank you for your suggestions in advance!

Cheers,
Hartwig

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





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


Re: [osg-users] Database pager and failed loading of PagedLOD's children

2018-03-04 Thread Hartwig Wiesmann
Hi Robert,

the problem seems to be that the database pager (respectively the paged LOD) 
keeps trying to load the node that fails to load. To stop this I somehow have 
to tell the paged LOD to stop loading the children, or I have to modify the 
limits. But for doing so I need to know when a child fails to load.


Cheers,
Hartwig

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





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


[osg-users] Database pager and failed loading of PagedLOD's children

2018-03-04 Thread Hartwig Wiesmann
Hi, 

I use PagedLODs and the database pager to load dynamically nodes. Here is the 
pseudo code: 


Code:

pagedLOD->addChild(nodePtr,limit,std::numeric_limits::max); 
pagedLOD->setFileName(1,fileName); 
pagedLOD->setRange(1,0.0,limit); 




In case the pseudo-loader for fileName fails I would like to keep the child at 
position zero (here called nodePtr). 

What is the best method to achieve this? 

Thank you! 

Cheers, 
Hartwig

PS: Sorry for posting this item also in the wrong forum. :'

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





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


Re: [osg-users] Online documentation not available

2018-02-07 Thread Hartwig Wiesmann
Hi Jordi,

there are some more old links:

 - Downloads/Developer Releases
 - Downloads/Data resources
x Link to old repo
x Link to Nasa's blue marble website 

Cheers,
Hartwig

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





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


Re: [osg-users] Online documentation not available

2018-02-05 Thread Hartwig Wiesmann
Hi Jordi,

thanks for updating the links!

This does not belong to the original topic but is similar. Besides looking for 
documentation a lot of people look at the download links. Here also very old 
links are mentioned (to SVN repos) for stable and developer releases.
I think that not a lot has to be changed - maintaining a website takes a lot of 
time, I know - but only links to the GitHub branches should be mentioned, too 
(can be found in the repo section but...). Or just a link to look at the repos 
page. Otherwise it looks poor to have links to more than 2 year old versions 
only.

Cheers,
Hartwig

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





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


Re: [osg-users] Online documentation not available

2018-02-04 Thread Hartwig Wiesmann
Hi,

I used the ones on this page:

http://www.openscenegraph.org/index.php/documentation/guides/reference-guides

Thank you!

Cheers,
Hartwig

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





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


[osg-users] Online documentation not available

2018-02-03 Thread Hartwig Wiesmann
Hi,

it seems to be that the server for the online documentation is not available. 
Has the server been switched off or is it temporarily not available? 

Cheers,
Hartwig

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





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


Re: [osg-users] XML serialisation issues / examples

2018-01-16 Thread Hartwig Wiesmann
Hi Robert,

I did the tests using 3.4.2 and had a look at source files of a more recent 
version (3.5.x) but did not find any real differences.

The ASCII and binary files - according to my experience and usage - seem to be 
OK.


Cheers,
Hartwig

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





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


[osg-users] XML serialisation issues / examples

2018-01-15 Thread Hartwig Wiesmann
Hi,

as previously mentioned there are some issues when using serialisation with 
XML. Here is a small code snippet:

Code:

#define USE_BRACKETS 1
#define USE_USER_SERIALIZER 1

namespace TestOSG
{
class TestStruct : public osg::Object
{
public:
TestStruct(void)
{
}
TestStruct(TestStruct const& test, osg::CopyOp const& 
copyOperator=osg::CopyOp::SHALLOW_COPY)

:osg::Object(test,copyOperator),
 m_From(test.m_From), 
m_Till(test.m_Till)
{
}

META_Object(TestOSG,TestStruct);

osg::Vec3 m_From;
osg::Vec3 m_Till;

osg::Vec3 const& getFrom(void) const {return m_From;}
osg::Vec3 const& getTill(void) const {return m_Till;}

void setFrom(osg::Vec3 const& from) {m_From = from;}
void setTill(osg::Vec3 const& till) {m_Till = till;}
};
}

namespace
{
bool checkTestSerialization(TestOSG::TestStruct const&)
{
return true;
}

bool readTestSerialization(osgDB::InputStream& inputStream, 
TestOSG::TestStruct& testData)
{
inputStream >> inputStream.BEGIN_BRACKET;
inputStream >> inputStream.PROPERTY("From") >> testData.m_From;
inputStream >> inputStream.PROPERTY("Till") >> testData.m_Till;
inputStream >> inputStream.END_BRACKET;
return true;
}

bool writeTestSerialization(osgDB::OutputStream& outputStream, 
TestOSG::TestStruct const& testData)
{
#if (USE_BRACKETS)
outputStream << outputStream.BEGIN_BRACKET << std::endl;
#endif
outputStream << outputStream.PROPERTY("From") << 
testData.m_From << std::endl;
outputStream << outputStream.PROPERTY("Till") << 
testData.m_Till << std::endl;
#if (USE_BRACKETS)
outputStream << outputStream.END_BRACKET << std::endl;
#endif
return true;
}
}

#if (USE_USER_SERIALIZER)
REGISTER_OBJECT_WRAPPER(TestStruct,

new TestOSG::TestStruct,

TestOSG::TestStruct,

"osg::Object TestOSG::TestStruct")
{
ADD_USER_SERIALIZER(TestSerialization);
}
#else
REGISTER_OBJECT_WRAPPER(TestStruct,

new TestOSG::TestStruct,

TestOSG::TestStruct,

"osg::Object TestOSG::TestStruct")
{
ADD_VEC3_SERIALIZER(From,osg::Vec3(1,0,0));
ADD_VEC3_SERIALIZER(Till,osg::Vec3(1,0,0));
}
#endif

extern "C" void wrapper_serializer_library_TestOSG(void)
{
}

USE_SERIALIZER_WRAPPER(TestStruct)




The output depends on the flags.

USE_BRACKETS == 1
USE_USER_SERIALIZER == 0 (OK):

< ?xml version="1.0" encoding="UTF-8" ?>
< TestOSG::TestStruct>
  < UniqueID attribute="1">
< From attribute="0 0 0" />
< Till attribute="0 0 0" />
  < /UniqueID>
< /TestOSG::TestStruct>

USE_BRACKETS == 1
USE_USER_SERIALIZER == 1 (wrong):

< ?xml version="1.0" encoding="UTF-8" ?>
< TestOSG::TestStruct>
  < UniqueID attribute="1">
< TestSerialization attribute="">
  < From attribute="0 0 0">
< Till attribute="0 0 0" />
  < /From>
< /TestSerialization>
  < /UniqueID>
< /TestOSG::TestStruct>


USE_BRACKETS == 0
USE_USER_SERIALIZER == 1 (wrong):

< ?xml version="1.0" encoding="UTF-8" ?>
< TestOSG::TestStruct>
  < UniqueID attribute="1">
< TestSerialization />
< From attribute="0 0 0" />
< Till attribute="0 0 0" />
  < /UniqueID>
< /TestOSG::TestStruct>

PS: I have added the space between "<" and the following xml text because 
otherwise the output does not show up.

Cheers,
Hartwig[/quote]

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





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


[osg-users] Serialization differences between ASCII and XML

2017-12-27 Thread Hartwig Wiesmann
Hi,

wrote a simple serialiser for the output of a range:


Code:

namespace
{
bool checkGeographicRange(osgPlanetCore::GeodeticData const&)
{
return true;
}

bool readGeographicRange(osgDB::InputStream& inputStream, 
osgPlanetCore::GeodeticData& geodeticData)
{
osgPlanetCore::GeographicRange geographicRange;


if (osgPlanetWrappers::readRange(inputStream,geographicRange))
{
geodeticData.setGeographicRange(geographicRange);
return true;
} /* if */
else
return false;
}

bool writeGeographicRange(osgDB::OutputStream& outputStream, 
osgPlanetCore::GeodeticData const& geodeticData)
{
outputStream << std::endl;
return 
osgPlanetWrappers::writeRange(outputStream,geodeticData.getGeographicRange());
}

} /* namespace */

template < typename Values >
bool readRange(osgDB::InputStream& inputStream, osgPlanetCore::Range< 
Values >& range)
{
inputStream >> inputStream.BEGIN_BRACKET;
inputStream >> inputStream.PROPERTY("FromValues") >> 
range.getFromValues();
inputStream >> inputStream.PROPERTY("TillValues") >> 
range.getTillValues();
inputStream >> inputStream.END_BRACKET;
return true;
}

template < typename Values >
bool writeRange(osgDB::OutputStream& outputStream, 
osgPlanetCore::Range< Values > const& range)
{
outputStream << outputStream.BEGIN_BRACKET << std::endl;
outputStream << outputStream.PROPERTY("FromValues") << 
range.getFromValues() << std::endl;
outputStream << outputStream.PROPERTY("TillValues") << 
range.getTillValues() << std::endl;
outputStream << outputStream.END_BRACKET << std::endl;
return true;
}





In a wrapper I call

Code:

ADD_USER_SERIALIZER(GeographicRange);




Basically serialisation should write / read two vectors indicating a lower and 
a higher limit of a geodetic range.

The ASCII output looks like:

GeographicRange 
{
FromValues -135 40.9799 -1 
TillValues -90 66.5133 1 
}

Which seems to be fine.

The XML output looks like:

  < FromValues attribute="-135 40.9799 -1" >
< TillValues attribute="-90 66.5133 1" >
 < /TillValues >
  < /FromValues >

Which is not really the same. Besides the fact that "GeographicRange" is gone 
completely.

How do I make the output of both versions the same?

Cheers,
Hartwig

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





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


Re: [osg-users] Serialization with virtual base classes

2017-12-26 Thread Hartwig Wiesmann
Hi Julien,

thanks for your reply.

I checked a couple of source files but it seems to be that I did not find the 
right ones. Anyway, I would never have found the trick with the dynamic cast!

I like OS and the efforts of the community but it is a real shame that OSG is 
documented so badly. 

Thank you!

Cheers,
Hartwig

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





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


[osg-users] Serialization with virtual base classes

2017-12-23 Thread Hartwig Wiesmann
Hi,

I already asked a similar question a few days ago but did not get an answer. I 
try to be a bit more specific. Assume I have the following definitions:


Code:

class VirtualBaseClass : public osg::Object
{
};

class A : virtual public VirtualBaseClass
{
};

class B : virtual public VirtualBaseClass
{
};

class Final : public A, public B
{
};




Now I have to register a wrapper for class Final. How do I do this?


Code:

REGISTER_OBJECT_WRAPPER(Final,
 new Final,
 Final,
 "???") // What do I have to 
mention here?
{
}





Thank you!

Cheers,
Hartwig

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





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


[osg-users] Serialization and multiple inheritance

2017-12-18 Thread Hartwig Wiesmann
Hi,

I am writing a wrapper for my own object that uses multiple inheritance. What 
do I have to mention in the inheritance relation section of 
REGISTER_OBJECT_WRAPPER? 

Do I have to take special care in case the object uses virtual base classes?

Thank you!

Cheers,
Hartwig

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





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


Re: [osg-users] Crash in ReaderWriterCURL::readFile when used with DatabasePager

2017-12-18 Thread Hartwig Wiesmann
Hi Robert,

I did some further investigations: I added in ReaderWriterCURL::readFile an 
atomic counter and stopped in the debugger whenever the atomic counter reaches 
2 (means 2 threads are running at the same time an instance of 
ReaderWriterCURL::readFile).

The debugger showed clearly that there are two threads running but 
OpenThreads::Thread::CurrentThread() always returned the same pointer to 
Thread. Therefore, getEasyCurl() does not work correctly.

PS: I do not know if OpenThreads is broken on macOS?! I compiled OpenThreads 
with


Code:
#define _OPENTHREADS_ATOMIC_USE_MUTEX 1




but this should actually not matter.

Cheers,
Hartwig

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





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


Re: [osg-users] Crash in ReaderWriterCURL::readFile when used with DatabasePager

2017-12-18 Thread Hartwig Wiesmann
Hi Robert,

I am using 3.4.2. I already checked GIT but could not find any modification in 
ReaderWriterCurl that is relevant. 

Thank you!

Cheers,
Hartwig

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





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


[osg-users] Crash in ReaderWriterCURL::readFile when used with DatabasePager

2017-12-17 Thread Hartwig Wiesmann
Hi,

I am using PagedLOD together with a pseudo-loader to load files via the 
network. To load the files the ReaderWriterCURL class is used.

The database pager is set up with one general and one HTTP thread. This means 
that the ReaderWriterCURL::readFile(ObjectType, const std::string&, const 
osgDB::ReaderWriter::Options*) (and WriteFile) method is always called from the 
same thread!

In ReaderWriterCURL::readFile the class method getEasyCurl() is used to get a 
reference to an EasyCurl object. And always the same EasyURL object is returned 
because it is always the same thread that is calling getEasyCurl().

The problem is (seems to be) that although the ReaderWriterCURL::readFile is 
used by the same thread it can happen that different instances of 
ReaderWriterCURL::readFile are running in parallel (verified by debug output). 
But this means that these instances use the SAME EasyCURL object! And this will 
lead to a crash.

For testing purposes I replaced the call to getEasyCurl in 
ReaderWriterCURL::readFile with osg::ref_ptr easyCurl and did the 
corresponding replacements ("." replaced by "->") and everything went smoothly.

I do not know the purpose of getEasyCur() using a map of EasyCurl objects as 
this method is only used in ReaderWriterCURL::readFile and writeFile. The only 
thing that has to be prevented is that curl_easy_init() is called in parallel. 
But this can also be achieved by returning an osg::ref_ptr object in 
combination with a lock.

Awaiting your comments!

Cheers,
Hartwig

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





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


Re: [osg-users] META_object macro returning osg::Object* for cloneType and clone

2017-11-28 Thread Hartwig Wiesmann
Hi Robert,

I already feared that it had to do with non-compliant compilers. It seems to be 
that I have already been in the lucky situation that all my compilers did never 
have any problems with this issue.

Though I think / hope that all current C++ compilers should be able to compile 
this kind of stuff.

Probably an item for the future.

Cheers,
Hartwig

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





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


Re: [osg-users] META_object macro returning osg::Object* for cloneType and clone

2017-11-26 Thread Hartwig Wiesmann
Hi,

if you have a list of pointer of derived classes from osg::Object and you would 
like to clone them you always have to cast them. And I like to prevent casts as 
often as possible.

Example: if you clone a StateAttribute you get back a pointer to an Object 
although you know (and the compiler could also know) that the result is a 
StateAttribute.

Cheers,
Hartwig

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





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


Re: [osg-users] META_object macro returning osg::Object* for cloneType and clone

2017-11-25 Thread Hartwig Wiesmann
Hi,

yes and no, you can change the return type though.


Cheers,
Hartwig

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





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


[osg-users] META_object macro returning osg::Object* for cloneType and clone

2017-11-25 Thread Hartwig Wiesmann
Hi,

is there any reason why clone(const omg::CopyOp&) and cloneType() are returning 
osg::Object* and not name*?
Does changing the macro break any existing code? I do not think so but may be 
that I am overlooking something.

Thank you!

Cheers,
Hartwig

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





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


Re: [osg-users] Potential bug in ref_ptr::assign

2017-10-25 Thread Hartwig Wiesmann
Hi Robert,

please do not understand me wrong: I fully understand what is meant but I have 
my doubts that highly optimising compilers are clever enough.

Anyway, thanks for your good work!

Cheers,
Hartwig

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





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


[osg-users] Potential bug in ref_ptr::assign

2017-10-24 Thread Hartwig Wiesmann
Hi,

in ref_ptr you find the following code:


Code:

template void assign(const ref_ptr& rp)
{
if (_ptr==rp._ptr) return;
T* tmp_ptr = _ptr;
_ptr = rp._ptr;
if (_ptr) _ptr->ref();
// unref second to prevent any deletion of any object which might
// be referenced by the other object. i.e rp is child of the
// original _ptr.
if (tmp_ptr) tmp_ptr->unref();
}




I was puzzled by the comment: actually, there is nothing that prevents an 
optimiser to re-write the code to

Code:

if (tmp_ptr) tmp_ptr->unref();
if (_ptr) _ptr->ref();




or


Code:

   _ptr->unref();
_ptr = rp._ptr;
if (_ptr) _ptr->ref();




It seems to be that it has not happened, yet, respectively the scenario 
described in the comment did not occur, but this does not mean that it cannot 
happen, or?
Actually, I do not see a solution for the described scenario, so probably the 
comment should be removed or changed? But in this case the code can be 
simplified, too.

Cheers,
Hartwig[/code]

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





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


Re: [osg-users] Does OSG work on Mac OS?

2017-09-26 Thread Hartwig Wiesmann
Hi,

I am using OSG on OS X without problems. But I am using OSG version 3.2 (did 
not test the newest version, yet).

... and I am not using any of the CMake files but compiling the source using my 
own Xcode project...

Cheers,
Hartwig

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





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


Re: [osg-users] Visual flicker when using multi-pass technique, related to frustum?

2017-01-15 Thread Hartwig Wiesmann
Hi Robert,

I have also removed the near/far computation from the main camera. Now, there 
is no flicker anymore.

Do you have an idea why the near/far computation of the main camera only causes 
problems? How can I overcome this issue? 

Cheers,
Hartwig

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





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


Re: [osg-users] Visualization of billboards depending on pre-conditions

2017-01-08 Thread Hartwig Wiesmann
Hi Tian,

an occlusion query is difficult because the scene is continuously changing.

Ad Robert: drawing the sign itself is not the issue. I would either like to see 
the sign completely or not at all.

I will do some tests with multi-passes.

Thank you!

Cheers,
Hartwig

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





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


Re: [osg-users] Visualization of billboards depending on pre-conditions

2017-01-08 Thread Hartwig Wiesmann
Hi,

yes, this is an idea. But as a first step I have to estimate a suitable area 
location and size for the passes.

I do not like the idea of ray checking because I think that it is rather slow. 
Especially when I have to do the checks for a lot of billboards.

Thank you!

Cheers,
Hartwig

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





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


[osg-users] Visualization of billboards depending on pre-conditions

2017-01-07 Thread Hartwig Wiesmann
Hi,

I would like to show a complete billboard when a certain part of the billboard 
is visible. Although other parts may be (partially) hidden by other items.

Example: assume that the billboard is a sign consisting out of a foot, pole and 
the sign itself. Whenever the foot is visible (depth test passes for the whole 
foot) I would like to show the complete sign. Even if the depth test for the 
sign fails for certain parts of the sign (but not for the foot).

Does anybody have any ideas how to set up such a test and following 
visualisation efficiently?

Thank you!

Cheers,
Hartwig

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





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


[osg-users] Visual flicker when using multi-pass technique, related to frustum?

2017-01-07 Thread Hartwig Wiesmann
Hi,

I have two graphs that have completely different content. One is used for 
initialising the depth buffer, the other one for showing the scene.

Code:
visibleGraphPtr = ...
depthGraphPtr = ...
depthGraphPtr->getOrCreateStateSet()->setAttributeAndModes(new 
osg::ColorMask(false,false,false,false)); // does not use the color buffer



I use two cameras, one for rendering to the depth buffer, the other one 
(viewer's main camera) for generating the scene.

Code:
osg::Camera* renderToDepthCamera(new osg::Camera());

renderToDepthCamera->addChild(depthGraphPtr);
renderToDepthCamera->setClearMask(GL_DEPTH_BUFFER_BIT);
renderToDepthCamera->setComputeNearFarMode(osg::CullSettings::DO_NOT_COMPUTE_NEAR_FAR);
renderToDepthCamera->setGraphicsContext(viewer->getCamera()->getGraphicsContext());
renderToDepthCamera->setRenderOrder(osg::Camera::PRE_RENDER);
renderToDepthCamera->setViewport(viewer->getCamera()->getViewport());
viewer->addSlave(renderToDepthCamera,false);

viewer->getCamera()->setClearMask(GL_COLOR_BUFFER_BIT); // use also depth 
buffer from pre-rendering
viewer->setSceneData(visibleGraphPtr);




Basically this setup works. The only problem is that flickering can be seen 
when zooming into and out of the scene or moving the scene.

My explanation is that the camera rendering to the depth buffer is using a 
different frustum (namely the old one (one frame old) from the main camera) 
than the main camera rendering the visible graph.

Is there a possibility to eliminate the flicker without using a third render 
path at the beginning just to calculate the final frustum?

I could have implemented the same by using a RTT camera and some shader code 
afterwards but I think that this does not make any difference with respect to 
flicker, or?

Any suggestions? Thank you!

Cheers,
Hartwig

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





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


Re: [osg-users] How to render (sub-)graph only into depth buffer?

2017-01-07 Thread Hartwig Wiesmann
Hi,

isn't it also a viable solution to use a slave camera that just pre-renders its 
depth related scene into the depth buffer and use the main camera to render the 
real scene afterwards? Both cameras operate on the same context. Though I do 
not know whether it causes any problems.


Cheers,
Hartwig

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





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


Re: [osg-users] [build] x86_64, cmd line, built OK - but warning in Xcode

2017-01-05 Thread Hartwig Wiesmann
Hi Robert,

I fully agree with you!
But would you mind if I submit patches that at least remove some warnings of 
existing code by adding an appropriate cast (the code with and without the cast 
should be identical)? I am especially concerned about header files because then 
the warnings are also polluting my code (and there might be some bugs).

Example (taken from osg::Drawable):


Code:
virtual void apply(const ByteArray& array) {  if (!array.empty()) 
_af.apply(_type,array.size(),&(array.front())); }




should be replaced by


Code:
virtual void apply(const ByteArray& array) {  if (!array.empty()) 
_af.apply(_type,static_cast(array.size()),&(array.front())); }




Doing this kind of modification in osg::Drawable alone will remove about 30 to 
40 warnings already!

Thank you!

Cheers,
Hartwig

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





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


Re: [osg-users] [build] x86_64, cmd line, built OK - but warning in Xcode

2016-12-29 Thread Hartwig Wiesmann
Hi,

I know that these compiler warnings are not critical but I find them still 
annoying and I think it is also not a good programming style to use the "wrong" 
integer type.

I also know that a simple modification might break some code (especially for 
virtual methods). But wouldn't it be in general a good idea to replace the 
mostly "unsigned int" types with size_t? Especially in constructors where very 
often a size is passed size_t can be used without problems (all STL size() 
methods return size_t types as a default type).

Cheers,
Hartwig

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





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


Re: [osg-users] Capture image on iOS get black image

2016-12-28 Thread Hartwig Wiesmann
Hi,

glReadPixels is not supported by iOS.

Cheers,
Hartwig

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





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


Re: [osg-users] glsl version 130 not supported (and related problems)

2016-12-21 Thread Hartwig Wiesmann
Hi,

did you solve your issue? In case you are using osgViewer's GraphicsWindowCocoa 
class there has once been a change in OSG: it explicitely specifies the OpenGL 
core version 4.1.
If you specify the legacy version you should be fine. You can find the line for 
patching in osgViewer::GraphicsWindowCocoa::realizeImplemenation() (last OpenGL 
profile attribute).

Cheers,
Hartwig

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





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


Re: [osg-users] How to render (sub-)graph only into depth buffer?

2016-12-17 Thread Hartwig Wiesmann
Hi,

sorry, my fault.  I messed up the rendering order. If the sphere is rendered 
first, it works.

Thank you!

Cheers,
Hartwig

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





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


[osg-users] How to render (sub-)graph only into depth buffer?

2016-12-16 Thread Hartwig Wiesmann
Hi,

I would like to fill the depth buffer with the data of a rendered subgraph. The 
subgraph itself should not be visible in the view. Afterwards, I want to render 
another - and now visible - subgraph that uses (and modifies) the previously 
filled depth buffer.

How can I do this?

I wrote a small program for testing but unfortunately this does not fill the 
depth buffer (the box is completely visible):


Code:

osg::Geode*   geode(new osg::Geode());
osg::Program* prog(new osg::Program());
osg::Shader*  vshader(new osg::Shader(osg::Shader::VERTEX,  
gVertexShader));
osg::Shader*  fshader(new 
osg::Shader(osg::Shader::FRAGMENT,gFragmentShader));
osg::ShapeDrawable* box(new osg::ShapeDrawable(new 
osg::Box(osg::Vec3(0,0,0),100.0)));
osg::ShapeDrawable* sphere(new osg::ShapeDrawable(new 
osg::Sphere(osg::Vec3(50.0,50.0,50.0),100.0)));

prog->addShader(vshader);
prog->addShader(fshader);
box->getOrCreateStateSet()->setAttribute(new 
osg::ColorMask(true,true,true,true));
sphere->getOrCreateStateSet()->setAttribute(new 
osg::ColorMask(true,false,false,true));
sphere->getOrCreateStateSet()->setAttribute(new osg::Depth());
geode->addDrawable(box);
geode->addDrawable(sphere);
geode->getOrCreateStateSet()->setAttribute(prog);
_root->addChild(geode);




Thank you!

PS: The vertex shader just calculates the position by multiplying the 
view-projection matrix with the vertex vector and the fragment shader just 
returns a color value.

Cheers,
Hartwig

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





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


[osg-users] [build] Compiling error for OpenGLES

2015-03-08 Thread Hartwig Wiesmann
Hi,

I think that the commit on 2015-01-21 16:35 for PolygonMode.cpp is not valid 
for OpenGLES because glPolygonMode is not available for OpenGLES.

Cheers,
Hartwig

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





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


Re: [osg-users] [build] Compiling error for OpenGLES

2015-03-08 Thread Hartwig Wiesmann
Sorry,

did not have the latest OSG version. Issue has been solved on 2015-03-03.

Thank you!

Cheers,
Hartwig

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





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


[osg-users] Version 3.3.6 and OpenGLES / error in shaders

2015-03-08 Thread Hartwig Wiesmann
Hi,

when running simpleExample on iOS I get shader errors because on GLES 
variables like gl_Vertex, gl_LightSource etc. are undefined. Or?

Cheers,
Hartwig

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





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


Re: [osg-users] LOD node is culling my visible child nodes / depends on number of child nodes

2015-02-27 Thread Hartwig Wiesmann
Hi,

thank you for your reply!

Actually, culling was not the reason but my understanding of how the LOD node 
works. I thought that the LOD node applies the distance calculation of the LOD 
to each child's bounding sphere center. But it seems to be that the distance 
calculation is done for the center of the LOD's bounding sphere center.

Cheers,
Hartwig

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





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


Re: [osg-users] Nasty bug when compiling for Mac OS X or iOS

2015-02-25 Thread Hartwig Wiesmann
Hi,

working.

Thank you!

Cheers,
Hartwig

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





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


[osg-users] LOD node is culling my visible child nodes / depends on number of child nodes

2015-02-25 Thread Hartwig Wiesmann
Hi,

I have two LOD nodes. One LOD node has one child node the other one has - for 
example - 1000 children. All children of both nodes have the same range 
settings (0 - maxValue).
The single child of the LOD node is shown on the scene. Children in the 
vicinity of this single child - but part of the other LOD node - are not shown.
If I increase the range of the second node (let's say by a factor of 10) the 
children of the second node are shown.
If I add the 1000 children to the first LOD node none of the children are shown 
(also not the one that was shown when it was the only child of the first LOD 
node).

I have no clue what is going on. Can anybody tell me what is going on?

PS: I do not modify any LOD scale values in cull settings or anywhere else.
PPS: The number of ranges is identical to the number of children.

Thank you!

Cheers,
Hartwig

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





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


[osg-users] Nasty bug when compiling for Mac OS X or iOS

2015-02-23 Thread Hartwig Wiesmann
Hi,

if compiling OSG for OS X or iOS there is a nasty bug in the std::map library. 
This bug only exists when the C++ language dialect is C++98, GNU++ 98 or when 
using the compiler's default dialect. Due to this bug assignments like

Code:
aMap = aMap

 clear the content of aMap.

This bug can occur in TransferFunction.cpp:

Code:

void TransferFunction1D::allocate(unsigned int numX)
{
  _image = new osg::Image;
  _image-allocateImage(numX,1,1,GL_RGBA, GL_FLOAT);
  if (!_colorMap.empty()) assign(_colorMap);
}



The last line assigns _colorMap to _colorMap and hence there is the bug.

What is the purpose of this kind of assignment anyway? The method assign is 
not virtual as far as I can see. Though the method has the side effect to 
update the image. But then,

Code:
if (!_colorMap.empty()) updateImage();

 or just 
Code:
updateImage();

is the better solution, or?

Thank you!

Cheers,
Hartwig

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





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


Re: [osg-users] Nasty bug when compiling for Mac OS X or iOS

2015-02-23 Thread Hartwig Wiesmann
Hi,

the allocate modification definitely works because I already implemented it by 
myself. For the others I do not have a test case at hand but should work, too.

Thank you!

Cheers,
Hartwig

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





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


[osg-users] OpenGL ES 2.0 and static libraries - compiler error (bug?)

2013-03-03 Thread Hartwig Wiesmann
Hi,

GLStaticLibrary.cpp defines the function

  void initGLES2ProcAddress();

even if GLES2 is not defined. This leads to some compiling errors because some 
functions do not exist in OpenGL ES 1.

I think initGLES2ProcAddrees() should be surrounded by 

#ifdef OSG_GLES2_AVAILABLE

...

#endif

Thank you!

Cheers,
Hartwig

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





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


[osg-users] Dynamic PagedLOD node creation

2013-03-02 Thread Hartwig Wiesmann
Hi,

I would like to create dynamically PageLOD nodes whenever a node within a 
certain LOD range is displayed.

Example:


Code:

pagedLOD-AddChild(modelL1,100.0f,FLT_MAX);
pagedLOD-AddChild(modelL2,0.0f,100.0f);




Whenever the node modelL2 is displayed I would like to have a callback in 
which I can decide whether I would like to create children of modelL2.

Finally, this comes down to building dynamically a quadtree using PagedLODs.

Any ideas?

Thank you!

Hartwig

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





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


Re: [osg-users] Dynamic PagedLOD node creation

2013-03-02 Thread Hartwig Wiesmann
Hi Aurelian, hi Chris,

thanks for the tip. I did not understand the pseudo-loader concept so far but 
now I got the idea!

Cheers,
Hartwig

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





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


[osg-users] OpenGL ES 2.0 and shaders

2013-03-02 Thread Hartwig Wiesmann
Hi,

it seems to be that OSG creates in ShaderGenCache::createStateSet the shader 
statement

gl_FrontColor = gl_Color;

if the state mask is not set.

But when using OpenGL ES 2.0 gl_FrontColor does not exist. Is this a bug or am 
I missing anything?

Cheers,
Hartwig

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





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


[osg-users] osgText and getting fonts on OS X becoming difficult

2012-03-19 Thread Hartwig Wiesmann
Hi,

it is becoming more and more difficult to obtain the filenames of fonts in OS 
X. Actually, it seems to be that all system functions are depreciated that 
obtain from a font object (like NSFont) the font's filename (directly or 
indirectly).

What do you do to get from a native font object in OS X a valid filename? Any 
hints are appreciated!

Thank you!

Cheers,
Hartwig

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





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


[osg-users] PixelBuffer Cocoa - Meaning of output message?

2012-03-19 Thread Hartwig Wiesmann
Hi,

in osgView::PixelBufferCocoa::realizeImplementation there is a line


Code:

std::cout  PixelBufferCocoa :: realizeImplementation not implemented yet  
 std::endl;



Isn't this message obsolete? At least it seems to me that the method is 
implemented.

Thank you!

Cheers,
Hartwig

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





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


[osg-users] [OpenGL ES] Bug in loading textures

2011-10-08 Thread Hartwig Wiesmann
Hi,

Texture::applyTexImage2D_load (...) calls in case of mipmapping for 
uncompressed images (file Texture.cpp line 1931 of the source code in trunk)


Code:

glTexImage2D( target, 0, _internalFormat,
inwidth, inheight, _borderWidth,
(GLenum)image-getPixelFormat(),
(GLenum)image-getDataType(),
dataPtr);




In OpenGL ES the internal format and the pixel format have to have the same 
value otherwise an invalid operation error is raised. Equivalent formats are 
not supported like in standard OpenGL.
Therefore an internal format of GL_RGBA8 and  a pixel format of GL_RGBA will 
lead to an invalid operation error.

I have solved this bug by adding a mapping function in this particular case. 
Afterwards I found out that this bug can occur at several other places 
(probably also with other functions than glTexImage2D).

I am willing to submit a path but then I would like to know where to put the 
mapping function.

Cheers,
Hartwig

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





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


Re: [osg-users] [OpenGL ES] Bug in loading textures

2011-10-08 Thread Hartwig Wiesmann
Hi,

just found out that I can also patch 
Texture::computeInternalFormatWithImage(const osg::Image) const so that it 
returns valid OpenGL ES formats (in case OpenGL ES is used).

Cheers,
Hartwig

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





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


Re: [osg-users] [OpenGL ES] Bug in loading textures

2011-10-08 Thread Hartwig Wiesmann
Hi,

this is my patch for Texture::computeInternalFormatWithImage(...) replacing 
lines 1435 - 1442:


Code:

// GLES doesn't cope with some internal OpenGL formats so map them to the 
appropriate equivalents.
#if defined(OSG_GLES1_AVAILABLE) || defined(OSG_GLES2_AVAILABLE)
switch (internalFormat)
{
  case 1:
_internalFormat = GL_LUMINANCE;
break;
  case 2:
_internalFormat = GL_LUMINANCE_ALPHA;
break;
  case 3:
  case GL_RGB8_OES:
_internalFormat = GL_RGB;
break;
  case 4:
  case GL_RGBA8_OES:
_internalFormat = GL_RGBA;
break;
  default:
_internalFormat = internalFormat;
}
OSG_NOTICEInternal format corrected for OpenGL ES from 0x
   std::hexinternalFormat to 0x
   std::hex_internalFormatstd::endl;

#else
_internalFormat = internalFormat;
#endif





Cheers,
Hartwig

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





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


[osg-users] [OpenGL ES] Bug in drawing primitive sets using DrawElementsUInt

2011-10-08 Thread Hartwig Wiesmann
Hi,

DrawElementsUInt::draw(...) tries to draw elements also in OpenGL ES. But in 
OpenGL ES glDrawElements(...) does not support GL_UNSIGNED_INT.

Therefore, the class DrawElementsUInt should be disabled for OpenGL ES 
applications or all its methods should not do anything but triggering an error 
message.

Cheers,
Hartwig

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





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


[osg-users] LOD chicken and egg problem

2010-12-05 Thread Hartwig Wiesmann
Hi,

assume I have an LOD node. The children of this LOD node are geodes having as 
drawables only text objects.

Something like this

Code:


  lodPtr = new osg::LOD();
  ... // some initializations

  textPtr = new osg::Text();
  ... // some initializations

  geodePtr = new osg::Geode();
  geodePtr-addDrawable(textPtr);
  lodPtr-addChild(geodePtr,0.0,heightValue);





The problem is that the text is never shown!

The reason is - I believe - that the bounding box of the text cannot be 
calculated without having an _autoTransformCache. But without a bounding box 
LOD cannot determine whether to show or hide an item.
And an _autoTransformCache is only calculated if the text is going to be drawn.

As there is no start nothing is displayed.

What is the best way to solve this problem?
One solution would be to add a fake drawable to the geode so that always a 
bounding box can be calculated and therefore the _autoTransformCache is 
calculated. But this is not really nice.
Overwriting osgTextBase::ComputeBound to always produce at least a fake initial 
bounding box does not work because the bounding box is cached (so I have to 
patch osg::Drawable, too).

Other suggestions? Thank you!

Cheers,
Hartwig

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





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


[osg-users] Is caching in osg::Drawable and osg::Node getBound() methods error free?

2010-12-05 Thread Hartwig Wiesmann
Hi,

The current code for the getBound() methods are like this


Code:

inline const BoundingBox getBound() const
{
if(!_boundingBoxComputed)
{
_boundingBox = _initialBound;
if (_computeBoundCallback.valid()) 

_boundingBox.expandBy(_computeBoundCallback-computeBound(*this));
else
_boundingBox.expandBy(computeBound());

_boundingBoxComputed = true;
}
return _boundingBox;
}




Assume that you call getBound() (for a text object) before it has been drawn 
for the first time it will return an invalid bounding box. And as the bounding 
box is cached it will always be invalid.

I suggest to patch it like


Code:

inline const BoundingBox getBound() const
{
if(!_boundingBoxComputed)
{
_boundingBox = _initialBound;
if (_computeBoundCallback.valid()) 

_boundingBox.expandBy(_computeBoundCallback-computeBound(*this));
else
_boundingBox.expandBy(computeBound());

_boundingBoxComputed = _boundingBox.valid();
}
return _boundingBox;
}




Any comments?

Cheers,
Hartwig

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





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


Re: [osg-users] Dynamic Terrain

2010-11-22 Thread Hartwig Wiesmann
Hi,

a contour layer assigns to a height value a color value. Therefore, you can use 
the layer to visualize terrain contours, respectively areas of equal height.

Cheers,
Hartwig

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





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


Re: [osg-users] How to check visibility of a point

2010-06-03 Thread Hartwig Wiesmann
Hi Nick,

Thank you for your answer! Actually, I did not know this class.

But unfortunately it cannot be used, I suppose. I want to test the visibility 
of a point and depending on the result I want to draw another geometry. 
osg::OcclusionQueryNode tests all its children. So, I cannot add the point and 
the other geometry because then the checking is done for both. If I add only 
the point there is no possibility to draw the other geometry.

Cheers,
Hartwig

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





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


[osg-users] LineStipple / binding to vertex

2010-05-27 Thread Hartwig Wiesmann
Hi,

it seems to be that OSG is not supporting to bind LineStipple to a vertex (like 
it can be done with the colour) in the state set.
Is there any workaround to change the stippling within a line strip for example?

Thank you!

Cheers,
Hartwig

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





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


Re: [osg-users] osgviewer::GraphicsWindowCarbon and wxWidgets conflict

2010-05-14 Thread Hartwig Wiesmann
Hi Stephan,

I just tried 2.9.6 and there the quit event is still initialized in the static 
variable initialization part. And I think there is no way around it (or only a 
bit tricky one) because this handler is also not associated with any window. 
And it can only be initialized once (so you have to use a flag indicating if 
you have initialized it or not).

Cheers,

Hartwig

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





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


[osg-users] osgviewer::GraphicsWindowCarbon and wxWidgets conflict

2010-05-13 Thread Hartwig Wiesmann
Hi,

osgViewer::GraphicsWindowCarbon and wxWidgets do not work well together on Mac 
OSX in case you are using dynamic wxWidget event handlers (event handlers that 
are linked by using wxEvtHandler::Connect). The quit-event is not caught by 
wxWidgets but is handled by OSG. And this means that sometimes your application 
does not quit.
If you are using static wxWidget event handlers (like in the osgViewerWX 
example) the example seems to work. But I am not sure if it works in general or 
if it is a coincidence which library is initialized first.

I recommend to disable the OSG quit event handlers in GraphicsWindowCarbon 
altogether when using wxWidgets. As the OSG event handlers are configured 
during the static initialization phase of the library I do not see any other 
solution than commenting out the event handler part. I would have preferred 
some kind of parameter during runtime but this seems to be difficult 
(especially when considering a platform independent handling).

Any other ideas?

BTW: I am using wxWidget 2.8.x and osg 2.8.2 but I do not think that this 
matters.
BTW2: I do not want to use / did not test the Cocoa graphics window because I 
am still using the Carbon wxWidget library and I do not believe that it is wise 
to mix Cocoa and Carbon in general.

Cheers,
Hartwig

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





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


Re: [osg-users] osgviewer::GraphicsWindowCarbon and wxWidgets conflict

2010-05-13 Thread Hartwig Wiesmann
Hi Stephan,

yes, this would help in case a window is open having an OpenGL context. But in 
the Carbon version OSG also takes all quit events in case no window or other 
windows are open.

Cheers,
Hartwig

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





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


Re: [osg-users] osgtexture1d example / osg::TexGenNode order

2010-04-20 Thread Hartwig Wiesmann
Hi Robert,

yes, this is what I understand, I think. But that means the example relies on 
the fact that children added to a parent are ordered in the same way as they 
are added.
So,

root-addChild(texGenNode);
root-addChild(loadedModel);

should not work, or?

Thank you!

Cheers,
Hartwig

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





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


Re: [osg-users] newbie question about osgTerrain yet again

2010-04-20 Thread Hartwig Wiesmann
Hi Anton,

the current implementation is not using the height as an index for the contour 
but the x-coordinate (as you mentioned). You did nothing wrong.
If somebody is interested I can provide a patch.

Cheers,
Hartwig

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





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


[osg-users] osgtexture1d example / osg::TexGenNode order

2010-04-19 Thread Hartwig Wiesmann
Hi,

in the osgtexture1d example the node construction is done like this:

root-addChild(loadedModel); // having attached a stateset using a 1d texture
root-addChild(texGenNode);

Why is this working?

I would expect an order like:

root-addChild(texGenNode);
texGenNode-addChild(loadedModel);


Thank you!

Cheers,
Hartwig

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





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


Re: [osg-users] Multi screen display issue

2010-03-17 Thread Hartwig Wiesmann
Hi,

I would also like to know it because on the Mac there is a bug. If I have two 
monitors connected next to each other (left and right) the right part of the 
picture is displayed on the left and vice versa!

Cheers,
Hartwig

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





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


[osg-users] Bug in osg::Texture::computeInternalFormatWithImage / osg::Image

2010-03-16 Thread Hartwig Wiesmann
Hi Robert,

enabling attribute checking does not help in this case because the state 
attribute setting itself is not causing the error. wxTexImageXX is going to 
fail and this function also reports the invalid enumerator error. As far as I 
can see there is nowhere code in OSG that allows somebody to track this error.
I patched for myself osg::Texture::computeInternalFormatWithImage(const 
osg::Image) const. This seems to be a main method related to image to texture 
conversions.
I am checking if the assigned internal format is valid and if not an error 
message is displayed.

Cheers,
Hartwig

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





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


[osg-users] Bug in osg::Texture::computeInternalFormatWithImage / osg::Image

2010-03-15 Thread Hartwig Wiesmann
Hi Robert,

OK, I can agree with this. But currently you do not get a feedback that you did 
something wrong. At least I would suggest that an error message is issued 
somewhere in the code if the internal format is set to a valid that is not 
OpenGL compliant. At the moment you get only the famous 'invalid enumerator' 
message from OpenGL after a while and you have no idea what went wrong.
I used another library and it took me a couple of hours to track down the bug.


Cheers,
Hartwig

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





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


[osg-users] Bug in osg::Texture::computeInternalFormatWithImage / osg::Image

2010-03-14 Thread Hartwig Wiesmann
Hi,

assume you create a picture using GL_BGRA format using 
osg::Image::allocateImage(int s,int t,int r,GLenum format,GLenum type, int 
packing) or you set the format with osg::Image::setInternalTextureFormat.
Both methods do not check if the internal texture format is valid.

Calling osg::Texture::computeInternalFormatWithImage then results in a valid 
texture format because this function also does not check if the texture format 
is valid.

I am willing to provide a patch but I would like to have an input where I 
should patch the source code. I prefer to do it in 
osg::Texture::computeInternalFormatWithImage.
Next question: assume the format is wrong which format should be taken?

Hartwig



Thank you!

Cheers,
Hartwig

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





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


[osg-users] Bug in osg::Texture::computeInternalFormatWithImage / osg::Image

2010-03-14 Thread Hartwig Wiesmann
Hi,

sorry, it should read 

Calling osg::Texture::computeInternalFormatWithImage then results in an invalid 
texture format 

Thank you!

Cheers,
Hartwig

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





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


Re: [osg-users] [vpb] how to create valid terrain database?

2009-12-07 Thread Hartwig Wiesmann
Hi Robert,

I just added the backslashes here in the text to prevent unwanted line breaks. 
The real command is written in one line with the appropriate spaces.

So, this is not the problem!

Cheers,
Hartwig

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





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


Re: [osg-users] Looking for recommendation for (Paged)LODs and terrain visualization

2009-12-06 Thread Hartwig Wiesmann
Hi Glenn,

yes, that's what I planned to do. I am just evaluating osgEarth.

Thank you!

Cheers,
Hartwig

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





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


[osg-users] [vpb] how to create valid terrain database?

2009-12-06 Thread Hartwig Wiesmann
Hi,

I am using osgdem 0.9.10 with the following arguments:

osgdem --xx 10 --yy 10 -t ps_texture_16k.tif\
--xx 10 --yy 10 -d ps_height_16k.tif\
-v 0.1 --terrain -o test.osg

Unfortunately, this does not produce anything useful. So, it seems to be that 
an argument is missing to create a valid database. But what argument?
Removing --terrain builds a valid osg::Geode base database. 

Cheers,
Hartwig

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





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


Re: [osg-users] [vpb] how to create valid terrain database?

2009-12-06 Thread Hartwig Wiesmann
Hi,

sorry, but with anything useful I meant that osgviewer test.osg is not 
displaying anything and it seems to be that no height data is stored in the 
database.


Thank you!

Cheers,
Hartwig

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





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


Re: [osg-users] Looking for recommendation for (Paged)LODs and terrain visualization

2009-12-05 Thread Hartwig Wiesmann
Hi Robert, hi Glen,

with different coordinate systems I meant different types of coordinate systems 
or spatial reference systems: polar, UTM etc.

The data amount is about 100 GB. So, if I like to support the most popular 
types of coordinate systems I am getting too big.

So, my currently best idea is to build an LOD with SRS A (the most popular or 
convenient one). Before drawing the data on screen I will do the coordinate 
transformation if necessary.
This solution is not really fast but there might not be alternatives...

Cheers,
Hartwig

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





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


Re: [osg-users] [build] Preprocessor symbols / definitions and descriptions

2009-12-04 Thread Hartwig Wiesmann
Hi Robert,

thanks for the reply.

I do not use makefiles on any of the supported platforms (actually, I do not 
use any terminal dependent software if I can prevent it). Therefore,  I need to 
know which platform uses which macros or defines.
Furthermore, I really dislike to use libraries out of the box without knowing 
what kind of parameters they set. Example: I am supporting OS X 10.4 but the 
CMake files automatically compile for OSX 10.5 as I have 10.5 installed. 
Therefore, sometimes the wrong include files or libraries are linked in.
Of course I can check which flags CMake files use but this only shifts looking 
for defines from the source code to the makefiles. And I have never found any 
documented makefiles as far as I can remember. So, catching the meaning of 
makefiles is often more difficult than the meaning of source code.


Thank you!

Cheers,
Hartwig

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





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


[osg-users] osgTerrain::ProxyLayer

2009-12-04 Thread Hartwig Wiesmann
Hi,

a newbie question: what is the purpose of osgTerrain::ProxyLayer?

Thank you!

Cheers,
Hartwig

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





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


[osg-users] Looking for recommendation for (Paged)LODs and terrain visualization

2009-12-04 Thread Hartwig Wiesmann
Hi,

I am looking for a recommendation how to implement best the following problem 
using OSG:

assume that I have terrain data in a (paged) LOD using a specific coordinate 
system.
Now, I want to visualize the same terrain data that is stored in coordinate 
system A in coordinate system B or by using a special projection. What is 
the recommended way of doing this?

Some further information:

- I cannot store the same data in a couple of (paged) LOD databases as the 
amount of data is too large.
- The LOD element selection does not have to be perfect (if it is difficult to 
implement or too time consuming for visualization). The LOD element selection 
could still be done on the original coordinate system but the visualization of 
the data has to be in the other coordinate system or projection.
- I cannot change the database each time I would like to use a different 
coordinate system for visualization - even if it is a fast process - as two 
windows might visualize the same data but with different coordinate systems.


Any ideas how to implement this? Perhaps I have overseen something very trivial 
as I am new to OSG.

Thank you!

Cheers,
Hartwig

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





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


[osg-users] osgterrain example and camera position

2009-11-28 Thread Hartwig Wiesmann
Hi,

I am calling the osgterrain example only with the argument --image 
land_shallow_topo_2048.jpg.

The earth is now displayed on the left edge of my window/screen. If I am adding 
lines parallel to the coordinate axes x, y and z with a length of 10e6 the 
whole scene is centered.
From my understanding this does not make sense as the earth with or without 
the axes  is symmetric with respect to all axes. Can anybody please explain 
what is going on?

Thank you!

Cheers,
Hartwig

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





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


Re: [osg-users] osgterrain example and camera position

2009-11-28 Thread Hartwig Wiesmann
Hi,

sorry, I meant of course a length of 20e6 symmetric to (0, 0, 0).

Thank you!

Cheers,
Hartwig

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





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


[osg-users] osgterrain example and required input file

2009-11-27 Thread Hartwig Wiesmann
Hi,

what kind of input file does the osgterrain example expect?

BTW: what is a master file in this context??

Thank you!

Cheers,
Hartwig

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





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


Re: [osg-users] [vpb] Error during compiling VirtualPlanetBuilder

2009-11-24 Thread Hartwig Wiesmann
Hi,

how did you solve the problem of the compiler errors? I also still get them!


Thank you!

Cheers,
Hartwig

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





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


[osg-users] [build] Preprocessor macros / OSX

2009-03-20 Thread Hartwig Wiesmann
Hi,

what is the official preprocessor macro to define the OSX platform? It seems 
to me that only __APPLE__ is used. Therefore, there is no distinction between 
Cocoa and Carbon? 

Thank you.

Hartwig

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





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