Re: [osg-users] Searcing for raytracer implementation based on OSG

2007-10-10 Thread Adrian Egli
KD-Tree...[5804:1000]
KD-Tree Build Time  =   0.0550397s
Intersection Time   =   0.0336411s  - KD Tree
Triangles Checks=   33
Intersection Time osg =   0.331938s   - OSG intersection
visitor
Total Bench Time: 0.423215s



2007/10/10, Ulrich Hertlein [EMAIL PROTECTED]:

 Hi Adrian,

 Quoting Adrian Egli [EMAIL PROTECTED]:
  i am working on a KD-Tree based line intersection test. First result are
  quite better, event for the cow object with 5804 and passed 1000.0 lines
  trought the object with 2 real intersection we have just to check
 against 33
  triangles instead of all (5804).
 ...
  TrianglesChecks=5804
  Total Bench Time: 0.209096s
 ...
  TrianglesChecks=33
  Total Bench Time: 0.0879453s

 Interesting stuff. I assume you're doing some initial pass to build the
 kd-tree?
 If so, how long does that take and is the setup time included in the total
 time?

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




-- 

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


[osg-users] Slave cameras in a view

2007-10-10 Thread Karl Heijdenberg
Hi,

I'm trying to add two cameras to one View in compositeViewer.
The first camera is added as a master camera and the second as a slave
camera.

Frustums for the cameras:
master={-50, 0, -40, 40}
slave={0, 50, -40, 40}

For the first camera I set the projectionMatrix with
setProjectionMatrixAsFrustum.

How do I calculate the projectionOffset for the slave camera?

The offset is needed in call to addSlave(osg::Camera* camera,const
osg::Matrix projectionOffset, const osg::Matrix viewOffset, bool
useMastersSceneData=true);

I've also tried to set the reference frame to ABSOLUTE_RF_INHERIT_VIEWPOINT
and then call the setProjectionMatrixAsFrustum for both cameras. This test
ended up in a black scene for the second camera. Am I missing something?

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


Re: [osg-users] Slave cameras in a view

2007-10-10 Thread Karl Heijdenberg
Thanks David for your try to help.

The reply didn't answer to the question about how to calculate the
projectionOffset for slave cameras. How to?


On 10/10/07, David Callu [EMAIL PROTECTED] wrote:

 Hi Karl


 2007/10/10, Karl Heijdenberg [EMAIL PROTECTED]:
 
  Hi,
 
  I'm trying to add two cameras to one View in compositeViewer.
  The first camera is added as a master camera and the second as a slave
  camera.


 other correct me if I am wrong, frustum is map on interval [0,
 XWindowSize] and [0, YWindowSize]


That is the interval values of the viewport for the camera in the view.

Frustums for the cameras:
  master={-50, 0, -40, 40}
  slave={0, 50, -40, 40}


I use near=1 and far=100

For the first camera I set the projectionMatrix with
  setProjectionMatrixAsFrustum.


I give these required arguments to the setProjectionMatrixAsFrustum method
(for the master cam):

{left,right,bottom,top,near,far} = {tan(degToRad(-50)) * near, tan(degToRad(0))
* near, tan(degToRad(-40)) * near, tan(degToRad(40)) * near, near, far}


 How do I calculate the projectionOffset for the slave camera?


This is the question I'm interested in a good answer to!

during update of camera position, the projection matrix for slaveis compute
 as this
 slaveCamera-setProjectionMatrix( masterCamera-getProjectionMatrix() *
 slaveCamera-getProjectionOffset() );
 idem for the view matrix and the viewOffset.


 The offset is needed in call to addSlave(osg::Camera* camera,const
  osg::Matrix projectionOffset, const osg::Matrix viewOffset, bool
  useMastersSceneData=true);
 
  I've also tried to set the reference frame to
  ABSOLUTE_RF_INHERIT_VIEWPOINT and then call the setProjectionMatrixAsFrustum
  for both cameras. This test ended up in a black scene for the second camera.
  Am I missing something?
 
  Thanks, Karl
  ___
  osg-users mailing list
  osg-users@lists.openscenegraph.org
  http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
 
 
 

 HTH
 David

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




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


