Re: [osg-users] osg::Array

2010-08-16 Thread Igor Lebedev
Hi,

In getPrimitiveSet() function there is "pos" argument. How should i use it? 

Thank you!

Cheers,
Igor

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





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


Re: [osg-users] osgBullet Build unsuccessful

2010-08-16 Thread Sanat Talmaki
Hi Fred,

I'll try that out. THanks.

Sorry Paul, I didn't realize there was a google groups separately for 
osgBullet. 

Thanks,

Sanat.[/quote]

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





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


Re: [osg-users] how to read back from the frame buffer

2010-08-16 Thread Alice Yin
Hi, Robert

Thank you for your advice.

I managed to use a prerender camera which helps me to attach the frame buffer 
content to an image each frame.

My only concern now is since I have two cameras now, one prerender, one normal, 
how can I control these two at the same time?

I do it by attaching two geometry nodes with the same MatrixTransform callback, 
but in this way, I have to set up each kind of interaction myself, like 
scaling, moving and rotating. Can I use the default interaction in OSG viewer 
to control the prerender camera, too?

Thank you!

Alice

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





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


Re: [osg-users] specify particular mimap level image

2010-08-16 Thread Alice Yin
Thank you Jason,

It works very well.

Alice

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





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


Re: [osg-users] osg::Particle problem

2010-08-16 Thread Jolley, Thomas P
Hi Serge,

You may want to research the following posts and see if they are relevent to 
your particle problems.

http://lists.openscenegraph.org/pipermail/osg-users-openscenegraph.org/2009-April/027011.html
http://lists.openscenegraph.org/pipermail/osg-users-openscenegraph.org/2009-May/028435.html

The above talks about a floating point precision bug that was introduced due to 
a change in 2008.  The bug hasn't been resolved yet.  I suspect it will wait 
until the osgParticle is refactored since not many see the problem.  If the 
above describes your problem you will need to undo the 2008 change.

http://lists.openscenegraph.org/pipermail/osg-users-openscenegraph.org/2009-October/033416.html





From: osg-users-boun...@lists.openscenegraph.org 
[mailto:osg-users-boun...@lists.openscenegraph.org] On Behalf Of Serge Lages
Sent: Monday, August 16, 2010 10:32 AM
To: OpenSceneGraph Users
Subject: [osg-users] osg::Particle problem

Hi all,

I am currently having some troubles with particles, I am trying to make them 
local to a model (for example, imagine a scene with the earth rotating around 
the sun, and a model moving on the earth, I don't want my particles to take 
into account the earth movement, only the model one). I've made it by putting 
everything related to particles (Emitter, ParticleSystemUpdater, the geode with 
the ParticleSystem...) under my model root instead of the whole scene root. But 
it doesn't work, my particles are still taking into account the main movement. 
It's weird because the same code was working one year ago, but I didn't use it 
again until today, and I don't find any other way to make my particles local.

My particle effect is composed of :
- a ParticleSystem inside a classic Geode
- a ModularEmitter
- a ParticleSystemUpdater
- a FluidProgram

Everything is attached into my graph under my model, and I set :
emitter->setReferenceFrame(osgParticle::ParticleProcessor::RELATIVE_RF);
particleSystem->setParticleScaleReferenceFrame(osgParticle::ParticleSystem::LOCAL_COORDINATES);

It works without problem when nothing is moving in my scene, but if I enable 
movements on the model parents, my particles take them into account on their 
own movement.

Any idea ?

Cheers,

--
Serge Lages
http://www.tharsis-software.com
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] Tool to inspect instance of Referenced/Object

2010-08-16 Thread Cedric Pinson
Hi Robert,

I have started to add some hook in osg::Referenced to be able to catch
information about instanciation and destruction, My idea was to add an
InstanceHandler like the DeleteHandler.
i have tried to use thos two mecanism to be able to catch creation and
destruction without more intrusive code in Referenced.cpp

The problem is that Referenced can be created without new. So it means
that the DeleteHandler will not be called with my specific code. Before
(when 'hacked') it works because I have a symmetric mechanism
(constructor/destructor).

I dont see another solution than patching the destructor of Referenced
to call the an Unlog method or a more generic name. To be clear can we
have a second mecanism to log/unlog instance of referenced. I can add a
compile time flag and/or environnement variable. But without doing that
I dont know how to do it.

Any Idea ?

Cheers,
Cedric


