[osg-users] How to Control a 3D Point's Position with Mouse in a certain Plane.

2009-04-25 Thread Mrs. Mister

hello,

i worked with OSG 1.2 in the past. and the osgProducer had
function for obtaining the current position and rotation
(of the camera?). i used:

osgProducer::Viewer::getPosition()
osgProducer::Viewer::getOrientation()

and the relative mouse coordinates, obtained from:

osgGA::GUIEventHandler::handle(...)

with the help of:

osgGA::GUIEventAdapter
osgGA::GUIActionAdapter
.

now i updraded to osg 2.6 and i read trough the header files
of osgViewer::Viewer and View and osg::Camera. sadly i had
no idea where to start or how the procedure for obtaining
the position and orientation of the actual Camera, View is?

maybe some one can point me in the right direction ...

thx and bye
henry

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


[osg-users] shader implementation - newbie

2009-04-25 Thread ami guru
Hello forum,

I am trying to implement some of  the shaders in a single OSG application.
At  the same time i was going through the osgshaders example and if i have
understood that correctly,
i saw that the example has separate osg::program for different shaders

I was wondering if it is possible to have one single program to manage all
the shaders. I think osg::Program
contains a vector of shaders.

Is that possible to store different shaders by different name and load that
according to  the user selection;
delete previous shader and load the currently selected one.


Or separate osg::program for different shader example is best approach.

I am considering different design issue here.

Any opinion regarding that will be helpful.


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


Re: [osg-users] How to Control a 3D Point's Position with Mouse in a certain Plane.

2009-04-25 Thread Alberto Luaces
Hi Henry,

El Jueves 23 Abril 2009ES 15:35:30 Mrs. Mister escribió:
 now i updraded to osg 2.6 and i read trough the header files
 of osgViewer::Viewer and View and osg::Camera. sadly i had
 no idea where to start or how the procedure for obtaining
 the position and orientation of the actual Camera, View is?

You could:

Viewer-getCamera(0)-getViewMatrix().decompose(translation, rotation, scale, 
scaleorientation);

See the method osg::Matrixd::decompose

HTH,

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


Re: [osg-users] Stereo with my own model

2009-04-25 Thread Alberto Luaces
Hi Dat,

El Jueves 23 Abril 2009ES 16:39:36 tien dat escribió:
 Dear all,
 I have a little problem with stereo display. When I run osgviewer with
 --stereo HORIZONTAL_SPLIT and the cow.osg, it looks great. But when
 I try to run osgviewer with my own model, it
 looks weird. It seems that the eye separation is too far (although I'm
 not sure). I try to change to eye position but it doesn't help. Could
 any of you know how to fix that problem?

Depending on the size of your model and your viewpoint, the default stereo 
settings could break the 3D illusion. You must specify the actual size of 
your system to have correct OSG stereo rendering. I for example, use the 
following environment variables with my wall to define the real view frustum:

OSG_SCREEN_DISTANCE=2.20 OSG_SCREEN_HEIGHT=1.50 OSG_SCREEN_WIDTH=1.90 
OSG_STEREO=ON OSG_STEREO_MODE=HORIZONTAL_SPLIT

Regards,

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


Re: [osg-users] On demand and frame rate capping schemes fromViewer::run()

2009-04-25 Thread Robert Osfield
HI Paul,

On Fri, Apr 24, 2009 at 11:53 PM, Paul Martz pma...@skew-matrix.com wrote:
 Hi Robert -- You said the code isn't final yet, but I wondered if the
 osgviewer options and environment variables are final? Or do you intend to
 remove them after development?

Subject to feedback on typos and suggestions of better naming I don't
see a reason that these new command line options and env vars would
need to be changed/removed.

It might make sense to provide a default max frame rate to cope with
systems that don't have vysnc switched on, as the user experience is
better with preventing the app spinning at a silly frame rate.  One
would need to disable this when doing certain types of benchmarking
though.

One concern about introducing a max frame rate value is that end users
we almost certainly ask when they frame rate is not scaling well... or
that OSG-2.9.x/2.10 doesn't perform as well as OSG-2.8.  This is an
education issue, and as we've found out in the past it doesn't really
matter how often you put up information, or where you put it, still
lots of users ignore it completely... so one just has to field the
support from those too lazy to keep informed.

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


Re: [osg-users] shader implementation - newbie

2009-04-25 Thread Robert Osfield
HI Sajjad,

osg::Program has have a list of shaders, think of shaders like .cpp's
that go together to make a C++ program.  You can have just the main or
a whole series of separate files.  The osg::Program is what tells the
OSG/OpenGL what shaders should linked together to make the final
program downloaded to the GPU.

Now if you want different compositions of shaders at different points
in your scene graphs then you'll need to link them together with
separate osg::Program, or use a single osg::Program and uniforms to
option select different paths in the shaders.

