Re: [osg-users] Away on a trip

2009-10-12 Thread Mathias Fröhlich

Have Fun!!!

Mathias

-- 
Dr. Mathias Fröhlich, science + computing ag, Software Solutions
Hagellocher Weg 71-75, D-72070 Tuebingen, Germany
Phone: +49 7071 9457-268, Fax: +49 7071 9457-511
-- 
Vorstand/Board of Management:
Dr. Bernd Finkbeiner, Dr. Roland Niemeier, 
Dr. Arno Steitz, Dr. Ingrid Zech
Vorsitzender des Aufsichtsrats/
Chairman of the Supervisory Board:
Michel Lepert
Sitz/Registered Office: Tuebingen
Registergericht/Registration Court: Stuttgart
Registernummer/Commercial Register No.: HRB 382196 


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


[osg-users] VPB: How to get and convert model coordinates?

2009-10-12 Thread Alejandro Aguilar Sierra
Hello:

I want to be able to pick local coordinates from a terrain and convert
them to model coordinates so I can obtain GIS data from a GIS data
base, using those coordinates. Using the osgpick example code, I can
get local and world geometries. I suppose I must get the corresponding
TerrainTile, and call getLocator()-convertLocalToModel . Am I right?

How can I get the picked terrain tile object?

Regards,

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


Re: [osg-users] Question about switching between MatrixManipulator

2009-10-12 Thread J.P. Delport

Hi,

have you tried the home() and setHome() functions?

jp

Shiina Ringo wrote:

Hi,

Here just a quetion confused me:

I have a KeySwitchMatrixManipulator , which served as a swithcer between 2 MatrixManipulator : a default Trackball and a MatrixManipulator that I defined(bounding to a object) . 
The problem is : when I hit the button to switch the above 
MatrixManipulator , especially when I switch the MatrixManipulator that I defined to the Trackball MatrixManipulator  , the view point cannot come back to the default position when the application initiated , and I have to hit the spacebar in order to let the view back to the default positon.

In all , Is there a  method that could let the view point came back to its 
default position when using the Trackball MatrixManipulator?

Could anyone give me some advice about this problem?

Thank you very much!

Cheers,
Shiina

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





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



--
This message is subject to the CSIR's copyright terms and conditions, e-mail legal notice, and implemented Open Document Format (ODF) standard. 
The full disclaimer details can be found at http://www.csir.co.za/disclaimer.html.


This message has been scanned for viruses and dangerous content by MailScanner, 
and is believed to be clean.  MailScanner thanks Transtec Computers for their support.


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


Re: [osg-users] Restoring a Viewer's MatrixManipulator

2009-10-12 Thread J.P. Delport

Hi,

also have a look at these old emails. It is still something I want to 
add to the manipulators to enable smooth switching between them.


Basically, the internal state of the manipulator is not fully encoded in 
the view matrix.


http://article.gmane.org/gmane.comp.graphics.openscenegraph.user/8610

jp

Shiina Ringo wrote:
Hi,Phil 


I just have met the same problem , like the  switching of 2 MatrixManipulators 
, that the home position is not the position which is like the default position.

I just look forward to anyone could give some advice.

Thank you very much!

Cheers,
Shiina

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





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



--
This message is subject to the CSIR's copyright terms and conditions, e-mail legal notice, and implemented Open Document Format (ODF) standard. 
The full disclaimer details can be found at http://www.csir.co.za/disclaimer.html.


This message has been scanned for viruses and dangerous content by MailScanner, 
and is believed to be clean.  MailScanner thanks Transtec Computers for their support.


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


Re: [osg-users] Question about switching between MatrixManipulator

2009-10-12 Thread Shiina Ringo
Hi, JP

Thanks for your advice. I have tried setHome() befor, and this funtion just set 
the default view position for the corresponding MatrixManipulator. Here my 
problem is that: when I hit the button to switch the 2 MatrixManipulator, if I 
switch the trackball to the manipulator that I defined my myself, and the view 
position is no problem; while if I switch the manipulator that I defined myself 
to the trackball, the view position is not the position like the position when 
the application initialed(in other word: the defalut view position of trackball 
manipulator), here if I hit the spacebar(the default key to let the view point 
to Home position), and the view position will come back to the Homeposition, 
which defined by the setHome().