On Sun, 2010-08-08 at 15:06 +0100, Robert Osfield wrote:
> Hi Cedric,
> 
> I'm just quickly scanning through osg-users as I'm only around briefly
> before I head off on another weeks trip, this means I don't have time
> to dive in and start reviewing code and thinking about various
> possibilities.
> 
> The best I can do right now is to give you my first gut reaction.
> First up I have now strong opinion on this general feature, the only
> key part would be that it doesn't affect performance or overcomplicate
> code and risk introducing bugs.  Second thought is that having
> multiple interfaces that can be customized would complicate the API
> and implementation, so might it be possible wrap it all up in one
> customizable functor i.e something like generalizing the DeleteHandler
> so it can do what it does right now and do the extra stuff you want.
> It might need renaming as a class, but I doubt it would affect too
> many users as DeleteHandler is a very niche feature.
> 
> Robert.
> 
> On Mon, Aug 2, 2010 at 8:39 AM, Cedric Pinson
>  wrote:
> > Hi Robert,
> >
> > I have work on a small tool to detect how a program evolve during time,
> > It tracks the numer of instance of each object inherited from
> > osg::Referenced. I use this to detect 'leak' but release when quitting
> > the program so not really a leak  but to detect consumption of too much
> > memory during runtime.
> > The tool to works need modification in osg::Referenced. because there is
> > already a mecanism to set a custom DeleteHandler, I thought we could do
> > the same to intercept instanciation of osg::Referenced with a custom
> > InstanceHandler ?
> >
> > In my use case, I have used a NodeCallBack that dump every second the
> > current instance of Referenced and Object, then I have used a function
> > to dump the gnuplot script from the data store each seconds.
> > Some screenshoot will help to understand how I use it:
> >
> > http://plopbyte.net/tmp/combined.png
> > http://plopbyte.net/tmp/individual.png
> >
> > here the data generated to build the graph
> > http://plopbyte.net/tmp/data.dat
> > http://plopbyte.net/tmp/plot.script
> >
> >
> > What do you think ?
> >
> > I have attached my modified Referenced and Referenced.cpp to work with
> > my tool, but It would need to be more generic like the DeleteHandler to
> > enter in OSG.
> >
> >
> >
> > Cheers,
> > Cedric
> >
> > --
> > Provide OpenGL, WebGL and OpenSceneGraph services
> > +33 659 598 614 Cedric Pinson mailto:cedric.pin...@plopbyte.net
> > http://www.plopbyte.net
> >
> > ___
> > osg-users mailing list
> > osg-users@lists.openscenegraph.org
> > http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
> >
> >
> 

-- 
Provide OpenGL, WebGL and OpenSceneGraph services
+33 659 598 614 Cedric Pinson mailto:cedric.pin...@plopbyte.net
http://www.plopbyte.net


signature.asc
Description: This is a digitally signed message part
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] [osgPlugins] Error when loading DirectX .x files

2010-08-16 Thread Tassilo Glander
Hi all,

as the bug is still in the reader, I would like to submit a fix that deals with 
2 more cases of how to format the material names. The current version crashes 
when encountering materials as mentioned by Judy.
I think, the format supported in the current version of mesh.cpp is not 
correct, as the DirectX-Viewer included in DirectX-SDK (August 2009) cannot 
read model files refering to materials without curly brackets. 

I would be happy, if someone could try the patch with other models.

Thank you!

Cheers,
Tassilo

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




Attachments: 
http://forum.openscenegraph.org//files/fix_x_plugindiff_312.txt


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


Re: [osg-users] osgBullet Build unsuccessful

2010-08-16 Thread Paul Martz
Hi -- Note that osgBullet has its own Google group, so there's no reason to use 
osg-users for this discussion. I'll copy the group on this post, and also set it 
as "reply-to".


I'd hate to see you waste time trying to get osgBullet built, when it is very 
unlikely that it will help with your proximity query issue.


Nonetheless, Bullet should work for you. I assume you are on Windows because of 
the MSJAVA.DLL error. What version of OSG are you using? What version of Bullet? 
Version compatibility is on the wiki:

  http://code.google.com/p/osgbullet/wiki/WikiContents

Sanat Talmaki wrote:
I am trying to build osgBullet and while the projects build correctly in VisualStudio, when I try to run the binaries created, they hang on me. 


If I understand you correctly, when you run (for example) BasicDemo, it displays 
one frame and then freezes? (That's what I think of when I hear the word "hang", 
so if you are experiencing something else, please clarify.)



I hav the binaries from osgBullet and osgWorks copied into the binaries folder 
for osgBullet.


I generally install them into "Program Files/osgBullet" and "Program 
Files/osgWorks", then add the appropriate binary directories to PATH.


When I opened the dll for osgdb_osgbBullet.dll in depends.exe, I got the following: 
MSJAVA.DLL : System cannot find the file specified.


And osgbBullet.dll:
MSJAVA.DLL : System cannot find the file specified.


What VS version are you using? I'm using VS2008. MSJAVA.DLL doesn't come up as a 
dependency when I examine these libraries in depends.exe. This must be a build 
issue at your end, as neither Bullet nor osgBullet have any dependency on Java, 
to my knowledge.



I cannot understand  why this dll would be causing my binaries to hang.


I agree. In my experience, a missing DLL doesn't cause a program to hang. It 
usually causes the program to display a "missing DLL" dialog, then it exits.



I was hoping to get some advise from other users who have built osgBullet 
successfully or who may have experienced any similar problems.

Thank you

Sincerely,
Sanat



--
  -Paul Martz  Skew Matrix Software
   http://www.skew-matrix.com/
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] preFrame Callback available?