Robert.

On Sat, Apr 25, 2009 at 7:54 AM, ami guru dosto.wa...@gmail.com wrote:
 Hello forum,

 I am trying to implement some of  the shaders in a single OSG application.
 At  the same time i was going through the osgshaders example and if i have
 understood that correctly,
 i saw that the example has separate osg::program for different shaders

 I was wondering if it is possible to have one single program to manage all
 the shaders. I think osg::Program
 contains a vector of shaders.

 Is that possible to store different shaders by different name and load that
 according to  the user selection;
 delete previous shader and load the currently selected one.


 Or separate osg::program for different shader example is best approach.

 I am considering different design issue here.

 Any opinion regarding that will be helpful.


 Thanks
 Sajjad

 ___
 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] Keyboard or mouse handler from Qt

2009-04-25 Thread ami guru
Hello forum,


I am using the Qt's GUI framework to interact with the osg scene.

i am using AdapterWidget and i would like to capture the GUI events from the
Qt and pass that

to  the OSG's key-board handler.

in the AdapterWidget.cpp there is a function :


*'
void AdapterWidget::keyPressEvent( QKeyEvent* event )
{

  _gw-getEventQueue()-keyPress( (osgGA::GUIEventAdapter::KeySymbol)
*(event-text().toAscii().data() ) );

}

**


And i have my own keyboard handler class that is the subclass of
osgGA::GUIEventHandler

and i have over-ridden the handle( ) function to capture keyboard events and
act acccodingly.


I do not undestand how map the above 2 together so that the event triggered
from Qt will be caught by my keyboard handler.


Any hint?


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


Re: [osg-users] On demand and frame rate capping schemes fromViewer::run()

2009-04-25 Thread Judd Tracy
It would be nice if the stats handler could display on the screen when the
frame rate is limited and to what value.  That might help some of the people
realize that there is an artificial limitation.  And maybe it should also
report when vsync is enabled too.

On Sat, Apr 25, 2009 at 4:39 AM, Robert Osfield robert.osfi...@gmail.comwrote:

 HI Paul,

 On Fri, Apr 24, 2009 at 11:53 PM, Paul Martz pma...@skew-matrix.com
 wrote:
  Hi Robert -- You said the code isn't final yet, but I wondered if the
  osgviewer options and environment variables are final? Or do you intend
 to
  remove them after development?

 Subject to feedback on typos and suggestions of better naming I don't
 see a reason that these new command line options and env vars would
 need to be changed/removed.

 It might make sense to provide a default max frame rate to cope with
 systems that don't have vysnc switched on, as the user experience is
 better with preventing the app spinning at a silly frame rate.  One
 would need to disable this when doing certain types of benchmarking
 though.

 One concern about introducing a max frame rate value is that end users
 we almost certainly ask when they frame rate is not scaling well... or
 that OSG-2.9.x/2.10 doesn't perform as well as OSG-2.8.  This is an
 education issue, and as we've found out in the past it doesn't really
 matter how often you put up information, or where you put it, still
 lots of users ignore it completely... so one just has to field the
 support from those too lazy to keep informed.

 Robert.
 ___
 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] On demand and frame rate capping schemes fromViewer::run()

2009-04-25 Thread Robert Osfield
On Sat, Apr 25, 2009 at 2:22 PM, Judd Tracy j...@thetracys.net wrote:
 It would be nice if the stats handler could display on the screen when the
 frame rate is limited and to what value.  That might help some of the people
 realize that there is an artificial limitation.  And maybe it should also
 report when vsync is enabled too.

That's a good idea.  We can't alway find out whether vsync is on
though, even if you request it to be on the driver might not implement
it.

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


Re: [osg-users] Geometryconsidered in near+far plane auto computation

2009-04-25 Thread Doug McCorkle

Hello J-S,

Is the solution you posted below the final solution you settled on? I  
had trouble determining what you finally ended up deciding was the  
best path forward. Thanks for posting this information on the list.


Doug

On Apr 22, 2009, at 12:40 AM, Jean-Sébastien Guay wrote:


Hi again Paul,

Anyways, that's a design concern, not implementation. Thanks for  
your suggestions.


And I do want to emphasize that your solution (using a separate  
osg::Camera) does work. I've implemented it for both the skydome and  
cloud plane (which can get really big too) and I can now get really  
close to small models without them being clipped by the near plane.  
Barring any breakthrough on the other front, this will still be a  
very good solution.


If anyone's curious, the code looks like:

// Callback that checks other cameras

