Re: [osg-users] Deos readNodeFile(OSGDB) support multithreading?

2012-09-19 Thread Koduri Lakshmi
Hi,

Thank you very much for nice guidance.

I will go through the threads once again and I will come back.

Once again thank you very much for the guidence.
... 

Thank you!

Cheers,
Koduri

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




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


Re: [osg-users] [osgOcean] osgOcean: setting main camera to RTT

2012-09-19 Thread Janna Terde
Hi,

Seems to be working if I disable some effects such as glare and some underwater 
effects (I did not look exactly which ones are causing the problem).

Cheers,
Janna

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





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


Re: [osg-users] Rendering issues with `osgVolume::RayTracedTechnique`?

2012-09-19 Thread Christian Buchner
Have you seen this bit of output? One of the shaders failed validation:

#
glValidateProgram FAILED "" id=1 contextID=1
#
infolog:
#
Texture unit 0 is accessed both as sampler1D and sampler3D

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


Re: [osg-users] Rendering issues with `osgVolume::RayTracedTechnique`?

2012-09-19 Thread Robert Osfield
HI Bastien,

On 19 September 2012 16:13, Bastian Rieck
 wrote:
> Dear list,
>
> we collected some debug output of the shaders in question under
> http://pastebin.com/L88sCxBn. Around line 247 of the paste, things seem
> to get interesting.
>
> I am not quite sure what to make of the "...is not supported" entries.
> Is anyone able to help?

I wouldn't worry about the "not supported" entries as these are for
features that osgVolume doesn't use.  More telling are the lines:

glValidateProgram FAILED "" id=1 contextID=1
infolog:
Texture unit 0 is accessed both as sampler1D and sampler3D

I've just looked at the RayTracedTechnique.cpp and the fragment shader
and haven't spotted anywhere where the textures are assigned to the
same unit, or where the wrong sampler is used.

Could you try the osgVolume property settings that don't require the
transfer function to be used, this will give you a simpler shader and
less room from the driver to screw up.

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


Re: [osg-users] Rendering issues with `osgVolume::RayTracedTechnique`?

2012-09-19 Thread Christian Buchner
Hi,

Sorry, please disregard my last message - I wasn't reading carefully.
There are "is supported" and "is not supported" messages.
The "is not supported" messages require a closer look.

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


Re: [osg-users] Rendering issues with `osgVolume::RayTracedTechnique`?

2012-09-19 Thread Christian Buchner
> I am not quite sure what to make of the "...is not supported" entries.
> Is anyone able to help?

The sections

OpenGL extensions supported by installed OpenGL drivers are:

and

OpenGL extension 'XXX' is supported.

are somewhat contradicting each other.

I suspect your driver installation may be hosed.

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


Re: [osg-users] Rendering issues with `osgVolume::RayTracedTechnique`?

2012-09-19 Thread Bastian Rieck
Dear list,

we collected some debug output of the shaders in question under
http://pastebin.com/L88sCxBn. Around line 247 of the paste, things seem
to get interesting.

I am not quite sure what to make of the "...is not supported" entries.
Is anyone able to help?

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


Re: [osg-users] adding tool tips to objects in a 3D scene

2012-09-19 Thread Christian Buchner
> I've been asked to add some tool tips to objects in a 3D scene, and I
> wonder if there is anything existing in OSG that would facilitate an
> implementation.

I figured it out myself - and I think I got that done with quite minimal effort.

We're already integrating Qt and OpenSceneGraph by means of a
QGraphicsView which displays a QGraphicsScene. The OSG scene graph is
rendered in the drawBackground() implementation of the QGraphicsScene,
and as an added bonus it is even possible to display floating Qt
windows (encapsulated as QGraphicsItems) on top of the scene.

So here's how I integrated Qt's existing tool tip system with the
scene graph. I am overriding the QGraphicsView's event() handler, so
whenever a tool tip is requested by Qt, I will ask the underlying
QGraphicsScene implementation whether a tool tip is required at the
mouse position and display that. Otherwise I fall back to the default
event handler.