2010-08-16 Thread Tim Moore
I like to set an event handler for osgGA::GUIEventAdapter::FRAME, which is
fired near the beginning of the whole frame traversal.

Tim

On Mon, Aug 16, 2010 at 5:57 PM, Torben Dannhauer <
z...@saguaro-fight-club.de> wrote:

> Hi Robert,
>
> of course this solution is possible. But the software hast many modules,
> and some of them requre some actions prior to the first traversal. Adding
> all of them manually to the frameloop is'nt very modular because the
> maintainer of the loop has to take care of every module.  If there would be
> a preFrame Callback, each module could register to the callback and it would
> be self maintaining.
>
> Ok, then I'll implement it in the frame loop. Thanks anyway! :)
>
>
> Cheers,
> Torben
>
> --
> Read this topic online here:
> http://forum.openscenegraph.org/viewtopic.php?p=30794#30794
>
>
>
>
>
> ___
> 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] osgBullet Build unsuccessful

2010-08-16 Thread Frederic Bouvier
Hi,

often you can see in depends that some registered dll are loaded dynamically. 
This shouldn't cause any arm because the error is usually catched.
What you should do to really find your problem is to start your test 
application inside depends and do a profiling. You can do that by loading your 
exe in depends, and go to the Profile > Start profiling... menu.

Regards,
-Fred

- "Sanat Talmaki" a écrit :

> Hi,
> 
> I am trying to build osgBullet and while the projects build correctly
> in VisualStudio, when I try to run the binaries created, they hang on
> me. 
> 
> I hav the binaries from osgBullet and osgWorks copied into the
> binaries folder for osgBullet.
> 
> When I opened the dll for osgdb_osgbBullet.dll in depends.exe, I got
> the following: 
> MSJAVA.DLL : System cannot find the file specified.
> 
> And osgbBullet.dll:
> MSJAVA.DLL : System cannot find the file specified.
> 
> I cannot understand  why this dll would be causing my binaries to
> hang.
> 
> I was hoping to get some advise from other users who have built
> osgBullet successfully or who may have experienced any similar
> problems.
> 
> Thank you
> 
> Sincerely,
> Sanat
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


[osg-users] osgBullet Build unsuccessful

2010-08-16 Thread Sanat Talmaki
Hi,

I am trying to build osgBullet and while the projects build correctly in 
VisualStudio, when I try to run the binaries created, they hang on me. 

I hav the binaries from osgBullet and osgWorks copied into the binaries folder 
for osgBullet.

When I opened the dll for osgdb_osgbBullet.dll in depends.exe, I got the 
following: 
MSJAVA.DLL : System cannot find the file specified.

And osgbBullet.dll:
MSJAVA.DLL : System cannot find the file specified.

I cannot understand  why this dll would be causing my binaries to hang.

I was hoping to get some advise from other users who have built osgBullet 
successfully or who may have experienced any similar problems.

Thank you

Sincerely,
Sanat

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





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


Re: [osg-users] Proximity Queries between objects

2010-08-16 Thread Sanat Talmaki
Hi Paul,

That is the method I had initially thought of (i.e. the distance between 
centres of spheres obviously :) and not the other one !)

I was building osgbullet and am able to build the projects in visual studio 
successfully. All my dependencies are built right as osgWorks' binaries run 
alright. But osgBullet's binaries hang on me when I try to run them. I will 
post that in a seperate thread as it will be misleading to discuss it in this 
one.

Thanks.

Sanat

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





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


Re: [osg-users] Proximity Queries between objects

2010-08-16 Thread Sanat Talmaki
Hi Jean,

I am looking at osgBullet but for some reason all the binaries dont run after 
building it. 
Also, is there any tutorial that explains how to link osgbullet with an already 
existing osg project ?

Thanks

Sanat

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





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


Re: [osg-users] Alpha channel in framebuffer?

2010-08-16 Thread Dženan Zukić
Hi,

I found the solution now. The only change needed was in the main window 
constructor:

Code:
MainWindow::MainWindow(QWidget *parent)
:QMainWindow(parent)
{
QGLFormat f;
f.setAlpha( true ); //enables alpha channel for this format
QGLFormat::setDefaultFormat( f ); //set it as default before instantiations

setupUi(this); //instantiates QGLWidget (ViewerQT)

//other code
} 



Thank you!

Cheers,
Dženan

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





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


Re: [osg-users] preFrame Callback available?

2010-08-16 Thread Torben Dannhauer
Hi Robert,

of course this solution is possible. But the software hast many modules, and 
some of them requre some actions prior to the first traversal. Adding all of 
them manually to the frameloop is'nt very modular because the maintainer of the 
loop has to take care of every module.  If there would be a preFrame Callback, 
each module could register to the callback and it would be self maintaining.

Ok, then I'll implement it in the frame loop. Thanks anyway! :)


Cheers,
Torben

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





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


[osg-users] osg::Particle problem

2010-08-16 Thread Serge Lages
Hi all,