All in all, my question is: when I switching the other Manipulator that I 
defined myself to trackball, How to let the view point automatically come back 
to the default position ( the position is like the application initiated 
position)?

Any help would be appreciated.

Thank you very much!

Cheers,
Shiina

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





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


[osg-users] Multiple Windows

2009-10-12 Thread Russell Morris
Hey all,
I've been searching the forums this afternoon and can't seem to find the answer 
to my question. I have a viewer setup with the following:

rViewer = new osgViewer::Viewer();

wm = new osgWidget::WindowManager(rViewer, width, height, 
MASK_2D, osgWidget::WindowManager::PD_NONE);
rViewer-setUpViewInWindow(width,height,wm-getWidth(),wm-getHeight());
cam = wm-createParentOrthoCamera();

osg::ClearNode *backdrop = new osg::ClearNode;
backdrop-setClearColor(osg::Vec4(0.1,0.1,0.0,1.0));
cam-addChild(backdrop);

// add event handlers
rViewer-addEventHandler(new osgWidget::MouseHandler(wm));
rViewer-addEventHandler(new osgWidget::KeyboardHandler(wm));

rViewer-realize();
rViewer-setCameraWithFocus(cam);
rViewer-setSceneData(cam);

And I need to be able to close the window dynamically. I implemented this:

osgViewer::Viewer::Windows windows;
rViewer-getWindows(windows);
osgViewer::GraphicsWindow *win = *windows.begin();
win-getEventQueue()-keyPress(osgGA::GUIEventAdapter::KEY_Escape);
win-getEventQueue()-keyRelease(osgGA::GUIEventAdapter::KEY_Escape);

but no joy. If anyone can point me in the right direction I'd be most grateful. 
Thanks in advance!

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





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


Re: [osg-users] Screenshot of Current view at specific size using ScreenCaptureHandler

2009-10-12 Thread Jean-Sébastien Guay

Hi Andrew,

I'm using the ScreenCaptureHandler to capture a screenshot of the current view and save it to disk. I would ideally like to save at a specific resolution, say 1280x1024, however the handler is saving the image at the current size of the viewer. 


The ScreenCaptureHandler is not designed to do this. It takes the 
contents of the graphics context of the given view and saves that to 
file, so if your graphics context is assigned to a window that is 
user-resizable then the screen capture will follow the window size.


What you could do is take inspiration from the ScreenCaptureHandler's 
code to write your own handler that would create an RTT camera with a 
graphics context of the desired size, capture that in the post draw / 
final draw callback (so allowing it to render one frame before you 
capture), and then remove that RTT camera. That would be heavier since 
at that moment you'd be rendering your scene twice, but it would only 
take one frame so depending on your scene's complexity you might not 
even notice.


Hope this helps,

J-S
--
__
Jean-Sebastien Guayjean-sebastien.g...@cm-labs.com
   http://www.cm-labs.com/
http://whitestar02.webhop.org/
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] Screenshot of Current view at specific size using ScreenCaptureHandler

2009-10-12 Thread J.P. Delport

Hi,

also see here for inspiration:

http://forum.openscenegraph.org/viewtopic.php?t=3482

jp

Andrew Thompson wrote:
Hi there, 

I'm using the ScreenCaptureHandler to capture a screenshot of the current view and save it to disk. I would ideally like to save at a specific resolution, say 1280x1024, however the handler is saving the image at the current size of the viewer. 

My application is a CAD style application so is not full screen. the user is free to resize the window and that includes the viewer. Ideally I'd like screenshots to be taken at a fixed size and aspect ratio. 


Anyway here's my code. Can anyone suggest what I could do to adjust the 
screenshot size?

BTW - I tried setting the viewport size on the camera but this didn't result in 
a larger image, although it did result in the image appearing to be large 
enough to fit my target size (It was stretched).


Code:

