[osg-users] [3rdparty] Rendering into cegui element

2010-12-09 Thread issam boughanmi
Hi,

i have an options dialogs in my application using CEGUI

wich allow the user to select an airplane  using a cegui listbox

in the right side i want to render the loaded ive airplane with an animation 
callback that rotate the selected airplane for example 

what is the best approch to load node and rendering them into cegui elements ?


any help is welcome 

thanks and good day

ps : i am using osg via Delta3d

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





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


[osg-users] instantiate image from texture

2010-12-09 Thread Sajjadul Islam
Hi forum,

The following code compiled but crashes while running.

osg::Image *image = new 
osg::Image(*(_ProcessPass[out_tex]-getOutTexture()-getImage()),osg::CopyOp::DEEP_COPY_ALL);

Any logical wrong doing ?

Thanks

Cheers,
Sajjadul

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





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


Re: [osg-users] instantiate image from texture

2010-12-09 Thread Ulrich Hertlein
On 9/12/10 19:23 , Sajjadul Islam wrote:
 The following code compiled but crashes while running.
 
 osg::Image *image = new 
 osg::Image(*(_ProcessPass[out_tex]-getOutTexture()-getImage()),osg::CopyOp::DEEP_COPY_ALL);
 
 Any logical wrong doing ?

Well...
_ProcessPass[out_tex] could be NULL
_ProcessPass[out_tex]-getOutTexture() could be NULL
_ProcessPass[out_tex]-getOutTexture()-getImage() could be NULL

As Robert mentioned a while ago, there is no osgMindReading NodeKit (yet?).

This is all most fundamental Programming and Debugging 101, and the use of a 
debugger
would've gone a long way already.

But I'd suspect that the osg::Image has been unref'd after it has been applied 
by the texture.

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


Re: [osg-users] [3rdparty] Rendering into cegui element

2010-12-09 Thread Robert Osfield
Hi Issam,

Last time I looked at CEGUI I found it to be rather a mess for
integrating with multi-thread, multi-context supports API's like the
OSG.  So what you are after might not be possible, or if it is might
be rather awkward.

On the OSG it should be just a case of creating a slave Render To
Texture (RTT) Camera, or a RTT Camera in the scene graph that is
rendered prior to the main scene graph, then you'd need to worry about
how to pass the texture the OSG created to CEGUI to past onto quad.

You might just find it much easier to skip CEGUI though...

Robert.

On Thu, Dec 9, 2010 at 8:11 AM, issam boughanmi amigof...@gmail.com wrote:
 Hi,

 i have an options dialogs in my application using CEGUI

 wich allow the user to select an airplane  using a cegui listbox

 in the right side i want to render the loaded ive airplane with an animation 
 callback that rotate the selected airplane for example

 what is the best approch to load node and rendering them into cegui elements ?


 any help is welcome

 thanks and good day

 ps : i am using osg via Delta3d

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





 ___
 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] Clearing two Color Buffers separately

2010-12-09 Thread Thorsten Roth

Hi,

Am 09.12.2010 08:07, schrieb J.P. Delport:

It need not be a slave camera, it can just be a camera in your scene. We
have some initial code for an image processing lib here:
http://code.google.com/p/flitr/source/checkout


Quite interesting, as I am also working on an image processing library 
in course of my Master Thesis :) (more precisely, as you might already 
assume from my questions, it's more an image SPACE processing library 
;)) ..though mine is not explicitly based on OpenGL/GLSL and is designed 
to easily allow to tie together several filters with different 
implementation details (e.g. one uses CUDA, another one uses OpenCL, 
another one is completely CPU-based...). I'll have a look at your stuff. 
Thanks again! :-)


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


Re: [osg-users] How to set camera focal length

2010-12-09 Thread Robert Osfield
HI Igor,