I am currently having some troubles with particles, I am trying to make them
local to a model (for example, imagine a scene with the earth rotating
around the sun, and a model moving on the earth, I don't want my particles
to take into account the earth movement, only the model one). I've made it
by putting everything related to particles (Emitter, ParticleSystemUpdater,
the geode with the ParticleSystem...) under my model root instead of the
whole scene root. But it doesn't work, my particles are still taking into
account the main movement. It's weird because the same code was working one
year ago, but I didn't use it again until today, and I don't find any other
way to make my particles local.

My particle effect is composed of :
- a ParticleSystem inside a classic Geode
- a ModularEmitter
- a ParticleSystemUpdater
- a FluidProgram

Everything is attached into my graph under my model, and I set :
emitter->setReferenceFrame(osgParticle::ParticleProcessor::RELATIVE_RF);
particleSystem->setParticleScaleReferenceFrame(osgParticle::ParticleSystem::LOCAL_COORDINATES);

It works without problem when nothing is moving in my scene, but if I enable
movements on the model parents, my particles take them into account on their
own movement.

Any idea ?

Cheers,

-- 
Serge Lages
http://www.tharsis-software.com
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] Alpha channel in framebuffer?

2010-08-16 Thread Robert Osfield
Hi Dženan,

You can't use GraphicsWindowEmbedded and expect any of your traits to
be honoured - it's essentially a non-op class designed to make it very
easy to integrate the OSG with 3rd party graphics contexts, it doesn't
provide any graphics context support itself deferring it all to the
3rd party contexts.  In your case the QGLWidget needs to be set up
with an RGBA buffer.

Robert.

2010/8/16 Dženan Zukić :
> Hi,
>
> I changed the window creation code, but the resulting png still has alpha=1.
>
> Code:
> AdapterWidget::AdapterWidget( QWidget * parent, const char * name, const 
> QGLWidget * shareWidget, WindowFlags f)
>        :QGLWidget(parent, shareWidget, f)
> {
>        osg::ref_ptr ds=osg::DisplaySettings::instance();
>        ds->setMinimumNumAlphaBits(8);
>        osg::ref_ptr traits=new 
> osg::GraphicsContext::Traits(ds);
>        traits->width=width();
>        traits->height=height();
>        _gw = new osgViewer::GraphicsWindowEmbedded(traits);
>    setFocusPolicy(Qt::ClickFocus);
> }
>
>
>
> Thank you!
>
> Cheers,
> Dženan
>
> --
> Read this topic online here:
> http://forum.openscenegraph.org/viewtopic.php?p=30790#30790
>
>
>
>
>
> ___
> 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] Alpha channel in framebuffer?

2010-08-16 Thread Dženan Zukić
Hi,

I changed the window creation code, but the resulting png still has alpha=1.

Code:
AdapterWidget::AdapterWidget( QWidget * parent, const char * name, const 
QGLWidget * shareWidget, WindowFlags f)
:QGLWidget(parent, shareWidget, f)
{
osg::ref_ptr ds=osg::DisplaySettings::instance();
ds->setMinimumNumAlphaBits(8);
osg::ref_ptr traits=new 
osg::GraphicsContext::Traits(ds);
traits->width=width();
traits->height=height();
_gw = new osgViewer::GraphicsWindowEmbedded(traits);
setFocusPolicy(Qt::ClickFocus);
}



Thank you!

Cheers,
Dženan

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





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


[osg-users] Microsoft Flight Simulator X terrain in OSG?

2010-08-16 Thread Brett Wiesner
Hi,

Has anyone tried gotten a microsoft flight simulator X terrain database into
OSG? What was the conversion path?

Thanks,
Brett
--
Brett Wiesner
Product Manager, Visualize Products
VT MAK
www.mak.com
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] Alpha channel in framebuffer?

2010-08-16 Thread Paul Martz
You might need to explicitly ask for alpha when you create the context. Grep for 
DisplaySettings / read through its header.

   -Paul


Dženan Zukić wrote:

Hi,

I am using the following code to save contents of the framebuffer into a file:
[code]vis->getCamera()->setClearColor(osg::Vec4(0.5f,0.5f,1.0f,0.0f)); //in 
constructor

class MyPostDrawCallback : public osg::Camera::DrawCallback
{
private:
int _w, _h;
std::string fn;
public:
MyPostDrawCallback(int w, int h, std::string filename): _w(w), _h(h), 
fn(filename) {}
	void operator () ( const osg::Camera& cam ) const 
{

osg::ref_ptr rImage = new osg::Image;
rImage->readPixels( 0, 0, _w, _h, GL_RGBA, GL_UNSIGNED_BYTE );
osgDB::writeImageFile( *rImage, fn );
}
};

void MainLogic::screenshot(std::string filename)
{
mainForm.vis->getCamera()->setPostDrawCallback(
new MyPostDrawCallback(mainForm.vis->width(), 
mainForm.vis->height(), filename));
mainForm.vis->frame();
mainForm.vis->getCamera()->setPostDrawCallback(0);
}[/code]

I expected that setting the clear color alpha to 0 would result in transparent 
background in the saved .png file. It is not so. Is that even possible, and if 
it is, how?