// Create a screen capture handler to capture the screen to image
osg::ref_ptrosg::Image capturedImage;
osg::ref_ptrosgViewer::ScreenCaptureHandler screenCaptureHandler = new 
osgViewer::ScreenCaptureHandler();   

// Create a CWriteToMemoryImageCaptureOperation to get the image out
// NOTE:
// All this does is let me get the image out in memory so I can save it
// What I will eventually do is convert it to .NET Bitmap to pass to 
// other parts of my application

osg::ref_ptrNative::CWriteToMemoryImageCaptureOperation writeMem = new 
Native::CWriteToMemoryImageCaptureOperation();

// Set the capture operation on the screenCaptureHandler
screenCaptureHandler-setCaptureOperation(writeMem);

// Capture the next frame
// viewer is the osgviewer instance
screenCaptureHandler-captureNextFrame(*this-viewer);

// 
// Perform a Render Operation

//

// Get the default scene camera
osg::Camera * camera = this-viewer-getCamera();

// Update the camera view/projection matrices
camera-setProjectionMatrixAsPerspective(fieldOfView, aspect, nearClip, 
farClip);
camera-setViewMatrixAsLookAt(GetCameraPosition(), GetCameraTarget(), 
GetUpVector());

// Render the scene
this-viewer-frame();

// Wait for the captured image to be filled
// NOTE: This really needs to be changed. An event should be raised by
// CWriteToMemoryImageCaptureOperation and passed out to calling code when 
// the image is ready 
while(!capturedImage.valid())

{
capturedImage = writeMem-GetImage();
}

// TEST:
// Write the image to file
bool success = osgDB::writeImageFile(*capturedImage, C:\\Apps\\Test.bmp);










Thank you!

Cheers,
Andrew

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





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


--
This message is subject to the CSIR's copyright terms and conditions, e-mail legal notice, and implemented Open Document Format (ODF) standard. 
The full disclaimer details can be found at http://www.csir.co.za/disclaimer.html.


This message has been scanned for viruses and dangerous content by MailScanner, 
and is believed to be clean.  MailScanner thanks Transtec Computers for their support.


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


Re: [osg-users] Screenshot of Current view at specific size using ScreenCaptureHandler

2009-10-12 Thread J.P. Delport

http://article.gmane.org/gmane.comp.graphics.openscenegraph.user/49179/match=osgposter

J.P. Delport wrote:

Hi,

also see here for inspiration:

http://forum.openscenegraph.org/viewtopic.php?t=3482

jp

Andrew Thompson wrote:

Hi there,
I'm using the ScreenCaptureHandler to capture a screenshot of the 
current view and save it to disk. I would ideally like to save at a 
specific resolution, say 1280x1024, however the handler is saving the 
image at the current size of the viewer.
My application is a CAD style application so is not full screen. the 
user is free to resize the window and that includes the viewer. 
Ideally I'd like screenshots to be taken at a fixed size and aspect 
ratio.
Anyway here's my code. Can anyone suggest what I could do to adjust 
the screenshot size?


BTW - I tried setting the viewport size on the camera but this didn't 
result in a larger image, although it did result in the image 
appearing to be large enough to fit my target size (It was stretched).



Code:

// Create a screen capture handler to capture the screen to image
osg::ref_ptrosg::Image capturedImage;
osg::ref_ptrosgViewer::ScreenCaptureHandler screenCaptureHandler = 
new osgViewer::ScreenCaptureHandler();   


// Create a CWriteToMemoryImageCaptureOperation to get the image out
// NOTE:
// All this does is let me get the image out in memory so I can save it
// What I will eventually do is convert it to .NET Bitmap to pass to 
// other parts of my application
osg::ref_ptrNative::CWriteToMemoryImageCaptureOperation writeMem = 
new Native::CWriteToMemoryImageCaptureOperation();


// Set the capture operation on the screenCaptureHandler
screenCaptureHandler-setCaptureOperation(writeMem);

// Capture the next frame
// viewer is the osgviewer instance
screenCaptureHandler-captureNextFrame(*this-viewer);

// // Perform a Render Operation
//

// Get the default scene camera
osg::Camera * camera = this-viewer-getCamera();