[osg-users] osg gui

2007-10-10 Thread Gerald Lindsly
I am trying to use a gui library (guichan) with osg.
   
  I have derived an osgViewer widget from its Container class.
  The gui works fine when I don't invoke the viewer, but if I do, then I get 
the 3D view as the background of the widget but the children of the widget 
won't display on top of the view.
   
  I thought it had to do with osg not restoring the OpenGL state and I tried 
pushing everything at the start and popping it before the gui draw calls...  No 
luck.
   
  Can someone help me out here?  I have attached the relevant code that does 
all the drawing for the gui.
   
  Thanks,
  Gerald

   
-
Catch up on fall's hot new shows on Yahoo! TV.  Watch previews, get listings, 
and more!/*  ___   __   __   __   __   __   __   ___   __   __
 * / _/\ / /\ / /\ / /\ / /\ / /\ / /\ / ___  /\ /  |\/ /\
 */ /\\// / // / // / // /\___\// /_// / // /\_/ / // , |/ / /
 *   / / /__   / / // / // / // / // ___  / // ___  / // /| ' / /
 *  / /_// /\ / /_// / // / // /_/_   / / // / // /\_/ / // / |  / /
 * /__/ //__/ //_/ //_/\ /_/ //_/ //_/ //_/ //_/ /|_/ /
 * \__\/ \__\/ \_\/ \_\/ \_\/ \_\/ \_\/ \_\/ \_\/ \_\/
 *
 * Copyright (c) 2004, 2005, 2006, 2007 Olof Naessén and Per Larsson
 *
 * Js_./
 * Per Larsson a.k.a finalman  _RqZ{a^_aa
 * Olof Naessén a.k.a jansem/yakslem_asww7!uY`  )\a//
 * _Qhm`] _f 'c  1!5m
 * Visit: http://guichan.darkbits.org )QkP ` _: :+' .'  {[
 *   .)j(] .d_/ '-(  P .   S
 * License: (BSD)Td/Z fP5(\??\a.  .L
 * Redistribution and use in source and  _dVws?a-?'  ._/L  #'
 * binary forms, with or without )4d[#7r, .   ' )d`)[
 * modification, are permitted provided _Q-5'5W..j/?'   -?!\)cam'
 * that the following conditions are met:   jWP+k/);._W=j f
 * 1. Redistributions of source code must   .$%w\/]Q  . .'  .  mj$
 *retain the above copyright notice,]E.pYY(Q].   a [EMAIL 
PROTECTED]
 *this list of conditions and the   j(]1usEL,. .   ./^ ]{a
 *following disclaimer. 4'_uomm\.  )L);-4 (3=
 * 2. Redistributions in binary form must)_]X{Z('a_a7'aa,  ][
 *reproduce the above copyright notice,   #}]m7`Za??4,P-'7. ).m
 *this list of conditions and the]d2e)Q(Q(  ?94   b-  LQ/
 *following disclaimer in theB!/]C)d_, '(' .f. =C+m
 *documentation and/or other materials  .Z!=J ]e []('-4f _ ) -.)m]'
 *provided with the distribution.  .w[5]' _[ /.)_-+?   _/ W
 * 3. Neither the name of Guichan nor the  :$we` _! + _/ .j?
 *names of its contributors may be used =3)= _f  (_yQmWW$#(
 *to endorse or promote products derived -   W,  smZQ#Wwa]..
 *from this software without specific(js, \[QQW$QWW#?!V.
 *prior written permission.]y:.\..  .
 * -]n w/ ' [.
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT   )/ )/   !
 * HOLDERS AND CONTRIBUTORS AS IS AND ANY   (; sac,'
 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING,   ]^ .-  %
 * BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OFcr
 * MERCHANTABILITY AND FITNESS FOR A PARTICULARaga  La
 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE  5%  )P'-3L
 * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR_bQf` y`..)a
 * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,  ,J?4P'.P_(\?d'.,
 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES   _Pa,)!f/[]/  ?
 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT  _2-..:. .r+_,.. .
 * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, ?a.%'   -'.a_ _,
 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) ^
 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
 * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
 * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
 * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 */

/*
 * For comments regarding functions please see the header file.
 */

#include guichan/opengl/openglgraphics.hpp

#if defined (_WIN32)
#define WIN32_LEAN_AND_MEAN
#include windows.h
#endif

#if defined (__amigaos4__)
#include mgl/gl.h
#define glVertex3i glVertex3f
#elif defined(__APPLE__)
#include OpenGL/gl.h
#else
#include GL/gl.h
#endif

#include guichan/exception.hpp
#include guichan/image.hpp
#include guichan/opengl/openglimage.hpp

namespace gcn
{
OpenGLGraphics::OpenGLGraphics()
{
setTargetPlane(640, 480);
mAlpha = false;
}

OpenGLGraphics::OpenGLGraphics(int width, int height)
{
setTargetPlane(width, height);
 

Re: [osg-users] Please test SVN version of OpenSceneGraph

2007-10-10 Thread Brian Keener
ALberto see my response below

Alberto Luaces wrote:
  As I say I check the CMAKE_ flags you mentioned and mine match yours and to
  answer my questions from above - Yes I have X installed on my Cygwin, 2nd
  question: I have left the X11_ paths alone and I have changed them to be
  their X11_???-NOTFOUND equivalents and I have in the past had errors
  leaving them as ccmake sets them and better luck with them set to NOTFOUND.
   Third question - I have been doing plain makes.
 
 Out of curiosity, where do you get those plain Makefiles? I think the 
 original 
 ones were eliminated from recent versions of the SVN. I'm only using the 
 cmake generated Makefile.

Sorry - bad choice of words.  I have in the past used the original make files 
from the earlier revisions to diagnose issues but the test builds I did for you 
were all total current svn and then doing a ccmake and generate the makefile 
and 
then at the command prompt type make with no options (that is what I meant by 
plain make - my mistake).

  I did delete the full obj directory (as I have done other tests) and I did
  an SVN update and I did change the CMAKE_VERBOSE_MAKEFILE switch to on and
  the dang thing ran all the way through [100%].  
 
 I think when you touch any of the cmake options, the Makefile is rewritten, 
 so 
 you have to build all the project again. It makes sense when one changes some 
 compiler switch, but unfortunately when there are only minor changes to the 
 configuration it also requires the complete build.

That is what I have tried to do is always make uninstall, make clean and then 
change the config and regenerate and then do a new fresh make.

Thanks for the assistance - maybe we can find something.

bk



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


Re: [osg-users] Please test SVN version of OpenSceneGraph

2007-10-10 Thread Brian Keener
Replies below:

Alberto Luaces wrote:
 What I'm planning to do is to set the CYGWIN environment variable to 
 
 CYGWIN=error_start=[path_to_gdb]gdb.exe

 so gdb is called when a program crashes. Then I'll be able to get a stack 
 trace and see where the crash happened.


Is that the syntax - I can try it and see what I get.
  
 Another way is to attach gdb to a hanging process in order to also get the 
 stack trace. I'll post any progress.

Good - you can explain Cygwin PIDs to me.  When I run one of the osg examples 
from a bash prompt in Cygwin it appears the PID I am seeing does not always 
match the PID that Windows Task Manager is showing.  I actually have my 
Cygwin set up so it passes through login.exe before starting bash.exe and you 
never see the pid for bash shell but instead see the entry for Bash with  a 
pid that belongs to the Login process so it becomes difficult to know where 
to attach.
 
  I'll turn that on and try a build.  Three questions:
 
  Do you have X installed in your Cygwin?
 
 No. Do you have any reason for using it? We could also see that.

For OSG - no,  but I do like using X for some things and just to experiment.

bk



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


[osg-users] osg gui (oops!)

2007-10-10 Thread Gerald Lindsly
I am new so I didn't know that an attached file wouldn't be available (thought 
it would be scubbed and made available with a link).
   
  Anyway, maybe somebody can tell me what's going wrong without seeing the code 
(perhaps this an issue with any OpenGL-based gui).
  I am pulling my hair out here and can't think of anything else to try to get 
it to work.  If you need to see the code, send me an email to [EMAIL PROTECTED] 
and I'll email it to you.
   
  Thank you,
  Gerald

   
-
Moody friends. Drama queens. Your life? Nope! - their life, your story.
 Play Sims Stories at Yahoo! Games. ___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


[osg-users] RTT and stereo (revisited)...

2007-10-10 Thread Mike Logan


ahem..  Looking for some free debugging.. 8)

I've included a very slimmed down  modified osgprerender.cpp
 example with a second camera added in an attempt to
get stereo-rtt working..

I've discovered that the
 RenderImplementation = osg::Camera::SEPERATE_WINDOW
is a very useful tool (run with the --window option).

It seems to show that the program is basically working
 in stereo but the final main window only shows the right eye.

I've tried this on OSX (anaglyph) and Linux (quad-buffer) and
 they perform roughtly the same.   (OSG-SVN 2.2.10+  or so)

Anyone done this already with the SVN version?
See anything obvious?

ml


#include osg/GLExtensions
#include osg/DrawPixels
#include osg/Node
#include osg/Geometry
#include osg/Notify
#include osg/MatrixTransform
#include osg/Texture2D
#include osg/TextureRectangle
#include osg/Stencil
#include osg/ColorMask
#include osg/Depth
#include osg/Billboard
#include osg/Material
#include osg/AnimationPath

#include osgGA/TrackballManipulator
#include osgGA/FlightManipulator
#include osgGA/DriveManipulator

#include osgUtil/SmoothingVisitor

#include osgDB/Registry
#include osgDB/ReadFile

#include osgViewer/Viewer

#include iostream



osg::Camera*
create_camera( const int eye, const osg::BoundingSphere bs,
unsigned int tex_width,
unsigned int tex_height,
osg::Camera::RenderTargetImplementation renderImplementation )

{
osg::Camera* camera = new osg::Camera;

// set up the background color and clear mask.
//camera-setClearColor(osg::Vec4(0.1f,0.1f,0.3f,1.0f));
camera-setClearMask(GL_COLOR_BUFFER_BIT |  
GL_DEPTH_BUFFER_BIT);


float znear = 1.0f*bs.radius();
float zfar  = 3.0f*bs.radius();

// 2:1 aspect ratio as per flag geometry above.
float proj_top   = 0.25f*znear;
float proj_right = 0.5f*znear;
// 1:1 aspect ratio as per flag geometry above.
/*mal*/proj_top   = 1.0f*znear;
/*mal*/proj_right = 1.0f*znear;

znear *= 0.9f;
zfar *= 1.1f;

// set up projection.
camera-setProjectionMatrixAsFrustum(-proj_right,proj_right,- 
proj_top,proj_top,znear,zfar);


// set view
camera-setReferenceFrame(osg::Transform::ABSOLUTE_RF);
camera-setViewMatrixAsLookAt( bs.center()-osg::Vec3(0.0f, 
1.0f,0.0f)*bs.radius(),

   bs.center(),
   osg::Vec3(0.0f,0.0f,1.0f));

// set viewport
camera-setViewport(0,0,tex_width,tex_height);

// set stereo parameters

camera-setCullMaskLeft( 0x1 );
camera-setCullMaskRight( 0x2 );

switch( eye ) {
case 0:
camera-setClearColor(osg::Vec4(0.3f,0.3f,0.1f,1.0f));
break;
case 0x1:
camera-setCullMask( 0x1 );
//camera-setViewport(0,0,tex_width/2,tex_height/2);
camera-setClearColor(osg::Vec4(0.3f,0.1f,0.1f,1.0f));
camera-setViewMatrixAsLookAt( bs.center()-osg::Vec3(0.1f, 
1.0f,0.0f)*bs.radius(),

   bs.center(),
   osg::Vec3(0.0f,0.0f,1.0f));
break;
case 0x2:
camera-setCullMask( 0x2 );
//camera-setViewport(tex_width/2,0,tex_width/ 
2,tex_height/2);

camera-setClearColor(osg::Vec4(0.1f,0.1f,0.3f,1.0f));
camera-setViewMatrixAsLookAt( bs.center()-osg::Vec3(-0.1f, 
1.0f,0.0f)*bs.radius(),

   bs.center(),
   osg::Vec3(0.0f,0.0f,1.0f));
break;
}

// set the camera to render before the main camera.
camera-setRenderOrder(osg::Camera::PRE_RENDER);

// tell the camera to use OpenGL frame buffer object where  
supported.

camera-setRenderTargetImplementation(renderImplementation);

return camera;
}

osg::Node*
createPreRenderSubGraph(
  osg::Node* subgraph,
  unsigned int tex_width,
  unsigned int tex_height,
  osg::Camera::RenderTargetImplementation renderImplementation)

{
if (!subgraph) return 0;

// create a group to contain the flag and the pre rendering camera.
osg::Group* parent = new osg::Group;

// texture to render to and to use for rendering of flag.

osg::Texture* texture = 0;
osg::Texture2D* texture2D = new osg::Texture2D;
texture2D-setTextureSize(tex_width, tex_height);
texture2D-setInternalFormat(GL_RGBA);
texture2D-setFilter 
(osg::Texture2D::MIN_FILTER,osg::Texture2D::LINEAR);
texture2D-setFilter 
(osg::Texture2D::MAG_FILTER,osg::Texture2D::LINEAR);

texture = texture2D;

//
// create the object on which to drape our rendered 'canvas'..
//
osg::Geometry* polyGeom = new osg::Geometry();

polyGeom-setSupportsDisplayList(false);

osg::Vec3 origin(0.0f,0.0f,0.0f);

[osg-users] osgViewer::Viewer and getSceneView

2007-10-10 Thread Pasquale Tricarico
Hi,

I'm updating a project to OSG-2.2, after several months (~6) of
interrupted development, and I'm facing a problem. Before I based my
code on the QT viewer example, with:

class ViewerQT : public osgViewer::Viewer, public GraphicsWindowQT {...}

and I could do:

ViewerQT * viewerWindow = new ViewerQT;
viewerWindow-getSceneView()-...;

Now, I've updated my code using the latest osgviewerQT example, where:

class AdapterWidget : public QGLWidget {...}

class ViewerQT : public osgViewer::Viewer, public AdapterWidget {...}

but now ViewerQT doesn't provide the getSceneView() method. How can I
recover it? I needed it mainly to modify the near/far ratio:

...-getSceneView()-setNearFarRatio(1.0e-8); // big scene, with many
tiny important details that need to be rendered

and for debugging/verbose output such as:

...-getSceneView()-getProjectionMatrixAsPerspective(fovy,
aspectRatio, zNear, zFar);

Maybe now OSG 2.2 offers better ways to perform these two tasks?

Thanks a lot,
Pasquale

(BTW, the first line of osgviewerQT.cpp says OpenSceneGraph example,
osganimate., got to love cut'n'paste ;)
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] RTT and stereo (revisited)...

2007-10-10 Thread Farshid Lashkari
Hi Mike

You need to set the left/right cull masks on the SceneView. Then set
the node masks for each camera to the appropriate cull mask. I've
successfully used this technique to render camera nodes in stereo.

-Farshid

On 10/10/07, Mike Logan [EMAIL PROTECTED] wrote:


 ahem..  Looking for some free debugging.. 8)

 I've included a very slimmed down  modified osgprerender.cpp
  example with a second camera added in an attempt to
 get stereo-rtt working..

 I've discovered that the
  RenderImplementation = osg::Camera::SEPERATE_WINDOW
 is a very useful tool (run with the --window option).

 It seems to show that the program is basically working
  in stereo but the final main window only shows the right eye.

 I've tried this on OSX (anaglyph) and Linux (quad-buffer) and
  they perform roughtly the same.   (OSG-SVN 2.2.10+  or so)

 Anyone done this already with the SVN version?
 See anything obvious?

 ml


 #include osg/GLExtensions
 #include osg/DrawPixels
 #include osg/Node
 #include osg/Geometry
 #include osg/Notify
 #include osg/MatrixTransform
 #include osg/Texture2D
 #include osg/TextureRectangle
 #include osg/Stencil
 #include osg/ColorMask
 #include osg/Depth
 #include osg/Billboard
 #include osg/Material
 #include osg/AnimationPath

 #include osgGA/TrackballManipulator
 #include osgGA/FlightManipulator
 #include osgGA/DriveManipulator

 #include osgUtil/SmoothingVisitor

 #include osgDB/Registry
 #include osgDB/ReadFile

 #include osgViewer/Viewer

 #include iostream



 osg::Camera*
 create_camera( const int eye, const osg::BoundingSphere bs,
 unsigned int tex_width,
 unsigned int tex_height,
 osg::Camera::RenderTargetImplementation
 renderImplementation )

 {
 osg::Camera* camera = new osg::Camera;

 // set up the background color and clear mask.

 //camera-setClearColor(osg::Vec4(0.1f,0.1f,0.3f,1.0f));
 camera-setClearMask(GL_COLOR_BUFFER_BIT |
 GL_DEPTH_BUFFER_BIT);

 float znear = 1.0f*bs.radius();
 float zfar  = 3.0f*bs.radius();

 // 2:1 aspect ratio as per flag geometry above.
 float proj_top   = 0.25f*znear;
 float proj_right = 0.5f*znear;
 // 1:1 aspect ratio as per flag geometry above.
 /*mal*/proj_top   = 1.0f*znear;
 /*mal*/proj_right = 1.0f*znear;

 znear *= 0.9f;
 zfar *= 1.1f;

 // set up projection.

 camera-setProjectionMatrixAsFrustum(-proj_right,proj_right,-proj_top,proj_top,znear,zfar);

 // set view

 camera-setReferenceFrame(osg::Transform::ABSOLUTE_RF);
 camera-setViewMatrixAsLookAt(
 bs.center()-osg::Vec3(0.0f,1.0f,0.0f)*bs.radius(),
bs.center(),
osg::Vec3(0.0f,0.0f,1.0f));

 // set viewport
 camera-setViewport(0,0,tex_width,tex_height);

 // set stereo parameters

 camera-setCullMaskLeft( 0x1 );
 camera-setCullMaskRight( 0x2 );

 switch( eye ) {
 case 0:

 camera-setClearColor(osg::Vec4(0.3f,0.3f,0.1f,1.0f));
 break;
 case 0x1:
 camera-setCullMask( 0x1 );

 //camera-setViewport(0,0,tex_width/2,tex_height/2);

 camera-setClearColor(osg::Vec4(0.3f,0.1f,0.1f,1.0f));
 camera-setViewMatrixAsLookAt(
 bs.center()-osg::Vec3(0.1f,1.0f,0.0f)*bs.radius(),
bs.center(),
osg::Vec3(0.0f,0.0f,1.0f));
 break;
 case 0x2:
 camera-setCullMask( 0x2 );

 //camera-setViewport(tex_width/2,0,tex_width/2,tex_height/2);

 camera-setClearColor(osg::Vec4(0.1f,0.1f,0.3f,1.0f));
 camera-setViewMatrixAsLookAt(
 bs.center()-osg::Vec3(-0.1f,1.0f,0.0f)*bs.radius(),
bs.center(),
osg::Vec3(0.0f,0.0f,1.0f));
 break;
 }

 // set the camera to render before the main camera.
 camera-setRenderOrder(osg::Camera::PRE_RENDER);

 // tell the camera to use OpenGL frame buffer object where
 supported.

 camera-setRenderTargetImplementation(renderImplementation);

 return camera;
 }

 osg::Node*
 createPreRenderSubGraph(
   osg::Node* subgraph,
   unsigned int tex_width,
   unsigned int tex_height,
   osg::Camera::RenderTargetImplementation
 renderImplementation)

 {
 if (!subgraph) return 0;

 // create a group to contain the flag and the pre rendering camera.
 osg::Group* parent = new osg::Group;

 // texture to render to and to use for rendering of flag.

 osg::Texture* texture = 0;
 osg::Texture2D* texture2D = new osg::Texture2D;
 texture2D-setTextureSize(tex_width, tex_height);
 texture2D-setInternalFormat(GL_RGBA);

 texture2D-setFilter(osg::Texture2D::MIN_FILTER,osg::Texture2D::LINEAR);

 texture2D-setFilter(osg::Texture2D::MAG_FILTER,osg::Texture2D::LINEAR);
   

Re: [osg-users] osgViewer::Viewer and getSceneView

2007-10-10 Thread David Callu
Hi Pasquale

  now you need to use the osgViewer::Viewer
   which derive from osgViewer::View
   which derive from osg::View

 You have access to
   - the scene graph by osgViewer::View::GetScene()
   - the camera by osgViewer::View::GetCamera()
   ...

 osgUtil::SceneView is use internally  by osgViewer in osgViewer::Renderer.
And inherited its setting form the camera that osgViewer::Renderer render.
this is done in osgViewer::Renderer::updateSceneView.

 HTH
David

2007/10/11, Pasquale Tricarico [EMAIL PROTECTED]:

 Hi,

 I'm updating a project to OSG-2.2, after several months (~6) of
 interrupted development, and I'm facing a problem. Before I based my
 code on the QT viewer example, with:

 class ViewerQT : public osgViewer::Viewer, public GraphicsWindowQT {...}

 and I could do:

 ViewerQT * viewerWindow = new ViewerQT;
 viewerWindow-getSceneView()-...;

 Now, I've updated my code using the latest osgviewerQT example, where:

 class AdapterWidget : public QGLWidget {...}

 class ViewerQT : public osgViewer::Viewer, public AdapterWidget {...}

 but now ViewerQT doesn't provide the getSceneView() method. How can I
 recover it? I needed it mainly to modify the near/far ratio:

 ...-getSceneView()-setNearFarRatio(1.0e-8); // big scene, with many
 tiny important details that need to be rendered

 and for debugging/verbose output such as:

 ...-getSceneView()-getProjectionMatrixAsPerspective(fovy,
 aspectRatio, zNear, zFar);

 Maybe now OSG 2.2 offers better ways to perform these two tasks?

 Thanks a lot,
 Pasquale

 (BTW, the first line of osgviewerQT.cpp says OpenSceneGraph example,
 osganimate., got to love cut'n'paste ;)
 ___
 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] Did anyone compile osg 2.2 with MINGW?

2007-10-10 Thread Michele Bosi
Just to inform the few ones interested in building OSG with MinGW:
the problem seems to arise when BUILD_OSG_WRAPPERS is set to ON in
both 2.0 and 2.2 version. So if anyone gets this error the thing that
you have to do is to switch off that variable.
It seems that MinGW (Current and Candidate) are unable to build the
introspection modules in both OSG 2.0 and 2.2 because it doesn't
support the wide character part of the Standard C++ Library (see
http://www.mingw.org/MinGWiki/index.php/wide%20characters).
A suggested solution is to use STLPort instead of libstdc++.

Good luck MinGW users!
Michele
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org