Thank you!

Cheers,
Dženan[/code]

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





___
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] Proximity Queries between objects

2010-08-16 Thread Paul Martz

Sanat Talmaki wrote:

I am interested in knowing if there is some tool in osg that I can use to 
perform proximity queries between  a pair of objects. I looked at osgbullet. 
But it offers a lot more than what I basically need.


osgBullet doesn't do collision detection -- that would be redundant, as 
osgBullet apps already have access to Bullet. The place to look for collision 
detection operations would be Bullet's libBulletCollision. But I can tell you 
from personal experience that Bullet only cares whether two objects are in 
collision or not. It doesn't care about exact distances between non-colliding 
objects.


So, I wanted to know if there is some way in OSG I can compute the shortest distance between the boundaries of two objects. 


The obvious and simplest solution (but not very precise) would be to take the 
distance between two bounding sphere centers and subtract the two radii.


If you need a more exact solution, then I guess you could render the scene with 
the eye point at one object center looking at the other object center and 
calculate the window space z distance between the hulls of the two objects along 
the view vector and back-transform it to world space. (I know, I know... but he 
DID post this question to a 3D graphics group :-) .)


--
  -Paul Martz  Skew Matrix Software
   http://www.skew-matrix.com/
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] Alpha channel in framebuffer?

2010-08-16 Thread Dženan Zukić
Hi,

I have AdapterWidget embedded in my Qt main window. Instance of it is called 
"vis". This is the relevant code:

Code:
MainWindow::MainWindow(QWidget *parent)
:QMainWindow(parent)
{
setupUi(this);

osg::ref_ptr keyswitchManipulator = 
new osgGA::KeySwitchMatrixManipulator;
osgGA::FlightManipulator* flightManipulator = new 
osgGA::FlightManipulator();
keyswitchManipulator->addMatrixManipulator( '1', "Trackball", new 
osgGA::TrackballManipulator() );
keyswitchManipulator->addMatrixManipulator( '2', "Flight", 
flightManipulator );

vis->setCameraManipulator( keyswitchManipulator.get() );
vis->addEventHandler(new osgViewer::StatsHandler);
vis->getCamera()->setClearColor(osg::Vec4(0.5f,0.5f,1.0f,0.0f)); 
//1.0f,1.0f,1.0f,1.0f //alpha makes no difference
}

AdapterWidget::AdapterWidget( QWidget * parent, const char * name, const 
QGLWidget * shareWidget, WindowFlags f)
:QGLWidget(parent, shareWidget, f)
{
_gw = new osgViewer::GraphicsWindowEmbedded(0,0,width(),height());
setFocusPolicy(Qt::ClickFocus);
}

ViewerQT::ViewerQT(QWidget * parent, const char * name, const QGLWidget * 
shareWidget, WindowFlags f):
AdapterWidget( parent, name, shareWidget, f )
{
getCamera()->setViewport(new osg::Viewport(0,0,width(),height()));
getCamera()->setProjectionMatrixAsPerspective(30.0f, 
static_cast(width())/static_cast(height()), 1.0f, 1.0f);
getCamera()->setGraphicsContext(getGraphicsWindow());

connect(&_timer, SIGNAL(timeout()), this, SLOT(updateGL()));
_timer.start(10);
}



Thank you!

Cheers,
Dženan

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





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


Re: [osg-users] Alpha channel in framebuffer?

2010-08-16 Thread Robert Osfield
Hi Dženan,

The osgViewer library by default will create RGB framebuffers unless
there are hints to do otherwise.  You don't mention anything about how
you create your graphics windows so I can't give you further guidance.
 See osgcamera example.

Robert.

2010/8/16 Dženan Zukić :
> Hi,
>
> I am using the following code to save contents of the framebuffer into a file:
> [code]vis->getCamera()->setClearColor(osg::Vec4(0.5f,0.5f,1.0f,0.0f)); //in 
> constructor
>
> class MyPostDrawCallback : public osg::Camera::DrawCallback
> {
> private:
>        int _w, _h;
>        std::string fn;
> public:
>        MyPostDrawCallback(int w, int h, std::string filename): _w(w), _h(h), 
> fn(filename) {}
>        void operator () ( const osg::Camera& cam ) const
>    {
>        osg::ref_ptr rImage = new osg::Image;
>        rImage->readPixels( 0, 0, _w, _h, GL_RGBA, GL_UNSIGNED_BYTE );
>                osgDB::writeImageFile( *rImage, fn );
>    }
> };
>
> void MainLogic::screenshot(std::string filename)
> {
>        mainForm.vis->getCamera()->setPostDrawCallback(
>                new MyPostDrawCallback(mainForm.vis->width(), 
> mainForm.vis->height(), filename));
>        mainForm.vis->frame();
>        mainForm.vis->getCamera()->setPostDrawCallback(0);
> }[/code]
>
> I expected that setting the clear color alpha to 0 would result in 
> transparent background in the saved .png file. It is not so. Is that even 
> possible, and if it is, how?
>
> Thank you!
>
> Cheers,
> Dženan[/code]
>
> --
> Read this topic online here:
> http://forum.openscenegraph.org/viewtopic.php?p=30778#30778
>
>
>
>
>
> ___
> osg-users mailing list
> osg-users@lists.openscenegraph.org
> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
>
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