I believe you are getting your terms mixed up.  Focal length is not
something that varies for X and Y axis of camera, and an osg::Camera
no GL camera don't have a concept of a focal length.  If you are doing
depth of field rendering technique then field of view would be
relevant, but it really doesn't sound like this what you mean.

I can't work out what you mean given you use of terms is so confused.

Robert.

On Thu, Dec 9, 2010 at 9:54 AM, Igor Galochkin isee...@yandex.com wrote:
 Hi,

 Just to understand how setProjectionMatrix works, say, I need to set X-Focal 
 length of viewer's camera to 1000 and Y-Focal length to 600.
 Also i need the Camera to be translated by x by 0.5 to the right and y by 0.7 
 down.
 What matrix m should i pass to viewer.getCamera()-setProjection(m) to 
 achieve that? Or should I use some other function?


 ...

 Thank you!

 Cheers,
 Igor

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





 ___
 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] Clearing two Color Buffers separately

2010-12-09 Thread J.P. Delport

Hi Thorsten,

On 09/12/10 12:14, Thorsten Roth wrote:

Hi,

Am 09.12.2010 08:07, schrieb J.P. Delport:

It need not be a slave camera, it can just be a camera in your scene. We
have some initial code for an image processing lib here:
http://code.google.com/p/flitr/source/checkout


Quite interesting, as I am also working on an image processing library
in course of my Master Thesis :) (more precisely, as you might already
assume from my questions, it's more an image SPACE processing library
;)) ..though mine is not explicitly based on OpenGL/GLSL and is designed
to easily allow to tie together several filters with different
implementation details (e.g. one uses CUDA, another one uses OpenCL,
another one is completely CPU-based...). I'll have a look at your stuff.
Thanks again! :-)


great, there might be some overlap. We have some of the same plans ito 
the processing chain. Currently we use mostly GLSL for processing, but 
have done some experiments with osgPPU and osgCompute for CUDA stages.


The whole reason for existence for the framework we made is for helping 
some of the students we sponsor for Masters/PhDs in image processing to 
get going faster and focus on the algorithms and not the glue code (and 
of course to use their algorithms without too much porting :). We'd be 
very interested in your work.


I'd like to get a Thrust processing stage going soon. If you have not 
checked it out, the Thrust talk at GTC2010 was quite good:

http://www.nvidia.com/object/gtc2010-presentation-archive.html
talk 2220

rgds
jp



Regards
-Thorsten
___
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] How to set camera focal length

2010-12-09 Thread Igor Galochkin
[quote=robertosfield]HI Igor,
 an osg::Camera
nor GL camera don't have a concept of a focal length.  
[quote]

Under Focal length I mean the distance from the camera's lens to it's focus. 
This distance can be different for x and y, for example, if the camera's lens 
is oval in shape. 

I have to write a function which receives, among other parameters, these 2 
values (x focal length and y focal length) and have to pass it somehow to the 
OSG viewer. Is there a way to do this at all?

If this is important, in the library for which i have to do this, the x axis 
goes from left to right of the screen, y axis goes form top to bottom of the 
screen and z axis goes away from the viewer.

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





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


Re: [osg-users] How to set camera focal length

2010-12-09 Thread Mourad Boufarguine
Hi Igor,

Take a look at this website :

http://old.uvr.gist.ac.kr/wlee/web/techReports/ar/Camera%20Models.html

you can find how to compute the projection matrix parameters of an opengl
camera (fovy and aspect ratio)  out of a real camera intrinsic parameters
(focal lengths and focal point).

Mourad



On Thu, Dec 9, 2010 at 10:54 AM, Igor Galochkin isee...@yandex.com wrote:

 Hi,

 Just to understand how setProjectionMatrix works, say, I need to set
 X-Focal length of viewer's camera to 1000 and Y-Focal length to 600.
 Also i need the Camera to be translated by x by 0.5 to the right and y by
 0.7 down.
 What matrix m should i pass to viewer.getCamera()-setProjection(m) to
 achieve that? Or should I use some other function?


 ...

 Thank you!

 Cheers,
 Igor

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





 ___
 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] Advice on Shader usage and osgShadow