bool MyGraphicsView::event(QEvent* e)
{
QHelpEvent *he = static_cast(e);
QMouseEvent *me = static_cast(e);

if(he && he->type() == QEvent::ToolTip)
{
QString tip;
bool handle =
((MyGraphicsScene*)scene())->toolTipAt((qreal)he->pos().x(),
(qreal)he->pos().y(), tip);

if (handle)
{
QToolTip::showText(he->globalPos(), tip);
e->accept();
return true;
}
else QToolTip::hideText();
}
else if (me)
{
QToolTip::hideText();
}
return QGraphicsView::event(e);
}

The QGraphicsScene provides a hint as to whether a tool tip is
supposed to be shown by first checking whether a QGraphicsItem under
the mouse position - if not it means that the mouse is hovering over
content rendered by OSG. So it will shoot an intersector into the
scene graph under the mouse position. Our OpenGLScene implementation
also implements an osg::Viewer instance through multiple inheritance -
so I can just cast our object pointer to osgViewer::View and use the
computeIntersections() member. But for some unknown reason I had to
invert the vertical coordinate.

For now I display the osg geode's name (if defines) as tool tip (if it
is defined). Other uses like context sensitive pop up menus are now
within reach. Cool!

bool MyGraphicsScene::toolTipAt(qreal x, qreal y, QString& tmp)
{
QGraphicsItem *item;

// first make sure we're not hovering over a displayed QGraphicsItem
if ((item = itemAt(x, y)) == NULL)
{
osgUtil::LineSegmentIntersector::Intersections intersections;

osgViewer::Viewer* viewer = dynamic_cast(this);
osgViewer::View* view = dynamic_cast(viewer);

// compute intersections with geometry cylinders
if (view->computeIntersections(x, sceneRect().height()-y,
intersections, 4))
{
for(osgUtil::LineSegmentIntersector::Intersections::iterator
hitr = intersections.begin();
hitr != intersections.end();
++hitr)
{
std::ostringstream os;
if (!hitr->nodePath.empty() &&
!(hitr->nodePath.back()->getName().empty()))
{
tmp = QString(hitr->nodePath.back()->getName().c_str());
return true;
}
}
}
}
return false;
}

I hope this code is of some use to other people, so I am posting it here.

Ciao,

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


Re: [osg-users] Deos readNodeFile(OSGDB) support multithreading?

2012-09-19 Thread Sergey Polischuk
Hi

one reason for binary files to be huge is embedded media like textures, as they 
are stored as uncompressed data. you can use binary formats with external image 
files (pngs \ jpegs) in this case to cut down file size.
you can use osgconv with various options to sort htis out, check "osgconv 
--format IVE" to see ive readerwriter options.

Cheers.