[osg-users] Alpha channel in framebuffer?

2010-08-16 Thread Dženan Zukić
Hi,

I am using the following code to save contents of the framebuffer into a file:
[code]vis->getCamera()->setClearColor(osg::Vec4(0.5f,0.5f,1.0f,0.0f)); //in 
constructor

class MyPostDrawCallback : public osg::Camera::DrawCallback
{
private:
int _w, _h;
std::string fn;
public:
MyPostDrawCallback(int w, int h, std::string filename): _w(w), _h(h), 
fn(filename) {}
void operator () ( const osg::Camera& cam ) const 
{
osg::ref_ptr rImage = new osg::Image;
rImage->readPixels( 0, 0, _w, _h, GL_RGBA, GL_UNSIGNED_BYTE );
osgDB::writeImageFile( *rImage, fn );
}
};

void MainLogic::screenshot(std::string filename)
{
mainForm.vis->getCamera()->setPostDrawCallback(
new MyPostDrawCallback(mainForm.vis->width(), 
mainForm.vis->height(), filename));
mainForm.vis->frame();
mainForm.vis->getCamera()->setPostDrawCallback(0);
}[/code]

I expected that setting the clear color alpha to 0 would result in transparent 
background in the saved .png file. It is not so. Is that even possible, and if 
it is, how?

Thank you!

Cheers,
Dženan[/code]

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





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


Re: [osg-users] osg::Array

2010-08-16 Thread Jason Daly

Igor Lebedev wrote:

Hi,

Oh, i thought indexed vbo is fastest. I just wanna try alternate, faster method.
  


For Indexed VBO's, you don't use IndexArray's at all.  Instead, you'll 
use one of the DrawElements primitive sets (look in the osggeometry 
example for how these work).  These allow you to specify a single index 
array that applies to all of your attributes (vertices, normals, texture 
coordinates, etc.)


Really, you shouldn't be touching IndexArrays at all if you're trying to 
go fast.


As for the alternate method, are you trying to use interleaved arrays 
(as in glInterleavedArrays)?  I'm honestly not sure if OSG supports 
those at all.  There seems to be a call to it in State.cpp, but I'm not 
sure how you'd go about using it.


Indexed VBO's are quite fast, and if you use them, you won't have to go 
through the process of interleaving all of your vertex attributes manually.




Also, my target of using osg - is make LightWave bones\animation import. I 
believe, i need indices for bones. Am i wrong?
  


Again, that's an entirely different kind of indices  :-)

Usually, you'll use a generic VertexAttribute array for those (this lets 
you have up to 4 bone indices per vertex).  You might want to look at 
osgAnimation and the examples for clues about this.


--"J"

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


Re: [osg-users] preFrame Callback available?

2010-08-16 Thread Robert Osfield
Hi Torben,

There isn't a pre callback, and there really isn't any need as you
have complete control over the frame loop - and you can subclass from
osgViewer::Viewer/CompositeViewer and override the various
*Traversal() methods.  Personally I'd just expand the frame loop to
look like:

while(!viewer.done())
{
do_my_custom_pre_frame_work();
viewer.frame();
}

Or expand frame() further:

while(!viewer.done())
{
do_my_custom_pre_frame_work();
viewer.advance();

do_my_before_event_work();
viewer.eventTraversal();

do_my_before_update_work();
viewer.updateTraversal();

do_my_before_rendering_work();
viewer.renderingTraversals();
}


Robert.

On Mon, Aug 16, 2010 at 12:37 PM, Torben Dannhauer
 wrote:
> Hi,
>
> Does OSG provide a Callback ("preFrame callback") which is called at the 
> beginning of each frame, prior to the event callback or any osg calculation?
>
> Of course I could place my preFrame calls in the main rendering loop prior to 
> any traversal, but it would be more clear to use such a callback, otherwise 
> the mainloop would be polluted by code for several modules which are not 
> loaded in all configurations.
>
> Thank you!
>
> Cheers,
> Torben
>
> --
> Read this topic online here:
> http://forum.openscenegraph.org/viewtopic.php?p=30771#30771
>
>
>
>
>
> ___
> osg-users mailing list
> osg-users@lists.openscenegraph.org
> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
>
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


[osg-users] preFrame Callback available?

2010-08-16 Thread Torben Dannhauer
Hi,

Does OSG provide a Callback ("preFrame callback") which is called at the 
beginning of each frame, prior to the event callback or any osg calculation?

Of course I could place my preFrame calls in the main rendering loop prior to 
any traversal, but it would be more clear to use such a callback, otherwise the 
mainloop would be polluted by code for several modules which are not loaded in 
all configurations.

Thank you!

Cheers,
Torben

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





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


[osg-users] Reuse of texture in same Frame

2010-08-16 Thread Mathias Fiedler
Hi,