// Update the camera view/projection matrices
camera-setProjectionMatrixAsPerspective(fieldOfView, aspect, 
nearClip, farClip);
camera-setViewMatrixAsLookAt(GetCameraPosition(), GetCameraTarget(), 
GetUpVector());


// Render the scene
this-viewer-frame();   


// Wait for the captured image to be filled
// NOTE: This really needs to be changed. An event should be raised by
// CWriteToMemoryImageCaptureOperation and passed out to calling code 
when // the image is ready while(!capturedImage.valid())

{
capturedImage = writeMem-GetImage();
}

// TEST:
// Write the image to file
bool success = osgDB::writeImageFile(*capturedImage, 
C:\\Apps\\Test.bmp);











Thank you!

Cheers,
Andrew

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





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




--
This message is subject to the CSIR's copyright terms and conditions, e-mail legal notice, and implemented Open Document Format (ODF) standard. 
The full disclaimer details can be found at http://www.csir.co.za/disclaimer.html.


This message has been scanned for viruses and dangerous content by MailScanner, 
and is believed to be clean.  MailScanner thanks Transtec Computers for their support.


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


[osg-users] Is there any examples about OpenThreads?

2009-10-12 Thread Shiina Ringo
Hi,

Here I just need to implement a Timer for my animation control application , 
using the OpenThreads library.
But actually I have found that it is very hard to work on this multi-threads 
programming for me, especially connected with OSG.
So, I just want to find any example programme, which using the OpenThreads 
library, and It could be very helpful for me.

Does anyone who has the experience on the OpenThreads or the implementing of a 
Timer using the thread.

Any help would be appreciated!

Thank you very much!

Cheers,
Shiina

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





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


Re: [osg-users] Is there any examples about OpenThreads?

2009-10-12 Thread Jean-Sébastien Guay

Hi Shiina,


So, I just want to find any example programme, which using the OpenThreads 
library, and It could be very helpful for me.


Well technically, the whole of OSG is an example of OpenThreads... But 
that might not be useful to you since it's a lot of code to look at.


Essentially, you just need to derive a class from OpenThreads::Thread 
and override the run() method. In there your thread will do its work.


If your thread needs to always run in the background, the run() method 
will typically have a while() loop (which can check a variable to see if 
it needs to stop, which can be set by the cancel() method) and call 
Thread::microSleep() to yield to other threads when it's done for now. 
So for example (untested, might not compile but just to give you an example)


class MyThread : public OpenThreads::Thread
{
  public:
MyThread() : _done(false) { /* ... */ }
virtual ~MyThread() { /* ... */ }

virtual void run()
{
  // do some initialization that might need to be done right before
  // the thread does its work
  while (!_done)
  {
// do some work
OpenThreads::Thread::microSleep(1);
  }
  // do some cleanup that might need to be done right after the
  // thread stops working
}

/// called from some other thread to tell this thread to stop
/// working the next time it loops.
void stopWorking() { _done = true; }

  protected:
bool _done;
};

Then from some other thread, say the main thread, you would do:

MyThread* myThread = new MyThread;
myThread-start();

// ...

// ... when we're done ...
myThread-stopWorking()
delete myThread;

In your case, you said you want to do something every second, then 
that's a separate matter, you just need to use osg::Timer to check the 
current time and do your work each second, perhaps inside the while() above.


Hope this helps get you started,

J-S
--
__
Jean-Sebastien Guayjean-sebastien.g...@cm-labs.com
   http://www.cm-labs.com/
http://whitestar02.webhop.org/
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


[osg-users] Silouhette computation and osgShadow::OccluderGeometry

2009-10-12 Thread Tanguy Fautre
Hi,

 

I need to check whether an object occludes another object behind it. To
do so, I currently use a class derived from osgShadow::OccluderGeometry
to compute the occlude silouhette from the camera point of view, and
create an osg::Polytope from that silouhette.

 

Going through osgShadow::OccluderGeometry code, I noticed that the
silouhette is computed via two odd looking functions. For example:

 