namespace {

int s_skyDomePreRenderCameraNum = -100;

class CheckCamerasCallback : public osg::NodeCallback
{
public:
   virtual void operator()(osg::Node* node, osg::NodeVisitor* nv)
   {
   osgUtil::CullVisitor *cv =
   dynamic_cast osgUtil::CullVisitor *( nv );
   if (cv)
   {
   // Do not use cv-getCurrentCamera() because it did not
   // exist in 2.2 which we still support
   osg::Camera* camera =
   cv-getCurrentRenderBin()-getStage()-getCamera();
   // If the camera is either a pre-render camera with num 
   // our pre-render order, or not a pre-render camera
   if (camera-getRenderOrder() != osg::Camera::PRE_RENDER ||
   camera-getRenderOrderNum() 
  s_skyDomePreRenderCameraNum)
   {
   // I should also check if the camera is set to render  
to

   // the framebuffer and is not an RTT camera, just to be
   // sure I'm only affecting the cameras I want to  
affect.


   // Set the camera to not clear the color buffer.
   if (camera-getClearMask()  GL_COLOR_BUFFER_BIT)
   camera-setClearMask(
   camera-getClearMask()  ~GL_COLOR_BUFFER_BIT);
   }
   }

   traverse(node,nv);
   }
};

}

SkyDome::SkyDome(...)
{
   // Skydome initialization (the code is a modified version of the
   // osgEphemeris skydome)
   // ...
   // ...

   // Render the skydome through another camera so that the cloud  
plane

   // won't influence the main camera's near/far plane computations.
   // I'd prefer to find some other way to have the sky dome not
   // influence the main camera near/far values, because this has
   // repercussions on the viewer setup (see how CheckCamerasCallback
   // affects all other cameras). But it works well.
#define USE_EXTRA_CAMERA
#ifdef USE_EXTRA_CAMERA
   osg::Camera* camera = new osg::Camera;
   camera-setRenderOrder(osg::Camera::PRE_RENDER,
   s_skyDomePreRenderCameraNum);   // set to -100 by default
   // Hopefully this will be the first pre-render camera, so it should
   // clear the color and depth buffers (this skydome is not  
guaranteed

   // to fill the whole view at all times).
   camera-setClearMask(GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT);
   // The dome hangs under m_skyTransform.
   camera-addChild(m_skyTransform.get());
   // m_node is the node that's exposed to be added to the graph by
   // client code.
   m_node-addChild(camera);

   // Make sure the main viewer camera only clears the depth buffer
   // otherwise it will clear our skydome...
   m_node-setCullCallback(new CheckCamerasCallback);
#else
   // The dome hangs under m_skyTransform.
   // m_node is the node that's exposed to be added to the graph by
   // client code.
   m_node-addChild(m_skyTransform.get()); // The dome hangs under  
this

#endif

}

Thanks a lot.

J-S

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


[osg-users] Orphographic Camera View?

2009-04-25 Thread Paul
Hi, how do I enable orphographic 3d camera mode?

Thank you.

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





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


Re: [osg-users] Orthographic Camera View?

2009-04-25 Thread Gordon Tomlinson
HI

One place would be to look at  the source code such as  camera header files
it might contain that information and even function

You could have tried searching the examples with a key word such as 'ortho'
you will see osghud.cpp has this info

You could have tried searching the OSG archive and Web  with a key word such
as 'ortho'  you will see osghud.cpp has this info




__
Gordon Tomlinson 

gor...@gordontomlinson.com
IM: gordon3db...@3dscenegraph.com
www.vis-sim.com www.gordontomlinson.com 

__


-Original Message-
From: osg-users-boun...@lists.openscenegraph.org
[mailto:osg-users-boun...@lists.openscenegraph.org] On Behalf Of Paul
Sent: Saturday, April 25, 2009 5:12 PM
To: osg-users@lists.openscenegraph.org
Subject: [osg-users] Orphographic Camera View?

Hi, how do I enable orphographic 3d camera mode?

Thank you.

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





___
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] Orphographic Camera View?

2009-04-25 Thread Paul
Thanks, i did do a search through the source, but i spelled it wrong.
Thanks again. lol

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





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


[osg-users] java osgSwig = binding / wrapping not available easyly ?

2009-04-25 Thread Soaring
hi everyone,

i recently move my scenegraph beginner's work from ogre engine to 
openscenegraph wich i feel is more powerful.

i read the quick start guide (about 100 page, very quick lol ) to learn basic 
concepts of osg

i would like to use java langugae and swing (for MIH), so osgintrospection is a 
first point of start as osgSwig... but :

osgSwig seems to be maintain only for python, wich is a good language i guess, 
but not usefull for me. so i downloaded osgSwig source on my ubuntu and try to 
compile for my personnal java use but documentation and samples are not up to 
date (and not existing for java as i see).

furthermore, i read on forum's post that dynamic language' are great supported 
but bytecode language (like java  c#) are not supported very well (it seems 
some hacks are needed for memory management cause osg use internal pointer 
memory management as a local garbage collector (to sum up) wich can be a 
problem with jni).