i want to render several textured meshes. For each mesh the texture is filled 
with some polygons via a render-to-texture Camera.

Now, to save some video memory i want to reuse the same texture for each mesh.

Looking into the code i think i would need to create 2 render stages for each 
mesh. One rendering the polygons into the texture and another one rendering the 
textured mesh, before filling the texture for the next mesh.

I'm currently trying to achieve this with two prerender cameras for each mesh. 
One camera is a copy of the main camera, so stuff gets rendered into 
framebuffer of the window, and the other camera is added as child to render 
into the texture.

Am i on the right track, or is there a better/simpler solution to this problem?

Thank you!

Cheers,
Mathias

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





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


Re: [osg-users] [vpb] inlineImageFile & MIP_MAPPING_HARDWARE suggestion

2010-08-16 Thread Robert Osfield
HI Alex,

On Wed, Aug 11, 2010 at 2:28 PM, Alexander Irion  wrote:
> Hi,
>
> shouldn't the line
>
> bool inlineImageFile = _dataSet->getDestinationTileExtension()==".ive";
>
> be expanded to:
>
> bool inlineImageFile = _dataSet->getDestinationTileExtension()==".ive" || 
> _dataSet->getDestinationTileExtension()==".osgb";
>
> inorder to get mipmaps as imagery in osgb files?

Reviewing the code in VPB this change does indeed look appropriate.
As Brad mentions .osgb support is very new to the OSG and VPB so
hasn't yet been fully tested and refined so items like this we'll need
to be on the look out for.

I've made the above change to VPB and checked it in to svn/trunk.


> I would also only set hardware mipmap generation in the output file, when 
> MIP_MAPPING_HARDWARE is set:
>
> texture->setUseHardwareMipMapGeneration(getImageOptions(layerNum)->getMipMappingMode()
>  == DataSet::MIP_MAPPING_HARDWARE);
>
> Is this correct?

I can't work out the problem you are thinking about there.  The code
looks fine to me right now, and would expect the code to work for .ive
and .osgb in the same way.  Is there a specific problem you are
thinking about?

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


Re: [osg-users] parameters

2010-08-16 Thread Frederic Bouvier

- "Robert Osfield" a écrit :

> Hi Ricky,
> 
> On Tue, Aug 10, 2010 at 6:34 PM, Ricky Flintoff
>  wrote:
> > So there is no way I can capture focal length effects in OSG using
> the Prespective projection matrix?
> 
> By "focal length effects" do you mean depth of field? 

One can also mean field of view, zooming or even lens distortion too.

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


Re: [osg-users] why transform nodes give a big impact to cull time??

2010-08-16 Thread Robert Osfield
Hi John,

When the cull traversal encounters a Transform node it has to
transform the view frustum (and associated culling properties wrapped
up in the CullingSet class) it the new local coordinates of the
subgraph before it can continue traversing the subgraph.  Entering and
leaving the subgraph will also require the new CullingSet to be pushed
and popped off a stack of them.

The cost of actual concatenation of the matrices is relatively minor.
There is another cost born by using lots of transforms though - the
OSG has to record all the combinations of projection and modelview
matrices that will be used by the draw traversal, and during the draw
traversal that projection and modelview matrices have to be reset as
the traversal walks through the rendering graph. Changing projection
and modelview matrices also means passing more data to OpenGL and
changing state down on the GPU so there will be a GPU cost as well.

So expect a higher cull and draw dispatch and draw GPU cost. The
biggest hit will typically be in the cull.  This is the cost of having
lots of dynamical subgraphs.  We've striven to minimize this cost over
the years by making handing of transforms as streamlined as possible,
to get any more efficient you have to start thinking about replacing
transforms with other nodes.

For you own app the really big question has to be do you need all
these transforms. Using a thousand transforms visible on screen at
once is unlikely to affect performance too much, using hundreds of
thousands of transforms will be a problem.  You don't say anything
about what you are doing and why with your scene graph or the
performance you are getting so I really can't say anything more about
what you should do with your app, you'll need to pass on more info so
others can make suggestions based on this.

Robert.

On Fri, Aug 13, 2010 at 3:57 AM, John Water  wrote:
> Hi everybody:
>
>
> I found that the more transform node, the higher cull time ??
>
> is that correct ??  in one whole scene graph, transform node'cull time occupy 
> 60~70% in total cull time ??
>
> any solution, thanks in advance.
>
> Thank you!
>
> Cheers,
> John
>
> --
> Read this topic online here:
> http://forum.openscenegraph.org/viewtopic.php?p=30729#30729
>
>
>
>
>
> ___
> 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] [vpb] Height retrieval from dted file

2010-08-16 Thread Robert Osfield
Hi Padmini,

With VPB databases there is a CoordinateSystemNode placed at the top
of the scene so you don't need to create your own one to decorate it.
Instead search the root of the scene graph for this node.  See the
osgsimulation example for how you can do this.

As for the heights not be exactly what you expect it, I don't have an
answer for this without directly debugging your code with your data.
I have way too many tasks on to provide this level support so you'll
need go debug it yourself.