inline bool isLightPointSilhouetteEdge(const osg::Vec3 lightpos, const
Edge edge) const

{

if (edge.boundaryEdge()) return true;



float offset = 0.0f;

 

osg::Vec3 delta(lightpos-_vertices[edge._p1]);

delta.normalize();



float n1 = delta * _triangleNormals[edge._t1] + offset;

float n2 = delta * _triangleNormals[edge._t2] + offset;

 

float angle_offset = 0.0f;

 

n1 = cos(acosf(n1) + angle_offset);

n2 = cos(acosf(n2) + angle_offset);

 

if (n1==0.0f  n2==0.0f) return false;



return n1*n2 = 0.0f; 

}

 

What puzzles me is the double calls to cos() and acosf(), as this is
very expensive. Having worked a long time ago on stencil shadows, I
looked back at my old code. It appears I was using the triangles plane
equation and then doing a dot product with the light position. Since the
plane equations need only to be computed once, this was a very fast way
of doing it (and works for both directional and point light). I wonder
what are the advantages of the current osg implementation.

 

My old code looked something like this:

 

void ComputeVisibility()

{

  for (size_t i = 0; i  m_Planes.size(); ++i) {

 

const plane_eq  Plane = m_Planes[i];



double Side = 0.0;



Side += Plane.a * LightPosition[0];

Side += Plane.b * LightPosition[1];

Side += Plane.c * LightPosition[2];

Side += Plane.d * LightPosition[3];



if (Side  0)

  m_Triangles[i].mark();

else

  m_Triangles[i].unmark();

  }

}

 

 

Cheers,

 

Tanguy

 

 


#
Note:
This message is for the named person's use only.  It may contain confidential,
proprietary or legally privileged information.  No confidentiality or privilege
is waived or lost by any mistransmission.  If you receive this message in error,
please immediately delete it and all copies of it from your system, destroy any
hard copies of it and notify the sender.  You must not, directly or indirectly,
use, disclose, distribute, print, or copy any part of this message if you are 
not
the intended recipient. Aris Technologies Ltd and any of its subsidiaries each 
reserve
the right to monitor all e-mail communications through its networks.

Any views expressed in this message are those of the individual sender, except 
where
the message states otherwise and the sender is authorized to state them to be 
the
views of any such entity.

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


Re: [osg-users] SVN commit bottleneck

2009-10-12 Thread Chris 'Xenon' Hanson
Robert Osfield wrote:
 Reviewing submissions is a double edge sword, as without keeping tabs
 on what is happening with the code I'm in poorer position to do
 support and fix bugs.  Reviewing submissions is actually it's not the
 most burdensome side of my work as project lead.  Driving releases
 forward and ongoing maintenance is a burden that takes big blocks of
 my time, and is not something I can do on a drop feed basis like I can
 with general submissions.

  Ok. I can understand that. Are there any aspects of submission review that 
could be
outsourced?

 The idea of have a range of engineers  to have write access to
 branches and with the ability to taken the driving seat with making
 stable releases is something we discussed and put into place around a
 year ago.  Alas apart from Paul Mart'z 2.6.1 release there hasn't been
 any impetus from the community to drive this forward.  The key point
 is that I was trying to step back from having to be the impetus behind
 releases and to allow others to take the reigns.

  I think this is a good plan. I'm not sure I can volunteer to be the sole 
driving force
behind a release (in fact, I know I can't) but it's possible we could assemble 
a few
people that together could do so.

  Is there anyone reading this who could help get the next release out as part 
of a group?

  Do we have a release procedure document?

 appropriate thing to do.  For these reasons I'm more inclined to
 believe that having a single gate keeper of the source is far more of
 an asset that it is a bottleneck.

  I can understand that. As I mentioned above, perhaps it's worth pursuing 
refactoring off
any duties short of the actual SVN commit. Are there other things you think 
could be done
by the community?

 Cheers,
 Robert.

-- 
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


Re: [osg-users] Is there any examples about OpenThreads?

2009-10-12 Thread Shiina Ringo
Hi, J-S

Thank you for your fantastic advice!

Cheers,
Shiina

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





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