another project, javaOsg, seems to be down, and as i understand, manual binding 
must be made so project can't follow osg update as far as needed by the 
communauty... so forget it !

my goal is not to develop my software in c++ (too much time to spend with 
memory and string management for me, except with boost etc.. but it's not my 
cup of thea as we say in french !), not learn another langugage (like python), 
and use java for the great support on multiplatform and Rich Client Platform 
available with netbeans or eclipse.

so i read lot of post, lot of documentation before posting my request, in fact, 
to sum up,
is there an automatic way to bind java with osg automatically in a easier way 
to follow osg update in a minimal time lost ?

if someone as successfully compile a java version of osgSwig for linux 64 (ie 
ubuntu) it will be very nice to update that work on the osgSwig project for the 
communauty..and me too ;-) 

i hope that someone could help me in a technical way (and not just redirect on 
osgSwig... from i come !)

thanks by advance !

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





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


Re: [osg-users] OSG and GDAL

2009-04-25 Thread Sullivan, Joseph (CDR)
Hello All,

I might be missing something obvious here... 

Is there any easy way to use gdal's ability to import CADRG map data to
create a basic moving map window in an osg application? 

Thanks much - best regards to the osg user community!

-Joe

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


Re: [osg-users] Orphographic Camera View?

2009-04-25 Thread Paul
Im using the following code for orthographic projection:

Code:

// set the projection matrix
camera-setProjectionMatrix(osg::Matrix::ortho(-2.0, 2.0, -2.0, 2.0, 0.0, 
1.0));

// set the view matrix
camera-setReferenceFrame(osg::Transform::ABSOLUTE_RF);
camera-setViewMatrix(osg::Matrix::identity());



When I resize the window I would like the scene to stretch and not resize, So 
if the window is twice as wide as it is high the i would like the scene to 
stretch twice as wide too. Any ideas?

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





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


Re: [osg-users] Geometryconsidered in near+far plane auto computation

2009-04-25 Thread Chris 'Xenon' Hanson
  Followup:

  After some brain-twisting, I did realize that even with z comparison off, OGL 
is
probably rejecting the skydome because it's beyond the far clip plane. I've 
been trying to
think of a way to fool this, but it seems like it is unavoidable.

  I wonder if there were somehow a callback you could apply somewhere that 
would hork with
the near/far clip, or if it's just easier to use multiple cameras at that point.

-- 
Chris 'Xenon' Hanson, omo sanza lettere  Xenon AlphaPixel.com
PixelSense Landsat processing now available! http://www.alphapixel.com/demos/
There is no Truth. There is only Perception. To Perceive is to Exist. - Xen
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


[osg-users] Fwd: shader implementation - newbie

2009-04-25 Thread ami guru
Hello Robert,

Thanks for the feedback.

I am trying to design the interface as follows:

if(userEvent == Toon Shader)
{
   //adding the corresponding shader to  the program for the StateSet of the
model
}
else if(userEvent == Gooch Shader)
{
   //adding the corresponding shader to  the program for the StateSet of the
model
}


Now If the user select the Toon Shader several times at several instances
the very same shader will be added several times.

I was thinking about loading all the shaders that i want to incorporate
within in my application during the class's constructor and make the
particular shader active during user selection .

Is there any way within OSG to activate a particular shader while
deactivating the rest of them?


I have one model in my scene that i want to apply different shader on it.



Regards
Sajjad






-- Forwarded message --
From: Robert Osfield robert.osfi...@gmail.com
Date: Sat, Apr 25, 2009 at 10:43 AM
Subject: Re: [osg-users] shader implementation - newbie
To: OpenSceneGraph Users osg-users@lists.openscenegraph.org


HI Sajjad,

osg::Program has have a list of shaders, think of shaders like .cpp's
that go together to make a C++ program.  You can have just the main or
a whole series of separate files.  The osg::Program is what tells the
OSG/OpenGL what shaders should linked together to make the final
program downloaded to the GPU.

Now if you want different compositions of shaders at different points
in your scene graphs then you'll need to link them together with
separate osg::Program, or use a single osg::Program and uniforms to
option select different paths in the shaders.

Robert.

On Sat, Apr 25, 2009 at 7:54 AM, ami guru dosto.wa...@gmail.com wrote:
 Hello forum,

 I am trying to implement some of  the shaders in a single OSG application.
 At  the same time i was going through the osgshaders example and if i have
 understood that correctly,
 i saw that the example has separate osg::program for different shaders

 I was wondering if it is possible to have one single program to manage all
 the shaders. I think osg::Program
 contains a vector of shaders.

 Is that possible to store different shaders by different name and load
that
 according to  the user selection;
 delete previous shader and load the currently selected one.


 Or separate osg::program for different shader example is best approach.

 I am considering different design issue here.

 Any opinion regarding that will be helpful.


 Thanks
 Sajjad

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


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