[osg-users] Bounding Boxes Baked Animation

2013-07-26 Thread Randall Hand
I have a scene where I'm importing an FBX with a large baked animation
in it.  Most of the time, it works great.

However, if I set my camera to
setComputeNearFarMode(osg::Camera::COMPUTE_NEAR_FAR_USING_BOUNDING_VOLUMES),
then it seems the bounding box doesn't update with the animation.  The
bounding box seems to set to the initial position, and then it clips as
soon as it moves. 

Any ideas how to resolve this?
-- 
Randall Hand
www.yeraze.com
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


[osg-users] OSG : Animated Maya Models on Windows

2013-05-01 Thread Randall Hand
So, it seems Collada2.2 on Windows with Visual Studio 2012 is just a
no-go.. Autodesk doesn't have an FBX that works with VS2012 yet, and the
beta they have doesn't work with OSG.  what's the current way of getting
animated models from a tool like Maya into OpenSceneGraph?


-- 
Randall Hand
www.yeraze.com
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] OSG : Animated Maya Models on Windows

2013-05-01 Thread Randall Hand
Hi,

Well, I can only find an OSG exporter for an older version of Blender, which I 
can't find any good way to import from Maya (Collada seems the usual way, but 
Maya does 1.5 and this older Blender only reads 1.4).

... 

Thank you!

Cheers,
Randall

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





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


[osg-users] OSG Collada

2013-04-26 Thread Randall Hand
I'm having trouble with the OSG Collada plugins on Visual Studio.  I
tried downloading the recommended version from the website, but that now
leads to a dead-end.  I dug the the same Collada 2.2 download I use on
Mac  Linux, but I am completely unable to get CMake to recognize boost
on windows, as well as getting lots of Cg header errors when using their
provided solution file.

Has anyone tested if the new Collada 2.4 works with the OSG Plugins? 
Can anyone provide a copy of the good-working version of Collada for me
to build?
 
-- 
Randall Hand
www.yeraze.com
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] Retrieving Z-Near Far per-frame

2013-03-29 Thread Randall Hand
Well, I want to do it "in"
 the frame.. Basically, I'm hoping to get OSG to do the scene traversal 
for culling, etc, then read the znear/zfar values to be sent elsewhere 
while the geometry is pushed down the pipe. I don't need perfectly 
accurate znear/far, just the bounding box estimates.






   	   
   	Trajce Nikolov NICK  
  March 24, 2013 
4:05 PM
  Hi Randal,it
 is easy . somewhere in the loop, probably after the frame all you 