2010-12-09 Thread Werner Modenbach
Hi all,

I'm a little confudsed about where to use my own GLSL shaders in a sceene with 
osgShadow.

My scene has osgShadow as it's root and my user scene as a child.
My scene needs it's own shaders.
Until now I derived my own ShadowTechnic class from osgShadowTechnic 
overwriting the default shaders.
Actually I'd like to be more flexible in the use of the ShaderTechnic and I 
ask myself if it is possible to use the standard ShadowTechnics and attach my 
Shaders to my user scene child somehow.

Thanks for any hints.

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


[osg-users] Using a manipulator to follow a moving object

2010-12-09 Thread Brian Palmer
Hi,

I'm working on an application where the initial scene is scene is very large. 
However, as the user adds smaller objects to the scene I want the camera to be 
able to follow the objects. I'd like to be able to center the manipulator on an 
object and follow the object along a path.

I'm trying to use the orbitalManipulator's setTransformation function to do 
this by calculating an eye vector (based on a North East Down offset from the 
center and rotation back to X,Y,Z), a center (the object's position), and an up 
vector (the unit vector of the object's position). I can run the model and 
printout what appear to be valid vectors for the eye, center, and up, but the 
camera appears to be looking at my object from the wrong direction. 

Does my approach seem logical, and is there some obvious coordinate conversion 
that I'm not doing to go between global (x,y,z -model coordinates) to viewing 
(cameraManipulator) coordinates?

ViewerQT* canvas;

canvas-getCameraManipulator()-setTransformation(eye, center, up);

Thank you!

Cheers,
Brian

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





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


Re: [osg-users] Using a manipulator to follow a moving object

2010-12-09 Thread Brian Palmer
Hi,

Sorry, I missed this reference in the wiki. I'll try to do better next time. I 
haven't got this working yet, but can't help but think this will be the right 
way to implement what I'm looking for.

Thank you!

Cheers,
Brian

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





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


Re: [osg-users] MacOS X 32 and 64 bit universal binaries?

2010-12-09 Thread Stephan Maximilian Huber
HI J-S,

Can't comment much about the fink-stuff...

Am 08.12.10 17:08, schrieb Jean-Sébastien Guay:

 How do you tell CMake to build frameworks? Or does it do it by default?
 Also how do you tell CMake to build universal binaries?

Just set OSG_COMPILE_FRAMEWORKS to TRUE and
OSG_COMPILE_FRAMEWORKS_INSTALL_NAME_DIR accordingly. (If you want to
embed the frameworks within your application-bundle, use
@executable_path/../Frameworks, otherwise something like
/Library/Frameworks

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


Re: [osg-users] How to set camera focal length

2010-12-09 Thread Robert Osfield
Hi Igor

On Thu, Dec 9, 2010 at 11:03 AM, Igor Galochkin isee...@yandex.com wrote:
 Under Focal length I mean the distance from the camera's lens to it's focus. 
 This distance can be different for x and y, for example, if the camera's lens 
 is oval in shape.

 I have to write a function which receives, among other parameters, these 2 
 values (x focal length and y focal length) and have to pass it somehow to the 
 OSG viewer. Is there a way to do this at all?

It's clear that you are still confused by the terms and what OpenGL
projection/view matrices do you.  I'd suggest you do some background
reading.

My best guess is what you are thinking of field of view - the angle
between the horizontal and vertical axis.

 If this is important, in the library for which i have to do this, the x axis 
 goes from left to right of the screen, y axis goes form top to bottom of the 
 screen and z axis goes away from the viewer.

In OpenGL and the OSG, the orientation of projected coordinates are
always X+ive to the the right, Y+ve to the top of the screen, and +Zve
out from the screen.  The projection matrix is what sets up the field
of view and near/far planes.

The view matrix positions the world coordinates of your scene relative
to the camera.  Your world coordinates can be any reference frame you
want, it's the view matrix you define the controls this.  The OSG
defaults to loading models and setting the default home position/view
matrix to X+ve to east, Y+ to the north and Z+ve up.  This is
consistent to how the bulk of the vis-sim/GIS industry define world
coordinates.

It's best to always keen your idea of the screen/projected coordinates
as a separate reference frame from your world coordinates in your
scene.  screen/projected coordinate frame is always set by the
convention of OpenGL as I mentioned above, while world coordinates is
chosen by the application to best suit the type of data it will be
dealing with.

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


Re: [osg-users] Advice on Shader usage and osgShadow

2010-12-09 Thread Jean-Sébastien Guay

Hello Werner,


Actually I'd like to be more flexible in the use of the ShaderTechnic and I
ask myself if it is possible to use the standard ShadowTechnics and attach my
Shaders to my user scene child somehow.


There is no problem with this, we do it ourselves.

The only thing to be aware of is that anytime you have a shader on a 
child node somewhere in your graph, if you want it to have shadows then 
you need to use the same shadow mapping code as the ShadowTechnique's 
shaders. So it may be easier to do as the ViewDependentShadow classes 
do: separate the main shader and the shadow shader (for both stages, 
vertex and fragment), and just have some function in your code that when 
creating a new osg::Program, will add the user's shaders plus the shadow 
shaders. The user's shaders would just have to call the function(s) 
defined in the shadow shaders at the appropriate time.


Otherwise you can of course copy-paste the shadow shader code into your 
own shaders instead, but that is error-prone and if you decide you want 
to change something (like filter the shadows, or whatever) you have to 
change it in many places.


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] MacOS X 32 and 64 bit universal binaries?

2010-12-09 Thread Jean-Sébastien Guay

Hi Stephan,


Just set OSG_COMPILE_FRAMEWORKS to TRUE and
OSG_COMPILE_FRAMEWORKS_INSTALL_NAME_DIR accordingly. (If you want to
embed the frameworks within your application-bundle, use
@executable_path/../Frameworks, otherwise something like
/Library/Frameworks


Thanks, good to know.

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] [3rdparty] Rendering into cegui element

2010-12-09 Thread issam boughanmi
hi robert,

thanks for the suggestion

but what the most suitable gui framework other than CEGUI that can i use with 
the rtt camera
osgwidget, osgsdl, ... etc

in my CEGui option dialogs i have a tabcontrol with differents controls, 
(listbox, textboxes, sliders ... etc)

what is the best replacement that can work easily with the rtt camera ?

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





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


Re: [osg-users] How to set camera focal length

2010-12-09 Thread Igor Galochkin
Thanks for help!

I am setting the focal lense x and y with the following calls now and it seems 
to work fine:


double fovy = 2 * atan(this-_height / 2.0 / dFocalLengthY);
double aspectRatio = this-_nWidth / this-_nHeight * dFocalLengthY / 
dFocalLengthX;
double zNear = 0.1, zFar = 100.0;

_viewer.getCamera()-setProjectionMatrix(::osg::Matrix::perspective(fovy, 
aspectRatio, zNear, zFar));


But i still can't set up the position and rotation of the viewer's camera. 

this-_viewer.getCamera()-setReferenceFrame(::osg::Transform::ABSOLUTE_RF);
this-_viewer.getCamera()-setViewMatrix(::osg::Matrix::translate(0.5, 0.3, 
0.1));

this does nothing. 

My guess is becase i also have to call:

::osg::ref_ptr ::osgGA::KeySwitchMatrixManipulator keyswitchManipulator = new 
::osgGA::KeySwitchMatrixManipulator;

keyswitchManipulator-addMatrixManipulator( '1', Trackball, new 
::osgGA::TrackballManipulator() );

this-_viewer.setCameraManipulator( keyswitchManipulator.get() );

or the offscreen capture doesn't render the scene, just an empty background. It 
looks like viewer needs a camera manipulator or it won't render the scene.


Is it at all possible to move the camera programmatically after a camera 
manipulator has been set for the viewer? Or can i avoid creating a camera 
manipulator?

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





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


Re: [osg-users] Warning: detected OpenGL error 'stack overflow' after RenderBin::draw(, )

2010-12-09 Thread David Glenn

robertosfield wrote:
 Hi Mohammad,
 
 A OpenGL stack overflow would be something like the matrix stack
 overflowing.  The OSG by itself doesn't use OpenGL stacks a great deal
 so won't find my OSG apps that will ever bring up this error.  My
 guess is that FreeVR must be using the stack which in combination with
 the OSG overflows.  I know nothing about FreeVR or how you've
 integrated it with the OSG so really can't help you pinpoint exactly
 where the problem lies.
 
 Robert.
 
 On Wed, Dec 8, 2010 at 7:54 AM, Mohammad Reza Shakouri  wrote:
 
  Hi,
  
  I wrote and application which integrates freeVr and osgViewer, now 
  everything seems to be working very good. but still i get this error when I 
  compile my code.
  
  Warning: detected OpenGL error 'stack overflow' after RenderBin::draw(,)
  
  I tried search the Internet but I could not find what seems to be the 
  problem.
  
  Does anyone know about this ?
  
  Thank you!
  
  Cheers,
  Mohammad Reza Shakouri
  
  --
  Read this topic online here:
  http://forum.openscenegraph.org/viewtopic.php?p=34604#34604
  
  
  
  
  
  ___
  osg-users mailing list
  
  http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
  
  
 ___
 osg-users mailing list
 
 http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
 
  --
 Post generated by Mail2Forum


Greetings Robert! 
I used it with the VR Gove and some motion cubes for a half-baked home brew 
motion capture of the arm and hand. If I recall, I remember that I used 
performer because the examples where also done using performer. For what I was 
doing at the time, it was good enough! 

The author says that it's compatible with OSG, but I have yet to see any 
examples for this, though some are planned. It’s been some time, so I assume 
that they are issues with that effort!  For right now, it works on OpenGL level 
and Performer! If anyone else has made any progress, I would like to know!


D Glenn (a.k.a David Glenn) - Join the Navy and See the World ... from your 
Desk!

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





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


[osg-users] Uniform array naming problem

2010-12-09 Thread Glenn Waldron
Hi Robert,

I would like to re-raise the issue of uniform array naming, now that it is
affecting me personally :)
To recap:

I have a uniform array in a shader defined as:

   uniform bool positions[1];

osg::Program calls glGetActiveUniform() to build a mapping of compiled
uniforms by name. On some systems, the name returned is positions and on
others it is positions[0]. When the latter happens, a corresponding
osg::Uniform named positions will fail since it cannot find a matching
uniform location in the mapping (since it's filed under positions[0]).

I am not convinced that this is a driver bug. It seems more like an
ambiguity. The docs say that the 'uniform location for positions and
positions[0] are the same; they point to the first element of the array.'
 (http://bit.ly/hnqbUi). I don't see anything that says the value returned
from glGetActiveUniform() must be one or the other.

If both names are valid and equivalent, shouldn't we account for both
possibilities in osg::Program? I suppose you could just alter
getUniformLocation(...) to check for both variations.

Here are the past threads on the topic. The issue crops up on both ATI and
NVIDIA systems.

   http://markmail.org/thread/5mans4howfbu2qtg
   http://forum.openscenegraph.org/viewtopic.php?t=1828

System: WinXP 32, ATI HD5550/10.11, OSG SVN.

Thanks.


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


Re: [osg-users] How to set camera focal length

2010-12-09 Thread Paul Martz

On 12/9/2010 9:35 AM, Igor Galochkin wrote:

Thanks for help!

I am setting the focal lense x and y with the following calls now and it seems 
to work fine:


double fovy = 2 * atan(this-_height / 2.0 / dFocalLengthY);
double aspectRatio = this-_nWidth / this-_nHeight * dFocalLengthY / 
dFocalLengthX;
double zNear = 0.1, zFar = 100.0;

_viewer.getCamera()-setProjectionMatrix(::osg::Matrix::perspective(fovy, 
aspectRatio, zNear, zFar));


You can search the archives for focal length to see some previous discussion. 
Focal length alone doesn't determine field of view. Focal length together with 
aperture control the field of view (at least, that's the way it works with 
telescopes and binoculars).



But i still can't set up the position and rotation of the viewer's camera.

this-_viewer.getCamera()-setReferenceFrame(::osg::Transform::ABSOLUTE_RF);
this-_viewer.getCamera()-setViewMatrix(::osg::Matrix::translate(0.5, 0.3, 
0.1));

this does nothing.


Is it possible that you have a camera manipulator that is overwriting your view 
matrix?



It looks like viewer needs a camera manipulator or it won't render the scene.


That's incorrect. If you don't attach a camera manipulator, and you set the view 
matrix as above, and you unroll the render loop like so:

  while( !viewer.done() )
viewer.frame();

...then OSG will render your scene with the view matrix that you specify.


Or can i avoid creating a camera manipulator?


The programmer's answer: You have the source code. If you are getting a camera 
manipulator that you didn't create, set a breakpoint in its constructor and 
check the call stack to see why OSG is creating it for you.


The short answer: Don't call viewer.run(), because it will create a camera 
manipulator for you if you haven't set one. Instead, use the unrolled render loop.

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


[osg-users] animationPath from Blender?

2010-12-09 Thread Luca Vezzadini
Hi,
We would need to create anim paths in Blender and export them, so to attach 
them to some objects (a camera, a moving truck, ...). While the Max exporter 
handles anim curves properly and exports animationPaths, it seems that this is 
not feasible in Blender. I've also checked out the latest version of the script 
and apparently this feature is not supported.
Can anybody suggest a way to get around it? We would like our paths to be 
generic enough, so to be used with more than one object (imagine a library of 
predefined anim paths that you can link to any object you like...).

Thanks,

Luca

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





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


Re: [osg-users] [osgPPU] Usage of osg::Uniform::Callback with osgPPU::ShaderAttribute ?

2010-12-09 Thread Peter Wrobrl
Hi,

well, this code is properly updating my Uniform: 
osg::Uniform * uniform = new osg::Uniform( Vector , osg::Vec4f( 0.0f , 0.0f , 
0.0f , 0.0f ) ) ;
uniform - setUpdateCallback( new UniformCallback ) ;
stateSet - addUniform( uniform ) ;

So the update call back does reach the Uniform.
My guess is, that you cannot attach the UniformUpdateCallback to an 
osgPPU::ShaderAttribute, as this one is derived from osg::Programm, but the 
UniformUpdateCallback is meant to be attached to an osg::Uniform.

Cheers,
ParticlePeter

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





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


Re: [osg-users] animationPath from Blender?

2010-12-09 Thread Cedric Pinson
Hi,

One way to do it, is to use osgAnimation to play your path, the idea is
to bake the path to an ipo in blender. Another way should be to improve
the blender exporter to export AnimationPath in 'osg' and not
'osgAnimation'

look to in the mailing history: 
[osg-users] [osgPlugins] blender osgExport with IPO Curve
http://forum.openscenegraph.org/viewtopic.php?p=22027#22027

Cheers,
Cedric

On Thu, 2010-12-09 at 22:00 +0100, Luca Vezzadini wrote:
 Hi,
 We would need to create anim paths in Blender and export them, so to attach 
 them to some objects (a camera, a moving truck, ...). While the Max exporter 
 handles anim curves properly and exports animationPaths, it seems that this 
 is not feasible in Blender. I've also checked out the latest version of the 
 script and apparently this feature is not supported.
 Can anybody suggest a way to get around it? We would like our paths to be 
 generic enough, so to be used with more than one object (imagine a library of 
 predefined anim paths that you can link to any object you like...).
 
 Thanks,
 
 Luca
 
 --
 Read this topic online here:
 http://forum.openscenegraph.org/viewtopic.php?p=34676#34676
 
 
 
 
 
 ___
 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] How to set camera focal length

2010-12-09 Thread David Glenn
Greetings!

Just in case or just for grins, I found this page on simulating Depth of Field:

http://screamyguy.net/DepthOfField/index.htm

as far as focal length, there is many calculations that you can use for OpenGL 
- check out some of the gaming jernals! 

That's my two cents worth! I think all the bases are covered now!

All your base are belong to us! Grin!

... 
Good Weekend!

D Glenn


D Glenn (a.k.a David Glenn) - Join the Navy and See the World ... from your 
Desk!

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





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


Re: [osg-users] Using a manipulator to follow a moving object

2010-12-09 Thread Brian Palmer
Hi,
How do I get the NodeTrackerManipulator to be relatively close to the node it 
is following? I've tried calling setDistance to no avail. It is seems to be 
using the boundingSphere of the base node as opposed to the node I'm trying to 
track. I don't where in the NodeTrackerManipulator the distance is set. It 
appears to follow in center and rotation only. Any ideas on how to get the 
NodeTrackerManipulator to follow a smaller object in a larger scene?

Thank you!

Cheers,
Brian

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





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


Re: [osg-users] [osgOcean] Wake effects?

2010-12-09 Thread Shen Qing
hi,
  i get the same question about this.would you get a good solution ?

ErikJohnson wrote:
 Hi,
 
 I thought this would have come up before, but does anyone have suggestions 
 how to render a boat's wake?  Using osgParticle provides an ok solution, 
 but falls apart rapidly if the ocean waves are too large (the particles go 
 underwater).
 
 Would be cool to leverage the same texturing effects as the wave crest foam 
 stuff - just not sure how.  :)
 
 Thanks for any suggestions,
 Erik


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





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


[osg-users] Nested camera and object intersection

2010-12-09 Thread Wang Rui
Hi all,

I just met a not too small nor too big problem while working on an
earth simulation application. Because we have to look closely at some
detailed objects (like a car in Beijing), I have an idea of ignoring
earth vertices while automatically computing near/far planes in those
cases, which will make the near/far planes suitable for viewing
specified nodes and free me from adjusting near/far ratio all the
time. To achieve this, I put the earth model under a nested camera and
set DO_NOT_COMPUTE_NEAR_FAR:

osg::ref_ptrosg::Camera earthCamera = new osg::Camera;
earthCamera-setRenderOrder( osg::Camera::NESTED_RENDER );
earthCamera-setComputeNearFarMode( osg::Camera::DO_NOT_COMPUTE_NEAR_FAR );
earthCamera-addChild( earthModel.get() );

root-addChild( earthCamera.get() );
root-addChild( otherModelsOnEarth );

This works for me, but I found another problem that the intersection
calculating is incorrect. As the file attached shows, I made a pick
handler to pick the earth model (CTRL + left button) and print a
message on the console, but it never worked if the earth's parent is a
nested camera, while working correctly if its parent is a normal group
node.

After a long time debug, I found that the problem happened because the
near/far computing results is not set to any scene cameras. The
computed near/far values are only recorded in the projection stack for
correct rendering, but neither in the viewer's main camera nor nested
camera node, and thus led to wrong MVPW matrix in the intersection
visitor.

Without disturbed by nested camera nodes, the two values will be set
back to the main camera in the SceneView::cull() function, and
everything could continue to work. That means, objects under camera
nodes in the scene graph may not be correctly picked with
IntersectionVisitor, because of the missed near/far planes.

Any ideas or suggestions about this issue?

Cheers,

Wang Rui
#include osg/Texture2D
#include osg/ShapeDrawable
#include osgDB/FileUtils
#include osgDB/ReadFile
#include osgUtil/LineSegmentIntersector
#include osgViewer/Viewer

osg::Geode* createEarth( const osg::Vec3d center )
{
osg::ref_ptrosg::Geode geode = new osg::Geode;
geode-addDrawable( new osg::ShapeDrawable(new osg::Sphere(center, osg::WGS_84_RADIUS_POLAR)) );

std::string filename = osgDB::findDataFile( Images/land_shallow_topo_2048.jpg );
geode-getOrCreateStateSet()-setTextureAttributeAndModes( 0, new osg::Texture2D(osgDB::readImageFile(filename)) );
return geode.release();
}

class PickHandler : public osgGA::GUIEventHandler
{
public:
virtual bool handle( const osgGA::GUIEventAdapter ea, osgGA::GUIActionAdapter aa )
{
if ( ea.getEventType()!=osgGA::GUIEventAdapter::RELEASE ||
 ea.getButton()!=osgGA::GUIEventAdapter::LEFT_MOUSE_BUTTON ||
 !(ea.getModKeyMask()osgGA::GUIEventAdapter::MODKEY_CTRL) )
return false;

osgViewer::Viewer* viewer = dynamic_castosgViewer::Viewer*(aa);
if ( viewer )
{
osg::ref_ptrosgUtil::LineSegmentIntersector intersector = new osgUtil::LineSegmentIntersector(
osgUtil::Intersector::PROJECTION, ea.getXnormalized(), ea.getYnormalized());
osgUtil::IntersectionVisitor iv( intersector.get() );
viewer-getCamera()-accept( iv );

if ( intersector-containsIntersections() )
std::cout  We have picked a model!  std::endl;
}
return false;
}
};

int main( int argc, char** argv )
{
osg::ref_ptrosg::Node model = createEarth( osg::Vec3() );

//osg::ref_ptrosg::Group modelCamera = new osg::Group;
osg::ref_ptrosg::Camera modelCamera = new osg::Camera;
modelCamera-setRenderOrder( osg::Camera::NESTED_RENDER );
modelCamera-addChild( model.get() );

osg::ref_ptrosg::Group root = new osg::Group;
root-addChild( modelCamera.get() );

osgViewer::Viewer viewer;
viewer.setSceneData( root.get() );
viewer.addEventHandler( new PickHandler );
viewer.setUpViewInWindow( 100, 100, 800, 600 );
return viewer.run();
}
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] Using a manipulator to follow a moving object

2010-12-09 Thread Robert Osfield
HI Brian,

NodeTrackerManipulator used to set it's distance relative to the node
being tracked, so what you describe is a regression that must have
been introduced when I merged a submission that re-factored the
manipulators to make them more flexible.  I can't fix this right away
as I'm heads down on another task right now.

Robert.

On Fri, Dec 10, 2010 at 5:35 AM, Brian Palmer bpalmer7...@gmail.com wrote:
 Hi,
 How do I get the NodeTrackerManipulator to be relatively close to the node it 
 is following? I've tried calling setDistance to no avail. It is seems to be 
 using the boundingSphere of the base node as opposed to the node I'm trying 
 to track. I don't where in the NodeTrackerManipulator the distance is set. It 
 appears to follow in center and rotation only. Any ideas on how to get the 
 NodeTrackerManipulator to follow a smaller object in a larger scene?

 Thank you!

 Cheers,
 Brian

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





 ___
 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] osg-users Digest, Vol 42, Issue 19

2010-12-09 Thread william nily
Can Intel TBB work with OSG?
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org