19.09.2012, 10:44, "Koduri Lakshmi" :
> Hi robertosfield and hybr,
>
> Thanks a lot for the nice help.
>
> My develop environment is windows XP 32 bit with SP3. On 32 bit machines the 
> code works well.
>
> When I run on Win - 7 Ultimate  64 bit then I am getting run time error some 
> times. I dont have development environment on 64 bit machine.  I don't know 
> how to provide stack trace on this testing machine.
>
> I modified my code such that the thread has only reading statement. I want to 
> run all threads simultaneously (so reading will be fast). I dont want sysnc 
> of threads.
>
> Here is my modified code.
>
> Code:
> //Globles
>
> struct ModelObj
> {
> int id;
> };
> ModelObj obj[NUM_OF_MODELS];
>
> Model model;//OBJ OF MODEL HANDLING CLASS
>
> HANDLE T[NUM_OF_MODELS];
> CWinThread *pThread[NUM_OF_MODELS];
>
> UINT ThreadProc1(LPVOID lpvoid)
> {
> ModelObj *temp = (ModelObj*)lpvoid;
>
> //model.mtForMarker[temp->id] = new osg::MatrixTransform;
> //model.modelSwitch->addChild(model.mtForMarker[temp->id].get());
>
> model.modelForMarker[temp->id] = 
> osgDB::readNodeFile(model.fileNames[temp->id]);
>
> if(model.modelForMarker[temp->id])
> {
> model.mtForMarker[temp->id]->addChild(model.modelForMarker[temp->id].get());
>
> //model.mtForMarker[temp->id]->addChild(model.sound_root.get());
>    // model.mtForMarker[temp->id]->setUpdateCallback( 
> model.soundCB.get() );
> }
>
> return 0;
> }
>
> In main
>
> Code:
> Code:
> .
>
> for(int i=0;i {
> obj[i].id=i;
>
> }
>
> strcpy(model.fileNames[0],"osg_01.osg");
> strcpy(model.fileNames[1],"osg_02.OSG");
> strcpy(model.fileNames[2],"osg_03.OSG");
>
> DWORD ThreadId[NUM_OF_MODELS];
> for(int i=0;i {
>   model.mtForMarker[i] = new osg::MatrixTransform;
> model.modelSwitch->addChild(model.mtForMarker[i].get());
>
> model.mtForMarker[i]->addChild(model.sound_root.get());
>  model.mtForMarker[i]->setUpdateCallback( 
> model.soundCB.get() );
>
> //pThread[i]=new CWinThread;
> std::cout<<"Thread: "< pThread[i] = AfxBeginThread (ThreadProc1, 
> (LPVOID)&obj[i]);
>
> pThread[i]->m_bAutoDelete=FALSE;
>
> }
>
> for (int j = 0; j < NUM_OF_MODELS; j ++)
> {
> T[j] = pThread[j]->m_hThread;
> }
>
> ::WaitForMultipleObjects(NUM_OF_MODELS, T, TRUE, 
> INFINITE);
>
> for (int j = 0; j < NUM_OF_MODELS; j ++)
> {
> delete pThread[j];
> }
>
> Once I tried to use binary formats. But when compared to OSG files its size 
> is huge. So I stopped. I will try once again. (I am changing textures 
> dynamically. Is it possible with binary formats?)
>
> Can you please guide me how to solve this problem?
>
> ...
>
> Thank you!
>
> Cheers,
> Koduri
>
> --
> Read this topic online here:
> http://forum.openscenegraph.org/viewtopic.php?p=50181#50181
>
> ___
> 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] Qt and OpenThreads

2012-09-19 Thread Max Sergeev
Thanks, Nico, very interesting info, I'll read that through. Was not my case, 
though:
Can't believe how dumb my mistake actually was was: mixing release OSG 
libraries with debug Qt libraries. Never mix debug with release, thats what 
I've learned :)

Thanks to all who wanted/tried to help.

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





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


Re: [osg-users] Rendering issues with `osgVolume::RayTracedTechnique`?

2012-09-19 Thread Bastian Rieck
Hi Robert,

> [...]
>
> If using the DEBUG notification doesn't provide any clues then only
> other tools you have left are 3rd party OpenGL debug tools.
> Unfortunately AMD have swallowed up glDEbugger so I you options are
> now a bit more limited.  Perhaps others can suggest options.
> 
> Another route you could possible look at is using a software renderer
> to see if that reports any errors with the shaders.
>

This is an intriguing idea, but how would I choose a software renderer?
By removing the AMD/ATI driver temporarily?

Kind regards,
  Bastian

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


Re: [osg-users] Rendering issues with `osgVolume::RayTracedTechnique`?

2012-09-19 Thread Robert Osfield
Hi Bastian,

On 19 September 2012 10:06, Bastian Rieck
 wrote:
>> It's likely to be a driver bug, or perhaps a sensitivity in the driver
>> to the GLSL shaders that are used - sometimes some drivers can be more
>> picky than others.
>
> We also thought about this possibility. Is it possible to obtain debug
> information about the way the card processes the shaders?

The OSG is limited to what information it get back from OpenGL to just
what the driver provides in the standard OpenGL error/status
mechanism, if you set the OSG_NOTIFY_LEVEL env var to DEBUG you'll get
the OSG to output the shaders it passing to OpenGL and the
errors/status of the compilation and linking, but this is as much as
you get.

>> I previously worked with an ATI card under Linux
>> with osgVolume and didn't have problems so perhaps there has been a
>> regression on the driver front.
>>
>> To investigate further you'll need to see if there are any OpenGL
>> errors reported - have a look on the console to see if the OSG has
>> picked up on any OpenGL errors.
>
> Unfortunately, there aren't any errors. Is there anything else we can do
> to debug this? We will first check with a modified OSG_NOTIFY_LEVEL, but
> what could we do if the drivers turn out to be defective?

If using the DEBUG notification doesn't provide any clues then only
other tools you have left are 3rd party OpenGL debug tools.
Unfortunately AMD have swallowed up glDEbugger so I you options are
now a bit more limited.  Perhaps others can suggest options.

Another route you could possible look at is using a software renderer
to see if that reports any errors with the shaders.

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


Re: [osg-users] Deos readNodeFile(OSGDB) support multithreading?

2012-09-19 Thread Robert Osfield
Hi Koduri,

I think perhaps you should take a few steps back from the approach you
are taking a learn a bit more about the basics of threading,
performance profiling and optimization before you dive into implement
threading to try and tackle what you perceive to be the way to solve
problem.

So please for now forget about threading and ask the simpler question,
what performance I am looking to achieve and what performance I am
achieve right now with simple straight forward code.  Then ask the
question what the bottlenecks are, you can even ask the community
about how to address them.

Also on the topic of threading there are lots of resoureces out there
on the web that will teach you are about threading, it's a rather
subtle topic with lots of little things you have to think about that
you don't when you work single threaded, so you really have to invest
time into learning about it.

Robert.

On 19 September 2012 07:44, Koduri Lakshmi  wrote:
> Hi robertosfield and hybr,
>
> Thanks a lot for the nice help.
>
> My develop environment is windows XP 32 bit with SP3. On 32 bit machines the 
> code works well.
>
> When I run on Win - 7 Ultimate  64 bit then I am getting run time error some 
> times. I dont have development environment on 64 bit machine.  I don't know 
> how to provide stack trace on this testing machine.
>
>
>
> I modified my code such that the thread has only reading statement. I want to 
> run all threads simultaneously (so reading will be fast). I dont want sysnc 
> of threads.
>
> Here is my modified code.
>
>
> Code:
> //Globles
>
> struct ModelObj
> {
> int id;
> };
> ModelObj obj[NUM_OF_MODELS];
>
> Model model;//OBJ OF MODEL HANDLING CLASS
>
> HANDLE T[NUM_OF_MODELS];
> CWinThread *pThread[NUM_OF_MODELS];
>
> UINT ThreadProc1(LPVOID lpvoid)
> {
> ModelObj *temp = (ModelObj*)lpvoid;
>
> //model.mtForMarker[temp->id] = new osg::MatrixTransform;
> 
> //model.modelSwitch->addChild(model.mtForMarker[temp->id].get());
>
> model.modelForMarker[temp->id] = 
> osgDB::readNodeFile(model.fileNames[temp->id]);
>
> if(model.modelForMarker[temp->id])
> {
> 
> model.mtForMarker[temp->id]->addChild(model.modelForMarker[temp->id].get());
>
> 
> //model.mtForMarker[temp->id]->addChild(model.sound_root.get());
>// model.mtForMarker[temp->id]->setUpdateCallback( 
> model.soundCB.get() );
> }
>
>
>
> return 0;
> }
>
>
>
>
>
> In main
>
>
> Code:
> Code:
> .
>
>
> for(int i=0;i {
> obj[i].id=i;
>
> }
>
> strcpy(model.fileNames[0],"osg_01.osg");
> strcpy(model.fileNames[1],"osg_02.OSG");
> strcpy(model.fileNames[2],"osg_03.OSG");
>
> DWORD ThreadId[NUM_OF_MODELS];
> for(int i=0;i {
>   model.mtForMarker[i] = new osg::MatrixTransform;
> 
> model.modelSwitch->addChild(model.mtForMarker[i].get());
>
> 
> model.mtForMarker[i]->addChild(model.sound_root.get());
>  model.mtForMarker[i]->setUpdateCallback( 
> model.soundCB.get() );
>
> //pThread[i]=new CWinThread;
> std::cout<<"Thread: "< pThread[i] = AfxBeginThread (ThreadProc1, 
> (LPVOID)&obj[i]);
>
> pThread[i]->m_bAutoDelete=FALSE;
>
> }
>
> for (int j = 0; j < NUM_OF_MODELS; j ++)
> {
> T[j] = pThread[j]->m_hThread;
> }
>
> ::WaitForMultipleObjects(NUM_OF_MODELS, T, TRUE, 
> INFINITE);
>
> for (int j = 0; j < NUM_OF_MODELS; j ++)
> {
> delete pThread[j];
> }
>
>
>
>
>
> Once I tried to use binary formats. But when compared to OSG files its size 
> is huge. So I stopped. I will try once again. (I am changing textures 
> dynamically. Is it possible with binary formats?)
>
> Can you please guide me how to solve this problem?
>
>
> ...
>
> Thank you!
>
> Cheers,
> Koduri
>
> --
> Read this topic online here:
> http://forum.openscenegraph.org/viewtopic.php?p=50181#50181
>
>
>
>
> ___
> 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] Rendering issues with `osgVolume::RayTracedTechnique`?

2012-09-19 Thread Bastian Rieck
Hi Robert,

> It's likely to be a driver bug, or perhaps a sensitivity in the driver
> to the GLSL shaders that are used - sometimes some drivers can be more
> picky than others.

We also thought about this possibility. Is it possible to obtain debug
information about the way the card processes the shaders?

> I previously worked with an ATI card under Linux
> with osgVolume and didn't have problems so perhaps there has been a
> regression on the driver front.
> 
> To investigate further you'll need to see if there are any OpenGL
> errors reported - have a look on the console to see if the OSG has
> picked up on any OpenGL errors.

Unfortunately, there aren't any errors. Is there anything else we can do
to debug this? We will first check with a modified OSG_NOTIFY_LEVEL, but
what could we do if the drivers turn out to be defective?

Kind regards,
  Bastian

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


Re: [osg-users] Screen Distance

2012-09-19 Thread Robert Osfield
HI Till,

The DisplaySettings::ScreenDistance value is used as hint to set up of
the eye offset (in world coordinates) to use when wants to scale the
model so that the center is at the image plane, this is done with the
trackball/terrain camera manipulator so that when you zoom in/out the
stereo scaling scales with the distance of the eye from the center of
rotation.   However, the drive and flight camera manipulators don't
scale eye offset, instead keeping the eye offset in constant so that
the stereo effect behaves as it does in the real world.

A negative ScreenDistance is just plain wrong and you'll get an
inversion of the eye offsets, i.e. your left and right eyes will be
swapped in position.

Robert.

On 18 September 2012 17:06, Till Becker  wrote:
> Dear osg-users,
>
> we are working here on a self made stereoskop, similar to the Wheatstone type.
>
> Realizing that there are only disparities behind the screen plane, we
> started playing with the screen distance value. Interestingly, when
> using a screen distance of e.g. -10.0, objects also reach out of the
> screen plane. Can someone please hint me on how to understand better
> what is happening with the screen distance value, what it is used for
> and what happens when I use a negative screen distance value?
>
>
> Thanks a lot in advance,
> Till
> ___
> 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