have to do is to get the projection matrix likewhile
 (!viewer.done()){viewer.frame();
viewer.getCamera()-getProjectionMatrixAsFrustum(arguments  )-- trajce nikolov nick


___osg-users 
mailing listosg-users@lists.openscenegraph.orghttp://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
   	   
   	Randall Hand  
  March 23, 2013 
10:41 PM
  Is there (I'm sure there is) a 
way to retrieve the autocalculated ZNear 
 ZFar from the scene graph on a per-frame basis? I figure it's 
somewhere in a traversal structure, but I'm not exactly sure where or 
how to get to it.

Can someone enlighten me?



-- Randall Hand
www.yeraze.com


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


Re: [osg-users] Retrieving Z-Near Far per-frame

2013-03-29 Thread Randall Hand
I'm currently using the 
viewer.getCamera()-setUpdateCallback() to assigna custom callback 
that does stuff on a per-frame basis. Is it safe to retrieve the 
camera-getRenderer()-getSceneView(0)-getCullVisitor()-getCalculatedNear/FarPlane()
 ? are those values valid and available at that point?




   	   
   	Robert Osfield  
  March 29, 2013 
9:35 AM
  Hi Randall,The 
CullVisitor computes and maintains the near/far values when these need 
computing. Have a look at osgUtil::CullVisitor.
Robert.

___osg-users 
mailing listosg-users@lists.openscenegraph.orghttp://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
   	   
   	Randall Hand  
  March 29, 2013 
9:18 AM
  

Well, I want to do it "in"
 the frame.. Basically, I'm hoping to get OSG to do the scene traversal 
for culling, etc, then read the znear/zfar values to be sent elsewhere 
while the geometry is pushed down the pipe. I don't need perfectly 
accurate znear/far, just the bounding box estimates.








  
   	   
   	Trajce Nikolov NICK  
  March 24, 2013 
4:05 PM
  Hi Randal,it
 is easy . somewhere in the loop, probably after the frame all you 
have to do is to get the projection matrix likewhile
 (!viewer.done()){viewer.frame();
viewer.getCamera()-getProjectionMatrixAsFrustum(arguments  )-- trajce nikolov nick


___osg-users 
mailing listosg-users@lists.openscenegraph.orghttp://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
   	   
   	Randall Hand  
  March 23, 2013 
10:41 PM
  Is there (I'm sure there is) a 
way to retrieve the autocalculated ZNear 
 ZFar from the scene graph on a per-frame basis? I figure it's 
somewhere in a traversal structure, but I'm not exactly sure where or 
how to get to it.

Can someone enlighten me?



-- Randall Hand
www.yeraze.com


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


Re: [osg-users] Retrieving Z-Near Far per-frame

2013-03-29 Thread Randall Hand
So... I need to attach 
instead to setCullCallback?

I'm looking in ViewerBase and I see the order is event, update,  
rendering, and Rendering calls "renderer-cull()". I need to be 
after a completed cull, but before rendering actually starts (or at 
least as early into rendering as I can get). Could/should I register 
what I want as a custom "operation"? Or is this the job of the Camera's
 PreDrawCallback?

Basic requirements:
* Run once per frame (in a system with multiple viewers  contexts 
per frame)
* After Cull (so I have a valid znear/zfar estimate for the frame), but
 before/during the Render
* I will not be modifying the scenegraph, only reading data  
shipping it elsewhere





   	   
   	Robert Osfield  
  March 29, 2013 
10:09 AM
  Hi Randall,These 
will be valid for the previous frame as the cull traversal happens after
 the update traversal.
Robert.

___osg-users 
mailing listosg-users@lists.openscenegraph.orghttp://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
   	   
   	Randall Hand  
  March 29, 2013 
9:55 AM
  

I'm currently using the 
viewer.getCamera()-setUpdateCallback() to assigna custom callback 
that does stuff on a per-frame basis. Is it safe to retrieve the 
camera-getRenderer()-getSceneView(0)-getCullVisitor()-getCalculatedNear/FarPlane()

 ? are those values valid and available at that point?






  
   	   
   	Robert Osfield  
  March 29, 2013 
9:35 AM
  Hi Randall,The 
CullVisitor computes and maintains the near/far values when these need 
computing. Have a look at osgUtil::CullVisitor.
Robert.

___osg-users 
mailing listosg-users@lists.openscenegraph.orghttp://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
   	   
   	Randall Hand  
  March 29, 2013 
9:18 AM
  

Well, I want to do it "in"
 the frame.. Basically, I'm hoping to get OSG to do the scene traversal 
for culling, etc, then read the znear/zfar values to be sent elsewhere 
while the geometry is pushed down the pipe. I don't need perfectly 
accurate znear/far, just the bounding box estimates.








  
   	   
   	Trajce Nikolov NICK  
  March 24, 2013 
4:05 PM
  Hi Randal,it
 is easy . somewhere in the loop, probably after the frame all you 
have to do is to get the projection matrix likewhile
 (!viewer.done()){viewer.frame();
viewer.getCamera()-getProjectionMatrixAsFrustum(arguments  )-- trajce nikolov nick


___osg-users 
mailing listosg-users@lists.openscenegraph.orghttp://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


-- Randall Hand
www.yeraze.com


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


[osg-users] Retrieving Z-Near Far per-frame

2013-03-23 Thread Randall Hand
Is there (I'm sure there is) a way to retrieve the autocalculated ZNear 
 ZFar from the scene graph on a per-frame basis? I figure it's 
somewhere in a traversal structure, but I'm not exactly sure where or 
how to get to it.


Can someone enlighten me?
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


[osg-users] Using OpenSceneGraph with 3rd party window libraries

2013-03-07 Thread Randall Hand
I'm using OpenSceneGraph with another library that also offers some
rudimentary windowing code (on Windows right now).  OpenSceneGraph works
fine to create viewers and render, but as soon as I use the other
library to create a window (which has really nothing to do with the
OpenSceneGraph stuff, no GL contexts or anything just a few buttons for
Run, Stop, quit, etc), the application crashes with an Access
Violation inside OSG's GraphicsWindowWin32.cpp's handleNativeWindowingEvent.

I presume it's intercepting window messages for this other window that
it doesn't control.  Is there any way to prevent this behavior?
-- 
Randall Hand
GPG Key: 4096R/F8CEF2FC
http://pgp.mit.edu:11371/pks/lookup?op=getsearch=0xBD73D58EF8CEF2FC 
http://www.yeraze.com

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


Re: [osg-users] Using OpenSceneGraph with 3rd party window libraries

2013-03-07 Thread Randall Hand
Tried that, no change.


   	   
   	Sergey Kurdakov  
  March 7, 2013 
11:00 AM
  Hi Randall,but as 
soon as I use the other 
library to create a window ... the application crashesmaybe 
others will give you better response, but I would suggest to set osg 
into single threaded modeRegardsSergey

___osg-users 
mailing listosg-users@lists.openscenegraph.orghttp://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
   	   
   	Randall Hand  
  March 7, 2013 
9:03 AM
  

I'm using OpenSceneGraph with another library that also offers some 
rudimentary windowing code (on Windows right now). OpenSceneGraph works
 fine to create viewers and render, but as soon as I use the other 
library to create a window (which has really nothing to do with the 
OpenSceneGraph stuff, no GL contexts or anything just a few buttons for 
"Run", "Stop", "quit", etc), the application crashes with an Access 
Violation inside OSG's GraphicsWindowWin32.cpp's 
handleNativeWindowingEvent.
  
I presume it's intercepting window messages for this other window that 
it doesn't control. Is there any way to prevent this behavior?
  
  


-- Randall Hand

GPG Key: 4096R/F8CEF2FC
 



http://www.yeraze.com








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


[osg-users] Alembic Plugin

2013-02-28 Thread Randall Hand
Has anyone worked on getting an Alembic plugin for OpenSceneGraph?  I
hear from multiple sources that Alembic is replacing FBX as a common
interchange format, and it's all based on HDF5.

-- 
Randall Hand
GPG Key: 4096R/F8CEF2FC
http://pgp.mit.edu:11371/pks/lookup?op=getsearch=0xBD73D58EF8CEF2FC 
http://www.yeraze.com

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


Re: [osg-users] Non-typical Stereo Usage

2012-11-28 Thread Randall Hand
What I mean is that my 
Left  Right eyes are not a trivial camera offset. I'm rendering 
different textures and geometry into the 2 eyes. I did some research 
and _think_ I can do this using masks for CullLeft and CullRight.

Is it possible to have both stereo  non-stereo viewers? (eg, I'll 
have a primary non-stereo viewer, then secondary slave-cameras connected
 to stereo-viewers).


   	   
   	Mathias Buhr  
  November 28, 2012
 4:20 AM
  Hi Randall,the OSG
 already supports a couple of stereo modes. Maybe they can be ofany 
use? See osg::DisplaySettings::StereoModeWhat do you mean by 
"completely unrelated"? If it means completelyunrelated then you can
 just create as many viewers/scenegraphs as youlike. But I'm 
guessing all your views are supposed to render differentviews of the
 same content.If thats the case and your viewers are separate 
processes (or even onseparate machines) you might want to take a 
look at the "osgcluster"example. This example runs separate viewers 
synchronized through a network.In case you are running linux and 
want to pipe one view to the specialhardware you can set up a 
separate X screen and configure one of yourviewers to utilise this 
screen. See osg::GraphicsContext for details.Maybe you can give a
 bit more details on what you are trying to do.Best regardsMathias___osg-users
 mailing listosg-users@lists.openscenegraph.orghttp://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
   	   
   	Randall Hand  
  November 27, 2012
 10:43 AM
  I need to write an 
application to use Stereo support (120hz, quadbuffered 60hz) to 
render stuff out to a display, but it's not yourtypical left-right 
stereo.  In addition, I have a regular viewer showingtypical 3D 
stuff at 60hz (regular double-buffer).  In fact, the twoviews are 
completely unrelated as special hardware on the output will beprocessing
 them.  With OpenScenegraph, is there a way to construct aview where
 i can directly access the Left  Right buffers like this?


-- 
Randall Hand


http://www.yeraze.com






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


[osg-users] Non-typical Stereo Usage

2012-11-27 Thread Randall Hand
I need to write an application to use Stereo support (120hz, quad
buffered 60hz) to render stuff out to a display, but it's not your
typical left-right stereo.  In addition, I have a regular viewer showing
typical 3D stuff at 60hz (regular double-buffer).  In fact, the two
views are completely unrelated as special hardware on the output will be
processing them.  With OpenScenegraph, is there a way to construct a
view where i can directly access the Left  Right buffers like this?
-- 
Randall Hand
http://www.yeraze.com

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


Re: [osg-users] FBX 2012.1?

2012-10-15 Thread Randall Hand
Just the other day I 
hacked the URL, they keep the same naming scheme. Just find the 2013.3 
one you want and change the URL from 20133 to 20122 or 20121 .


   	   
   	Brad Colbert  
  October 15, 2012 
7:14 PM
  Hi Folks,Does 
anyone know of a source for getting the FBX 2012.1+ SDK?  Autodesk has 
released 2013 which is currently incompatible with the OSG plugin.-B---Brad
 ColbertRenaissance Sciences Corporation(480) 290-3997___osg-users
 mailing listosg-users@lists.openscenegraph.orghttp://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


-- 
Randall Hand


http://www.yeraze.com






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


[osg-users] FBX Files Textures

2012-10-12 Thread Randall Hand
Hey all.. i'm attempting to load a nice FBX model provided by an
animator, and the Geometry comes in just fine (as well as the Animation
keyframes, I think), but the textures are completely lost.

I wanted to ask here, is this a known issue when exporting from Maya? 
Before I tell him what's wrong, I wanted to know if there's something
simple I could try or ask him to do that might resolve it. (eg: check a
box in the export for Making OpenScenegraph compliant Textures :) ).
-- 
Randall Hand
http://www.yeraze.com


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


[osg-users] Multithreading Culling problems

2012-09-25 Thread Randall Hand
I've got a pretty decent little OpenSceneGraph system going, but I'm having 
problems getting it to work multithreaded.  If I set 
Code:
viewer-setThreadingModel(osgViewer::Viewer::SingleThreaded );

 then everything works fine, but if I enable any method of multithreading then 
I get strange flickering in my scene that in my best guesses seems to be 
related to Culling operations gone awry.  

I have a very simple scene (1 OBJ model loaded from disk, 3 times), but 4 
graphics contexts across 4 windows (I have 2 main windows that are rendering to 
textures, then 4 other windows all displaying the textures in screen-aligned 
quads).  The end result is 7 cameras (the 2 Slaves to do the two renders, 2 
slaves to show the Color textures, 2 slaves to do the Depth buffers, and one 
other attached to the Viewer as the Master.).




... 

Thank you!

Cheers,
Randall

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





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


[osg-users] Opinions: is OpenSceneGraph the right choice?

2012-09-17 Thread Randall Hand
Hi,

I've been programming in OpenGL for several years now, and I'm about to start a 
new project and thought OpenSG might be a good tool to use.  However, I'm 
integrating data from lots of outside sources (gyros, cameras, network, etc) so 
I can't just do a Viewer run() (looking at doing the Viewer frame() thing), 
but I'm also going to have lots of frequently changing geometry  camera 
information.  All the demos I see simply construct a Scenegraph once at program 
start, then do Viewer run().  Is it possible/advisable to have frequently 
changing scenegraphs with OpenSG (eg, new nodes, dying nodes, changing nodes, 
etc).

... 

Thank you!

Cheers,
Randall

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





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


Re: [osg-users] Binding Multiple COLOR_BUFFERn's to a FRAME_BUFFER_OBJECT ?

2012-09-14 Thread Randall Hand
Alright, I thought that might be the answer..

As for FBO vs PBuffer, I'm running right now on a LAte 2011 MAcbook Pro,
with the ATI chipset..  I thought FBO's were supported but maybe not...

Sergey Polischuk wrote:

 followup:
 just use rgba texture for your case.

 multiple render targets work only if you render stuff with shaders and
 in fragment shader output values separately for each render target
 with gl_FragData[attachment_index] = value; (instead of gl_FragColor
 or whatever). As i've said, all render targets should have same size,
 format, and channels count for this setup, or you will get fbo setup
 errors.

 Cheers.

 14.09.2012, 11:26, Sergey Polischuk pol...@yandex.ru:

 Hi Randall

 All color attachments must have same size, format, and channels count.

 Cheers.

 14.09.2012, 08:29, Randall Hand randall.h...@gmail.com:


 I'm trying to write a simple app to render a scene and drop out 3
 buffers : Depth, Color (RGB), and Alpha.  I've pasted the code below,
 and there's an important DEFINE at the top: SHOW_ALPHA.  If you set
 SHOW_ALPHA to 0, that disables the COLOR_BUFFER1 (a GL_ALPHA texture
 attachment to the main camera) and everything works perfectly.  I set
 that to 1, and then my visuals get all scrambled and I get the following
 error messages:

 RenderStage::runCameraSetUp(), FBO setup failed, FBO status= 0x8cdd
 Warning: RenderStage::runCameraSetUp(State) Pbuffer does not support
 multiple color outputs.
 Warning: RenderStage::runCameraSetUp(State) Pbuffer does not support
 multiple color outputs.
 RenderStage::runCameraSetUp(), FBO setup failed, FBO status= 0x8cdd
 Warning: RenderStage::runCameraSetUp(State) Pbuffer does not support
 multiple color outputs.
 Warning: RenderStage::runCameraSetUp(State) Pbuffer does not support
 multiple color outputs.

 Now, I think I can accomplish what I want using a single RGBA texture
 and a fragment shader to pull out the A.  Am I doing something wrong, or
 is the fragment-shader route the right way to go?

 Code below:

 #include osgViewer/Viewer

 #include osg/BlendFunc
 #include osg/Geode
 #include osg/TexGen
 #include osg/Texture2D
 #include osg/MatrixTransform
 #include osg/LightModel
 #include osg/Material
 #include osgGA/NodeTrackerManipulator
 #include osgDB/ReadFile
 #include osgViewer/Viewer

 #define SHOW_ALPHA 0
 #define SHOW_DEPTH 1
 #define HEIGHT_OFFSET 24

 int main(void) {

  int width=512, height=256;
  osg::ref_ptrosg::Geode screenQuad = new osg::Geode;

  osg::ref_ptrosg::Texture2D __depthTexture = new osg::Texture2D();
  osg::ref_ptrosg::Texture2D __maskTexture = new osg::Texture2D();
  osg::ref_ptrosg::Texture2D __colorTexture = new osg::Texture2D();
  osg::ref_ptrosg::Node model =
 osgDB::readNodeFile(/Users/rhand/Documents/MagicLeap/data/MLOS-Logo.obj);
  osgViewer::Viewer V;
  osg::ref_ptrosg::Group group = new osg::Group();

 
 //model-getOrCreateStateSet()-setMode(GL_,osg::StateAttribute::OFF);

 model-getOrCreateStateSet()-setMode(GL_BLEND,osg::StateAttribute::ON);

 model-getOrCreateStateSet()-setMode(GL_DEPTH_TEST,osg::StateAttribute::ON);

  V.getCamera()-setClearMask(GL_DEPTH_BUFFER_BIT |
 GL_COLOR_BUFFER_BIT);
  V.getCamera()-setClearDepth(1.0);
  V.getCamera()-setClearColor(osg::Vec4(0,0,0,0));
  group-addChild(model.get());
  V.setSceneData(group.get());

  // Establish the base Graphics Context
  osg::ref_ptrosg::GraphicsContext::Traits traits = new
 osg::GraphicsContext::Traits;
  traits-x = 0;
  traits-y = HEIGHT_OFFSET;
  traits-width = width;
  traits-height = height;
  traits-windowDecoration = true;
  traits-doubleBuffer = true;
  traits-sharedContext = 0; // Doesn't inherit from anything
  traits-vsync = true;   // Disable VSync (for now)
  traits-supportsResize = false;
  traits-windowName = Color;
  osg::ref_ptrosg::GraphicsContext gc =
 osg::GraphicsContext::createGraphicsContext(traits.get());

  {
  __depthTexture-setTextureSize(width,height);
  __depthTexture-setInternalFormat(GL_DEPTH_COMPONENT);

 __depthTexture-setFilter(osg::Texture2D::MIN_FILTER,osg::Texture2D::NEAREST);

 __depthTexture-setFilter(osg::Texture2D::MAG_FILTER,osg::Texture2D::NEAREST);

  __depthTexture-setDataVariance( osg::Object::DYNAMIC );
  __depthTexture-setResizeNonPowerOfTwoHint( false );

  __maskTexture-setTextureSize(width,height);
  __maskTexture-setInternalFormat(GL_ALPHA);

 __maskTexture-setFilter(osg::Texture2D::MIN_FILTER,osg::Texture2D::NEAREST);

 __maskTexture-setFilter(osg::Texture2D::MAG_FILTER,osg::Texture2D::NEAREST);

  __maskTexture-setDataVariance( osg::Object::DYNAMIC );
  __maskTexture-setResizeNonPowerOfTwoHint( false );

  __colorTexture-setTextureSize(width,height);
  __colorTexture-setInternalFormat(GL_RGB);

 __colorTexture-setFilter(osg::Texture2D::MIN_FILTER,osg::Texture2D::NEAREST

Re: [osg-users] Binding Multiple COLOR_BUFFERn's to a FRAME_BUFFER_OBJECT ?

2012-09-14 Thread Randall Hand
It's all the in the code below.. That code is a full  complete example
of my testbed program.. So the GC part looks like:

   // Establish the base Graphics Context
   osg::ref_ptrosg::GraphicsContext::Traits traits = new
osg::GraphicsContext::Traits;
   traits-x = 0;
   traits-y = HEIGHT_OFFSET;
   traits-width = width;
   traits-height = height;
   traits-windowDecoration = true;
   traits-doubleBuffer = true;
   traits-sharedContext = 0; // Doesn't inherit from anything
   traits-vsync = true;  // Disable VSync (for now)
   traits-supportsResize = false;
   traits-windowName = Color;
   osg::ref_ptrosg::GraphicsContext gc =
osg::GraphicsContext::createGraphicsContext(traits.get());

With my other 2 gc's set almost identically, but with the sharedContext
set to this one (to share the texture)

Stephan Maximilian Huber wrote:

 Hi Randall,
 Am 14.09.12 13:54, schrieb Randall Hand:

 As for FBO vs PBuffer, I'm running right now on a LAte 2011 MAcbook Pro,
 with the ATI chipset..  I thought FBO's were supported but maybe not...


 FBOs do work on MacBookPro 2011 and OS X. How is your setup of the
 graphic-context looking like?

 cheers,

 Stepham
 ___
 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] Binding Multiple COLOR_BUFFERn's to a FRAME_BUFFER_OBJECT ?

2012-09-14 Thread Randall Hand
Ok, I updated my code to 
just use 2 textures attached to the camera (COLOR_BUFFER and 
DEPTH_BUFFER), and a fragment shader to set gl_FragColor.xyz = 
texture(depth).aaa , and that seems to work when I set my implementation
 to FRAME_BUFFER_OBJECT.

However, I had to add another slave camera to the view to display the 
Color channel (same as above, but no fragment shader).  This works too, 
and is in fact what I wanted to do (later on, I'l be distorting these 
images so a simple screen-quad won't be the actual use).  However, I 
have a "random noise" window that's the default camera.  I set 
windowDecorations and such to false, but it's still there (hidden behind
 my other camera displays).  Is there any way to hide it? I tried 
setting pbuffer=true on that gc, but then the whole app dies (I get 
blank textures everywhere).


   	   
   	Randall Hand  
  September 14, 
2012 6:54 AM
  Alright, I thought that might be the
 answer.. 

As for FBO vs PBuffer, I'm running right now on a LAte 2011 MAcbook Pro,
 with the ATI chipset..  I thought FBO's were supported but maybe not...

Sergey Polischuk wrote:
  
   	   
   	Sergey Polischuk  
  September 14, 
2012 6:51 AM
  followup:just use rgba
 texture for your case.multiple render targets work only if you 
render stuff with shaders and in fragment shader output values 
separately for each render target with gl_FragData[attachment_index] = 
value; (instead of gl_FragColor or whatever). As i've said, all render 
targets should have same size, format, and channels count for this 
setup, or you will get fbo setup errors.Cheers.___osg-users
 mailing listosg-users@lists.openscenegraph.orghttp://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
   	   
   	Sergey Polischuk  
  September 14, 
2012 2:25 AM
  Hi RandallAll 
color attachments must have same size, format, and channels count.Cheers.___osg-users
 mailing listosg-users@lists.openscenegraph.orghttp://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
   	   
   	Randall Hand  
  September 13, 
2012 11:29 PM
  I'm trying to write a 
simple app to render a scene and drop out 3buffers : Depth, Color 
(RGB), and Alpha.  I've pasted the code below,and there's an 
important DEFINE at the top: SHOW_ALPHA.  If you setSHOW_ALPHA to 0,
 that disables the COLOR_BUFFER1 (a GL_ALPHA textureattachment to 
the main camera) and everything works perfectly.  I setthat to 1, 
and then my visuals get all scrambled and I get the followingerror 
messages:RenderStage::runCameraSetUp(), FBO setup failed, FBO 
status= 0x8cddWarning: RenderStage::runCameraSetUp(State) 
Pbuffer does not supportmultiple color outputs.Warning: 
RenderStage::runCameraSetUp(State) Pbuffer does not supportmultiple
 color outputs.RenderStage::runCameraSetUp(), FBO setup failed, FBO 
status= 0x8cddWarning: RenderStage::runCameraSetUp(State) 
Pbuffer does not supportmultiple color outputs.Warning: 
RenderStage::runCameraSetUp(State) Pbuffer does not supportmultiple
 color outputs.Now, I think I can accomplish what I want using a
 single RGBA textureand a fragment shader to pull out the A.  Am I 
doing something wrong, oris the fragment-shader route the "right" 
way to go?Code below:#include 
osgViewer/Viewer#include osg/BlendFunc#include
 osg/Geode#include osg/TexGen#include 
osg/Texture2D#include osg/MatrixTransform#include
 osg/LightModel#include osg/Material#include 
osgGA/NodeTrackerManipulator#include osgDB/ReadFile#include
 osgViewer/Viewer#define SHOW_ALPHA 0#define 
SHOW_DEPTH 1#define HEIGHT_OFFSET 24int main(void) {
int width=512, height=256;osg::ref_ptrosg::Geode 
screenQuad = new osg::Geode;
osg::ref_ptrosg::Texture2D __depthTexture = new 
osg::Texture2D();osg::ref_ptrosg::Texture2D 
__maskTexture = new osg::Texture2D();
osg::ref_ptrosg::Texture2D __colorTexture = new 
osg::Texture2D();osg::ref_ptrosg::Node model =osgDB::readNodeFile("/Users/rhand/Documents/MagicLeap/data/MLOS-Logo.obj");
osgViewer::Viewer V;osg::ref_ptrosg::Group group = 
new osg::Group();
//model-getOrCreateStateSet()-setMode(GL_,osg::StateAttribute::OFF);
   model-getOrCreateStateSet()-setMode(GL_BLEND,osg::StateAttribute::ON);
   model-getOrCreateStateSet()-setMode(GL_DEPTH_TEST,osg::StateAttribute::ON);
V.getCamera()-setClearMask(GL_DEPTH_BUFFER_BIT | 
GL_COLOR_BUFFER_BIT);V.getCamera()-setClearDepth(1.0);  
  V.getCamera()-setClearColor(osg::Vec4(0,0,0,0));
group-addChild(model.get());V.setSceneData(group.get());
// Establish the "base" Graphics Context
osg::ref_ptrosg::GraphicsContext::Traits traits = newosg::GraphicsContext::Traits;
traits-x = 0;traits-y = HEIGHT_OFFSET;
traits-width = width;traits-height = height;
traits-windowDecoration = true;traits-doubleBuffer = 
true;traits-sharedContext = 0; // Doesn'

[osg-users] Binding Multiple COLOR_BUFFERn's to a FRAME_BUFFER_OBJECT ?

2012-09-13 Thread Randall Hand
::Camera __camera = new osg::Camera();
__camera-setGraphicsContext(gc.get());
__camera-setViewport(new osg::Viewport(0,0, width, height));
__camera-setClearMask(GL_COLOR_BUFFER_BIT);
__camera-setClearDepth(1.0);
__camera-setClearColor(osg::Vec4(0,0,0,0));
__camera-setRenderOrder(osg::Camera::POST_RENDER);
   
__camera-setProjectionMatrix(osg::Matrix::ortho2D(0,width,0,height));
__camera-setReferenceFrame(osg::Transform::ABSOLUTE_RF);
__camera-setViewMatrix(osg::Matrix::identity());
__camera-addChild(screenQuad.get());
osg::StateSet *ss = __camera-getOrCreateStateSet();
ss-setTextureAttributeAndModes(0, __colorTexture,
osg::StateAttribute::ON);

V.addSlave(__camera.get(), osg::Matrixd(), osg::Matrixd(), false);
}


V.run();
}

-- 
Randall Hand
http://www.yeraze.com

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


Re: [osg-users] Multiple Buffers on Multiple viewers

2012-09-12 Thread Randall Hand
Just updating the status..
 I finally figured this out, about 2am after several more attempts.

Basically, I learned that OpenSceneGraph isn't "magic" and simply 
traverses the graph in order, so I had to be a bit more careful about 
the order that I did things like constructing GC's, assigning viewports,
 and attaching to the main graph.

Also, I finally learned how to use osgViewer::Viewer andm 
osgViewer::CompositeViewer effectively.. Tu rns out I didn't need a 
Composite Viewer, I could get my same functionality with multiple 
contexts/viewports in a single Viewer.. and it's simpler, faster, and 
less error-prone.

Liking OSG so far.. Bit of a learning curve from basic OpenGL, but not 
as bad as I thought once I quit expected it to do magic things for me :)


   	   
   	Randall Hand  
  September 11, 
2012 4:36 PM
  I've done this in raw 
OpenGL before, but I can't for the life of me getit working in 
OpenSceneGraph.  I need to render a scene and then displaythe result
 in 2 separate windows: One showing the Color Buffer, oneSHowing the
 Depth Buffer (and eventually a 3rd showing the STencilBuffer).  
I've tried all day and got varying results, but nothingapproaching 
success.  CAn someone tell me what I'm doing wrong?Relevant code
 below.. Don't laugh too hard, I've been googling andreading the 
examples and cut-n-pasting code snippets all day, and I'mrelatively 
sure that at least 50% of this is unnecessary..  Right nowit's in a 
state of opening my windows  showing _a_ texture, but it'sall 
black (except for the red border I allowed just to see if this codeis
 doing anything at all).  The closest I got was using about 4 cameras(a
 Main camera, a Depth FBO camera, then 2 separate cameras for the 2final
 screen-aligned quads), which would render my geometry on screenbut 
nothing into the Depth or Color buffer textures.. 
Initialization stuff up here, nothing to do with OpenSceneGraph ...there's
 a global global osgViewer::CompositeViewer "compViewer"
viewerColor = new osgViewer::View();viewerDepth = new 
osgViewer::View();{std::cout  "** 
Initializing depth  color texture "  std::endl;
// Now setup the Depth Texture__depthTexture = new 
osg::Texture2D();__depthTexture-setTextureSize(width, 
height);
__depthTexture-setInternalFormat(GL_DEPTH_COMPONENT);   __depthTexture-setFilter(osg::Texture2D::MIN_FILTER,osg::Texture2D::LINEAR);
   __depthTexture-setFilter(osg::Texture2D::MAG_FILTER,osg::Texture2D::LINEAR);
__colorTexture = new osg::Texture2D();
__colorTexture-setTextureSize(width, height);
__colorTexture-setInternalFormat(GL_RGBA);   __colorTexture-setFilter(osg::Texture2D::MIN_FILTER,osg::Texture2D::LINEAR);
   __colorTexture-setFilter(osg::Texture2D::MAG_FILTER,osg::Texture2D::LINEAR);
osg::ref_ptrosg::GraphicsContext::Traits traits = newosg::GraphicsContext::Traits;
traits-x = xPos + 0;traits-y = yPos + 0;
traits-width = width;traits-height = height;
traits-windowDecoration = true;
traits-doubleBuffer = true;traits-sharedContext = 0;
traits-vsync = false;
osg::ref_ptrosg::GraphicsContext gc =osg::GraphicsContext::createGraphicsContext(traits.get());
std::cout  "** Initializing prime camera"  
std::endl;__camera = new osg::Camera();
__camera-setGraphicsContext(gc.get());
__camera-setViewport(new osg::Viewport(0,0, traits-width,traits-height));
   __camera-setComputeNearFarMode(osg::Camera::DO_NOT_COMPUTE_NEAR_FAR);
__camera-setProjectionMatrixAsPerspective(70,1.0, 1,200);
__camera-setClearDepth(1.0);
__camera-setViewMatrixAsLookAt( osg::Vec3(0,0,0),osg::Vec3(0,100,0),
 osg::Vec3(0,0,1) );GLenum buffer = traits-doubleBuffer ?
 GL_BACK : GL_FRONT;__camera-setDrawBuffer(buffer); 
   __camera-setReadBuffer(buffer);   __camera-getOrCreateStateSet()-setRenderBinDetails(50,"RenderBin");
//__camera-setRenderOrder(osg::Camera::NESTED_RENDER);  
  __camera-setRenderOrder(osg::Camera::PRE_RENDER);   __camera-setRenderTargetImplementation(osg::Camera::FRAME_BUFFER_OBJECT);
__camera-attach(osg::Camera::DEPTH_BUFFER, __depthTexture);
__camera-attach(osg::Camera::COLOR_BUFFER, __colorTexture);
std::cout  "** Attaching cmaeras to viewer "  
std::endl;// add this slave camera to the viewer, with a 
shift left of theprojection matrixif (__Side == 
"leftview") {//viewerColor-addSlave(__depthCamera,osg::Matrixd::translate(-0.8,0,0),
 osg::Matrixd());
viewerColor-addSlave(__camera.get(),osg::Matrixd::translate(-0.8,0,0),
 osg::Matrixd());} else if (__Side == "rightview") {
//viewerColor-addSlave(__depthCamera,osg::Matrixd::translate(+0.8,0,0),
 osg::Matrixd());
vie

Re: [osg-users] OpenSceneGraph Newbie: PErformance question

2012-09-11 Thread Randall Hand
Ah, seems you're right.. I
 just tweaked it to load an oBJ I've been using for testing (company 
logo graphic) and now I'm up at 200fps in each of my 2 viewers, much 
better.

Can I get a quick run-down on what exactly kicks it off the "fast path"?
 Or is this documented on the Wiki somewhere?


   	   
   	Chris Hanson  
  September 10, 
2012 11:26 PM
   
 Yes. Virtually everything about that geometry will kick you off the 
fast path.  Unless your ultimate application 
purpose involves rendering teapots, you need to try using a better 
example model. cow.osg or cessna.osg I think are better samples.

-- Chris 'Xenon' 
Hanson, omo sanza lettere. xe...@alphapixel.com http://www.alphapixel.com/

Training • Consulting • Contracting3D
 • Scene Graphs (Open Scene Graph/OSG) • OpenGL 2 • OpenGL 3 • OpenGL 4 •
 GLSL • OpenGL ES 1 • OpenGL ES 2 • OpenCL

Digital Imaging • GIS • GPS • Telemetry • Cryptography • Digital Audio •
 LIDAR • Kinect • Embedded • Mobile • iPhone/iPad/iOS • Android

___osg-users 
mailing listosg-users@lists.openscenegraph.orghttp://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
   	   
   	Randall Hand  
  September 10, 
2012 11:04 PM
  hrm.. Well, I'm using the 
osgteapot example code ( http://www.openscenegraph.org/projects/osg/browser/OpenSceneGraph/trunk/examples/osgteapot/osgteapot.cpp
 ), that i modified to use basic front/back emissive materials instead 
of textures.
--Randall Handhttp://www.vizworld.com


  
   	   
   	Chris Hanson  
  September 10, 
2012 10:32 PM
  It's better, but still slower than I'ld expect. 
Hovers now around 100-110fps. 
 Something in the back of my mind makes me think the Teapot is using a 
really poor geometry representation that forces OSG onto old, slow 
OpenGL code paths. I didn't actually see the vertices or polygons in the
 OSG file above, so I can't say for sure.

 -- Chris
 'Xenon' Hanson, omo sanza lettere. xe...@alphapixel.com http://www.alphapixel.com/

Training • Consulting • Contracting3D • Scene Graphs (Open Scene Graph/OSG) • 
OpenGL 2 • OpenGL 3 • OpenGL 4 • GLSL • OpenGL ES 1 • OpenGL ES 2 • 
OpenCL

Digital Imaging • GIS • GPS • Telemetry •
 Cryptography • Digital Audio • LIDAR • Kinect • Embedded • Mobile • 
iPhone/iPad/iOS • Android

___osg-users 
mailing listosg-users@lists.openscenegraph.orghttp://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
   	   
   	Randall Hand  
  September 10, 
2012 10:29 PM
  It's better, but still slower 
than I'ld expect. Hovers now around 100-110fps.--Randall
 Handhttp://www.vizworld.com


  
   	   
   	Chris Hanson  
  September 10, 
2012 10:10 PM
  On 
Mon, Sep 10, 2012 at 8:35 PM, Randall Hand randall.h...@gmail.com
 wrote:
I'm experimenting with OpenScenegraph for a new project, and I've build a
 simple application that opens 2 viewer windows, and places 3 teapots in
 them (using the teapot object from the osgteapot example), translating 
them into different positions.  My resulting scene graph (saved as an 
osg) looks like this:  
Pretty basic.. However, I'm only getting about 60-70fps (in each of my 2
 viewers).  I've already set the vsync=false in my Stateset for the 
viewer (if I run with _nothing_ in my Scene Graph I get over 1000fps).  
Is this typical performance? I really expected to still be getting 
100+fps easy with such trivial geometry.
   
 I didn't really dissect your graph structure, but it would seem like it
 could perform better.

  How does it perform with only one window, especially one window 
with two teapots in it? It could be that some adverse effect of how you 
have set up your two windows is hurting your performance. 

-- Chris 'Xenon' 
Hanson, omo sanza lettere. xe...@alphapixel.com http://www.alphapixel.com/

Training • Consulting • Contracting3D
 • Scene Graphs (Open Scene Graph/OSG) • OpenGL 2 • OpenGL 3 • OpenGL 4 •
 GLSL • OpenGL ES 1 • OpenGL ES 2 • OpenCL

Digital Imaging • GIS • GPS • Telemetry • Cryptography • Digital Audio •
 LIDAR • Kinect • Embedded • Mobile • iPhone/iPad/iOS • Android

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



-- 
Randall Hand


http://www.yeraze.com






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


Re: [osg-users] OpenSceneGraph Newbie: PErformance question

2012-09-11 Thread Randall Hand
OSX


   	   
   	Tueller, Shayne R Civ USAF AFMC 519 SMXS/MXDEC 
   September 11, 
2012 11:33 AM
  Are you on Windows or 
Linux? If Windows, are you running with debug OSG libs? If so, 
release OSG libsare much faster.Just a thought...-Shayne-Original
 Message-From: osg-users-boun...@lists.openscenegraph.org[mailto:osg-users-boun...@lists.openscenegraph.org]
 On Behalf Of RandallHandSent: Monday, September 10, 2012 8:35 
PMTo: osg-users@lists.openscenegraph.orgSubject: [osg-users] 
OpenSceneGraph Newbie: PErformance questionI'm experimenting 
with OpenScenegraph for a new project, and I've builda simple 
application that opens 2 viewer windows, and places 3 teapotsin them
 (using the teapot object from the osgteapot example),translating 
them into different positions.  My resulting scene graph(saved as an
 osg) looks like this: Group {  UniqueID Group_0  
nodeMask 0x  cullingActive TRUE  num_children 3  
Group {UniqueID Group_1nodeMask 0x
cullingActive TRUEStateSet {  UniqueID StateSet_2   
   DataVariance STATIC  rendering_hint DEFAULT_BIN  
renderBinMode USE  binNumber 50  binName RenderBin  
  }num_children 1MatrixTransform {  nodeMask 
0x  cullingActive TRUE  referenceFrame RELATIVE
  Matrix {1 0 0 00 1 0 00 0 1 0
0 -50 0 1  }  num_children 1  Geode {
UniqueID Geode_3nodeMask 0x
cullingActive TRUEStateSet {  UniqueID 
StateSet_4  DataVariance STATIC  rendering_hint 
DEFAULT_BIN  renderBinMode INHERIT  Material {
ColorMode OFFambientColor 0.2 0.2 0.2 1 
   diffuseColor 0.8 0.8 0.8 1specularColor 0 0 0
 1emissionColor FRONT 0 1 0 1
emissionColor BACK  1 0 0 1shininess 0  }
  LightModel {ambientIntensity 0.2 0.2 0.2 1
colorControl SINGLE_COLORlocalViewer FALSE
twoSided TRUE  }}
num_drawables 1  }}  }  Group {UniqueID 
Group_5nodeMask 0xcullingActive TRUEUse 
StateSet_2num_children 1MatrixTransform {  
nodeMask 0x  cullingActive TRUE  referenceFrame 
RELATIVE  Matrix {1 0 0 00 1 0 0
0 0 1 0-10 -50 0 1  }  num_children 1
  Use Geode_3}  }  Group {UniqueID Group_6
nodeMask 0xcullingActive TRUEUse StateSet_2
num_children 1MatrixTransform {  nodeMask 0x
  cullingActive TRUE  referenceFrame RELATIVE  
Matrix {1 0 0 00 1 0 00 0 1 0   
 10 -50 0 1  }  num_children 1  Use Geode_3
}  }}Pretty basic.. However, I'm only getting 
about 60-70fps (in each of my 2viewers).  I've already set the 
vsync=false in my Stateset for theviewer (if I run with _nothing_ in
 my Scene Graph I get over 1000fps).Is this typical performance? I 
really expected to still be getting100+fps easy with such trivial 
geometry.
   	   
   	Randall Hand  
  September 10, 
2012 9:35 PM
  

I'm experimenting with OpenScenegraph for a new project, and I've build a
 simple application that opens 2 viewer windows, and places 3 teapots in
 them (using the teapot object from the osgteapot example), translating 
them into different positions. My resulting scene graph (saved as an 
osg) looks like this: 
  
  Group

 {
 UniqueID Group_0
 nodeMask 0x
 cullingActive TRUE
 num_children 3
 Group {
 UniqueID Group_1
 nodeMask 0x
 cullingActive TRUE
 StateSet {
 UniqueID StateSet_2
 DataVariance STATIC
 rendering_hint 
DEFAULT_BIN
 renderBinMode USE
 binNumber 50
 binName RenderBin
 }
 num_children 1
 MatrixTransform {
 nodeMask 0x
 cullingActive TRUE
 referenceFrame RELATIVE
 Matrix {
 1 0 0 0
 0 1 0 0
 0 0 1 0
 0 -50 0 1
 }
 num_children 1
 Geode {
 UniqueID Geode_3
 nodeMask 0x
 cullingActive TRUE
 StateSet {
 UniqueID StateSet_4
 DataVariance STATIC
 rendering_hint 
DEFAULT_BIN
 renderBinMode 
INHERIT
 Material {
 ColorMode OFF
 ambientColor 0.2 
0.2 0.2 1
 diffuseColor 0.8 
0.8 0.8 1
 specularColor 0 0 0
 1
 emissionColor 
FRONT 0 1 0 1
 emissionColor 
BACK 1 0 0 1
 shininess 0
 }
 LightModel {
 ambientIntensity 
0.2 0.2 0.2 1
 colorControl 
SINGLE_COLOR
 localViewer FALSE
 twoSided TRUE
 }
 }
 num_drawables 1
 }
 }
 }
 Group {
 UniqueID Group_5
 nodeMask 0x
 cullingActive TRUE
 Use StateSet_2
 num_children 1
 MatrixTransform {
 nodeMask 0x
 cullingActive TRUE
 referenceFrame RELATIVE
 Matrix {
 1 0 0 0
 0 1 0 0
 0 0 1 0
 -10 -50

[osg-users] Multiple Buffers on Multiple viewers

2012-09-11 Thread Randall Hand
-addView(viewerDepth);
viewerColor-setCameraManipulator(new osgGA::TrackballManipulator());
viewerColor-home();

std::cout  ** Initializing viewerDepth   std::endl;
viewerDepth-setCameraManipulator(new osgGA::TrackballManipulator());
viewerDepth-assignSceneDataToCameras();
viewerDepth-home();

// This is required or the viewer.frame() doesn't work for some reason
//  TODO: Write our own Null manipulator

_frameCount = 0;
return 1;
}

osg::Camera* osgRenderer::PlanarQuad( int xPos, int yPos, int width, int
height, osg::GraphicsContext *gc,
bool newGC, GLenum buffer, osg::Texture2D *tex) {
// Build a quad to simply display the Depth Buffer texture
// Construct a Geode, and assign the Quad to it
// and assign the texture
// Also set it to ignore Depth Test, since it will be background
// Debug: Leave a 10px border to see the scene behind

osg::ref_ptrosg::Drawable quad = osg::createTexturedQuadGeometry(
osg::Vec3(10,10.0,0),
osg::Vec3(width-20,0,0),osg::Vec3(0,height-20,0),
0, 1, 0, 1);
quad-getOrCreateStateSet()-setTextureAttributeAndModes(0, tex);

quad-setDataVariance( osg::Object::STATIC );
quad-setUseDisplayList( true );
   
quad-getOrCreateStateSet()-setMode(GL_DEPTH_TEST,osg::StateAttribute::OFF);


osg::ref_ptrosg::Geode geode = new osg::Geode;
geode-addDrawable( quad.get() );
geode-getOrCreateStateSet()-setTextureAttributeAndModes(0, tex,
osg::StateAttribute::ON);
geode-getOrCreateStateSet()-setTextureMode(0,
GL_TEXTURE_2D,osg::StateAttribute::ON);
   
geode-getOrCreateStateSet()-setMode(GL_DEPTH_TEST,osg::StateAttribute::OFF);


osg::ref_ptrosg::Camera depCam = new osg::Camera();
// set the projection matrix
depCam-setProjectionMatrix(osg::Matrix::ortho2D(0,width,0,height));
// set the view matrix   
depCam-setReferenceFrame(osg::Transform::ABSOLUTE_RF);
depCam-setViewMatrix(osg::Matrix::identity());
// No need to clear anything honestly
depCam-setClearMask(NULL);
//depCam-setRenderOrder(osg::Camera::POST_RENDER);
//depCam-getOrCreateStateSet()-setMode(GL_LIGHTING,
osg::StateAttribute::OFF);
depCam-addChild(geode.get());

std::cout  ** Initializing viewerDepth camera  std::endl;
osg::Camera* depCamSlave = new osg::Camera();
depCamSlave-setClearMask(GL_DEPTH_BUFFER_BIT | GL_COLOR_BUFFER_BIT);

if (newGC) {
std::cout  ** Initializing depth traits  std::endl;
osg::ref_ptrosg::GraphicsContext::Traits depTraits = new
osg::GraphicsContext::Traits;
depTraits-x = xPos + 0;
depTraits-y = yPos + height;
depTraits-width = width;
depTraits-height = height;
depTraits-windowDecoration = true;
depTraits-doubleBuffer = true;
depTraits-sharedContext = gc;
depTraits-vsync = false;
osg::ref_ptrosg::GraphicsContext dep_gc =
osg::GraphicsContext::createGraphicsContext(depTraits.get());
depCamSlave-setGraphicsContext(dep_gc.get());
depCamSlave-setDrawBuffer(buffer);
depCamSlave-setReadBuffer(buffer);
} else {
depCamSlave-setGraphicsContext(gc);
}

depCamSlave-setViewport(0,0,width,height);
depCamSlave-setAllowEventFocus(false);
depCamSlave-setRenderOrder(osg::Camera::POST_RENDER);
depCamSlave-setClearColor(osg::Vec4(1.0f,0.0f,0.0f,0.0f));
depCamSlave-setClearDepth(1.0);
   
depCamSlave-getOrCreateStateSet()-setMode(GL_LIGHTING,osg::StateAttribute::OFF);

   
depCamSlave-getOrCreateStateSet()-setMode(GL_BLEND,osg::StateAttribute::OFF);

   
depCamSlave-getOrCreateStateSet()-setMode(GL_DEPTH_TEST,osg::StateAttribute::OFF);

osg::TexEnv* pTexEnv = new osg::TexEnv();
pTexEnv-setMode(osg::TexEnv::REPLACE);
depCamSlave-getOrCreateStateSet()-setTextureAttributeAndModes(0,
pTexEnv, osg::StateAttribute::ON);
depCamSlave-addChild(depCam.get());
std::cout  returning  std::endl;
return depCamSlave;
}

and later in the code I call :
void osgRenderer::RegisterWithScene(osg::Group* _root) {
viewerColor-setSceneData(_root);
viewerColor-assignSceneDataToCameras();
}

-- 
Randall Hand
http://www.yeraze.com

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


[osg-users] OpenSceneGraph Newbie: PErformance question

2012-09-10 Thread Randall Hand
I'm experimenting with OpenScenegraph for a new project, and I've build
a simple application that opens 2 viewer windows, and places 3 teapots
in them (using the teapot object from the osgteapot example),
translating them into different positions.  My resulting scene graph
(saved as an osg) looks like this:

Group {
  UniqueID Group_0
  nodeMask 0x
  cullingActive TRUE
  num_children 3
  Group {
UniqueID Group_1
nodeMask 0x
cullingActive TRUE
StateSet {
  UniqueID StateSet_2
  DataVariance STATIC
  rendering_hint DEFAULT_BIN
  renderBinMode USE
  binNumber 50
  binName RenderBin
}
num_children 1
MatrixTransform {
  nodeMask 0x
  cullingActive TRUE
  referenceFrame RELATIVE
  Matrix {
1 0 0 0
0 1 0 0
0 0 1 0
0 -50 0 1
  }
  num_children 1
  Geode {
UniqueID Geode_3
nodeMask 0x
cullingActive TRUE
StateSet {
  UniqueID StateSet_4
  DataVariance STATIC
  rendering_hint DEFAULT_BIN
  renderBinMode INHERIT
  Material {
ColorMode OFF
ambientColor 0.2 0.2 0.2 1
diffuseColor 0.8 0.8 0.8 1
specularColor 0 0 0 1
emissionColor FRONT 0 1 0 1
emissionColor BACK  1 0 0 1
shininess 0
  }
  LightModel {
ambientIntensity 0.2 0.2 0.2 1
colorControl SINGLE_COLOR
localViewer FALSE
twoSided TRUE
  }
}
num_drawables 1
  }
}
  }
  Group {
UniqueID Group_5
nodeMask 0x
cullingActive TRUE
Use StateSet_2
num_children 1
MatrixTransform {
  nodeMask 0x
  cullingActive TRUE
  referenceFrame RELATIVE
  Matrix {
1 0 0 0
0 1 0 0
0 0 1 0
-10 -50 0 1
  }
  num_children 1
  Use Geode_3
}
  }
  Group {
UniqueID Group_6
nodeMask 0x
cullingActive TRUE
Use StateSet_2
num_children 1
MatrixTransform {
  nodeMask 0x
  cullingActive TRUE
  referenceFrame RELATIVE
  Matrix {
1 0 0 0
0 1 0 0
0 0 1 0
10 -50 0 1
  }
  num_children 1
  Use Geode_3
}
  }
}

Pretty basic.. However, I'm only getting about 60-70fps (in each of my 2
viewers).  I've already set the vsync=false in my Stateset for the
viewer (if I run with _nothing_ in my Scene Graph I get over 1000fps). 
Is this typical performance? I really expected to still be getting
100+fps easy with such trivial geometry.

-- 
Randall Hand
http://www.yeraze.com

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


Re: [osg-users] OpenSceneGraph Newbie: PErformance question

2012-09-10 Thread Randall Hand
It's better, but still slower than I'ld expect. Hovers now around
100-110fps.
--
Randall Hand
http://www.vizworld.com


On Mon, Sep 10, 2012 at 10:10 PM, Chris Hanson xe...@alphapixel.com wrote:

 On Mon, Sep 10, 2012 at 8:35 PM, Randall Hand randall.h...@gmail.comwrote:

  I'm experimenting with OpenScenegraph for a new project, and I've build
 a simple application that opens 2 viewer windows, and places 3 teapots in
 them (using the teapot object from the osgteapot example), translating them
 into different positions.  My resulting scene graph (saved as an osg) looks
 like this:



 Pretty basic.. However, I'm only getting about 60-70fps (in each of my 2
 viewers).  I've already set the vsync=false in my Stateset for the viewer
 (if I run with _nothing_ in my Scene Graph I get over 1000fps).  Is this
 typical performance? I really expected to still be getting 100+fps easy
 with such trivial geometry.


   I didn't really dissect your graph structure, but it would seem like it
 could perform better.

   How does it perform with only one window, especially one window with two
 teapots in it? It could be that some adverse effect of how you have set up
 your two windows is hurting your performance.


 --
 Chris 'Xenon' Hanson, omo sanza lettere. xe...@alphapixel.com
 http://www.alphapixel.com/
 Training • Consulting • Contracting
 3D • Scene Graphs (Open Scene Graph/OSG) • OpenGL 2 • OpenGL 3 • OpenGL 4
 • GLSL • OpenGL ES 1 • OpenGL ES 2 • OpenCL
 Digital Imaging • GIS • GPS • Telemetry • Cryptography • Digital Audio •
 LIDAR • Kinect • Embedded • Mobile • iPhone/iPad/iOS • Android


 ___
 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] OpenSceneGraph Newbie: PErformance question

2012-09-10 Thread Randall Hand
hrm.. Well, I'm using the osgteapot example code (
http://www.openscenegraph.org/projects/osg/browser/OpenSceneGraph/trunk/examples/osgteapot/osgteapot.cpp),
that i modified to use basic front/back emissive materials instead of
textures.

--
Randall Hand
http://www.vizworld.com


On Mon, Sep 10, 2012 at 10:32 PM, Chris Hanson xe...@alphapixel.com wrote:

 It's better, but still slower than I'ld expect. Hovers now around
 100-110fps.


   Something in the back of my mind makes me think the Teapot is using a
 really poor geometry representation that forces OSG onto old, slow OpenGL
 code paths. I didn't actually see the vertices or polygons in the OSG file
 above, so I can't say for sure.


 --
 Chris 'Xenon' Hanson, omo sanza lettere. xe...@alphapixel.com
 http://www.alphapixel.com/
 Training • Consulting • Contracting
 3D • Scene Graphs (Open Scene Graph/OSG) • OpenGL 2 • OpenGL 3 • OpenGL 4
 • GLSL • OpenGL ES 1 • OpenGL ES 2 • OpenCL
 Digital Imaging • GIS • GPS • Telemetry • Cryptography • Digital Audio •
 LIDAR • Kinect • Embedded • Mobile • iPhone/iPad/iOS • Android


 ___
 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