Robert.

On Fri, Aug 13, 2010 at 7:41 AM, Padmini Kiran  wrote:
> Hi,
>
> This is regarding my earlier post.
> The file that generated is geo-referenced.Using osgpick, i could see the
> lat,lon and some z value.
> for ex.:
> (76.3396,32.292,0.0260343) using osgpick.
>
> i have used ConvertXYZtolatlonheight, but i get some values, which is 
> incorrect. The code is
>
> .
> osg::CoordinateSystemNode* csn = new osg::CoordinateSystemNode;
> csn->setEllipsoidModel(new osg::EllipsoidModel());
> csn->addChild(myModel); //this is pointing to .ive file
>
> os<<" local coords vertex("<< hitr->getLocalIntersectPoint()<<")"< os<<" world coords vertex("<< hitr->getWorldIntersectPoint()<<")"<
> osg::Vec3 point = hitr->getWorldIntersectPoint();
>
> double latitude;
> double longitude;
> double height;
>
> csn->getEllipsoidModel()->convertXYZToLatLongHeight(point.x(),point.y(),point.z(),latitude,longitude,height);
>
> latitude = osg::RadiansToDegrees(latitude);
> longitude = osg::RadiansToDegrees(longitude);
>
> os<<" lat,long,height("<< latitude << "," << longitude << "," << height << 
> ")" <
> gdlist += os.str();
>
> .
>
> If i check band1 value for a given (lat,lon) from DTED file using QGIS, i see 
> height value.
>
> From the .ive file, how to retrieve this information.
> Moreover, the file when viewed using osgviewer, the heights are of 5000ft 
> above, but such look doesn't come, is it that i am providing .dt0 file.
>
> Please help, i struck here.
>
>
> Thank you in advance
>
> Cheers,
> Padmini
>
> --
> Read this topic online here:
> http://forum.openscenegraph.org/viewtopic.php?p=30732#30732
>
>
>
>
>
> ___
> 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] [vpb] Black chroma keying - bug or feature?

2010-08-16 Thread Robert Osfield
Hi Alexander,

This filter on rbg (0,0,0) value is done to enable VPB to problem
merge reprojected imagery that no longer aligns along regular
boundaries of the image but instead is surrounded by an irregular
black border.  The reprojection itself is done by GDAL.

Robert.

On Wed, Aug 11, 2010 at 1:19 PM, Alexander Irion  wrote:
> Hi,
>
> I use osgdem with a dummy tile of height zero and  the --whole-globe flag set 
> to get the whole earth generated. If I add a texture with parameter -t the 
> black parts of the texture will be translucent and in the resulting texture 
> the color (light grey) of my dummy tile is used instead. See the result in 
> the attached picture "srtm_L3_X3_Y3_incorrect.jpg".
>
> I found the reason for this in the following if statement in line 796 of 
> SourceData.cpp:
>
> …
> else if (sourceColumnPtr[0]!=0 || sourceColumnPtr[1]!=0 || 
> sourceColumnPtr[2]!=0)
> {
> destinationColumnPtr[0] = sourceColumnPtr[0];
>      destinationColumnPtr[1] = sourceColumnPtr[1];
>      destinationColumnPtr[2] = sourceColumnPtr[2];
>      if (destination_hasAlpha)
>            destinationColumnPtr[3] = 255;
> }
> …
>
> The if statement causes the color value only be taken, if it is not black 
> (r=0, g=0, b=0). Commenting out the condition yields in the correct result, 
> shown in picture "srtm_L3_X3_Y3_correct.jpg".
>
> Now, I wonder what the purpose of this if statement was?
>
> Regards,
> Alex
>
> --
> Read this topic online here:
> http://forum.openscenegraph.org/viewtopic.php?p=30688#30688
>
>
>
>
> Attachments:
> http://forum.openscenegraph.org//files/srtm_l3_x3_y3_correct_163.jpg
> http://forum.openscenegraph.org//files/srtm_l3_x3_y3_incorrect_598.jpg
>
>
> ___
> 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] parameters

2010-08-16 Thread Robert Osfield
Hi Ricky,

On Tue, Aug 10, 2010 at 6:34 PM, Ricky Flintoff  wrote:
> So there is no way I can capture focal length effects in OSG using the 
> Prespective projection matrix?

By "focal length effects" do you mean depth of field?  Where you have
the foreground and background blurry and the area of interest in
focus?   You can't do such simulation of physical camera which just
normal OpenGL rendering, so no amendment of a projection matrix will
do this.

Have a search on web and literature about depth field.  You can do it
with the OSG using multiple render to texture cameras and then
blending the result.

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


Re: [osg-users] Away on a trip this week

2010-08-16 Thread Robert Osfield
Hi All,

On Tue, Aug 10, 2010 at 9:29 AM, Robert Osfield
 wrote:
> I'm off on a trip for the rest of this week and should be back online
> next Monday.

I'm back.  I'll trawl through the email traffic over the last week and
then do a purge of pending submissions.

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