Re: [osg-users] incorrectly imported TEXTURE_DIMENSION macro in osgText_Text.frag

2019-12-18 Thread Cory Riddell

  
  
Hi Robert,

On 12/18/2019 8:30 AM, Robert Osfield wrote:

  
  

  This is exactly the fix I wrote 20 minutes ago, and now
checked in :-)
  
  
      https://github.com/openscenegraph/OpenSceneGraph/commit/1968f3d6e14fe4cdfa98df465c1f383d2bb7d8de
  
  
  This fix is checked into OSG-3.6 branch and master.
  
   

  


Thank you so much for your help with this. I'll update later today.

If I encounter other similar situations I'll submit patches. 

Thanks,
Cory



  

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


Re: [osg-users] incorrectly imported TEXTURE_DIMENSION macro in osgText_Text.frag

2019-12-18 Thread Cory Riddell

  
  
Hi Robert,

Thank you for pointing me to exactly the right spot. I made a change
at the top of that function rather than in the spot you indicated.

I set the locale immediately after the stringstream is constructed
(line 104):

    std::stringstream ss;   
    ss.imbue(std::locale::classic());
    ss<

I see that the method createStateSet() is virtual. Rather than edit
the OSG source, would you advise creating a subclass and overriding
this method?

Cory


On 12/18/2019 5:14 AM, Robert Osfield
  wrote:


  
  

  Hi Cory,
  
  
  Looking at osgText there following line (152,
OpenSceneGraph/src/osgText/Text.cpp sets up the
TEXTURE_DIMENSION:
  
  
          ss.str("");
        ss <<
float(activeFont->getTextureWidthHint());
        defineList["TEXTURE_DIMENSION"] =
osg::StateSet::DefinePair(ss.str(),
osg::StateAttribute::ON);
  



Which makes me think that the
  std::stringstream ss used is defaulting to your locale and
  then GLSL is using the standard locale.



If this is so then setting the locale
  on the stringstream would be the appropriate thing to do.



Robert.

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



  

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


[osg-users] incorrectly imported TEXTURE_DIMENSION macro in osgText_Text.frag

2019-12-17 Thread Cory Riddell
This may be related to something having to do with my locale settings,
but for some reason the fragment shader is failing to compile. This is
the error from the log:

    FRAGMENT glCompileShader "" FAILED
    FRAGMENT Shader "" infolog:
    Fragment shader failed to compile with the following errors:
    ERROR: 1:184: error(#132) Syntax error: "024.0" parse error
    ERROR: error(#273) 1 compilation errors.  No code generated

When I look for the source that is echoed to the log, the problem is the
thousands separator on line 4:

    Compiling C: FRAGMENT source:
        1: #define BACKDROP_COLOR vec4(0.300, 0.300, 0.300, 1.000)
        2: #define GLYPH_DIMENSION 240.0
        3: #define OUTLINE 0.070
        4: #define TEXTURE_DIMENSION 1,024.0

I believe the line is generated from this pragma:

    #pragma import_defines( SIGNED_DISTANCE_FIELD, TEXTURE_DIMENSION,
GLYPH_DIMENSION)

At this point I'm stuck. What controls the generation of those #define
macros? How do I tell it to use the C locale?

Thanks for any help,
Cory Riddell



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


Re: [osg-users] Problem with MFC example in 3.4.0

2015-12-22 Thread Cory Riddell
Lincoln,

Thank you so much for the pointer to the fix. It definitely helps.

Cory



On 12/21/2015 1:03 AM, Lincoln Nxumalo wrote:
> Hi,
>  There's a temporary fix that was submitted. Have a look under Submission 
> under the title "OGS 3.4.0 - The view provided by OSG is incorrectly 
> positioned within window that has been previously created in Windows outside 
> of OSG".
>
> I hope that helps for the meantime:-)
>
>
> Cheers,
> Lincoln
>
> --
> Read this topic online here:
> http://forum.openscenegraph.org/viewtopic.php?p=65917#65917
>
>
>
>
>
> ___
> 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] Problem with MFC example in 3.4.0

2015-12-11 Thread Cory Riddell
Hello again!

I'm working on an MFC application and I'm having trouble with the latest
source.

I downloaded the 3.4.0 source code and built it with VS2015. Everything
went smoothly but I've been having trouble with the MFC example (the
others that I've tried work fine). When I load the cow (for example), it
renders correctly but the drawable area is shifted up and to the right,
leaving a band along the left and bottom edges where nothing is drawn. I
wasn't able to figure out what's going on, so I downloaded a fresh copy
of the 3.2.3 source code and built that with the exact same compiler
settings and it works just fine. Thinking something in the MFC example
may have changed, I built the 3.2.3 MFC example against the 3.4.0
libraries and it still leaves the blank areas, so I believe the problem
is not with the MFC example.

I took a screenshot of the two version running and posted it here:
http://imgur.com/XgxYJvw

If I drag the cow in the 3.4.0 version, the black bands are colored blue
but the cow doesn't render in that area
http://imgur.com/qosOwrF

I also noticed that if I open the file with the application very close
to the top left of my (single) monitor, the bands are very narrow. If I
open the file with the application farther away, the bands are larger.
If I go all the way to the bottom right corner and open the file, the
entire OSG window is black and I can't see the cow.

Where should I be looking in the 3.4.0 code for problems?

Thanks!
Cory Riddell




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


[osg-users] Coursera Classes Coming Up!

2013-01-04 Thread Cory Riddell
Jeremy,

On the 2nd you mentioned some Coursera courses about to start. I looked
on the site and didn't see them. Have they already started?

Cory



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


Re: [osg-users] Coursera Classes Coming Up!

2013-01-04 Thread Cory Riddell

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


Re: [osg-users] RenderBin implementation not found

2011-09-16 Thread Cory Riddell
Hi Robert,

I got the customer to run with --SingleThreaded and the warning
disappeared. The warning seems to be somewhat sporadic.

Cory



On 9/16/2011 2:02 AM, Robert Osfield wrote:
 HI Cory,

 I haven't heard of this specific problem before so you may well be the first!

 The RenderBin is effectively the default RenderBin, it's registered
 during the static construction of the RenderBinPrototypeList, see the
 top of src/osgUtil/RenderBin.cpp.  The way it's written should ensure
 that the relevant bins are all registered before they are accessed,
 and from the error you see it look like this isn't happening.   I
 guess it's possible that multiple threads might call
 renderBinPrototypeList() static method in a parallel and have the
 static constructed in an implement way in one of the threads.

 Could you try running osgviewer single threaded to see if that makes a
 difference.

 Robert.

 On Thu, Sep 15, 2011 at 5:51 PM, Cory Riddell c...@codeware.com wrote:
 A customer is having trouble running our OSG-based application on his
 computer. I sent him osgviewer.exe and when he runs osgviewer.exe
 cow.osg it works, but this message is printed on the console:
  Warning: RenderBin RenderBin implementation not found, using default
 RenderBin as a fallback.

 It's just a warning and he does see the cow, but I'm wondering if this
 message is a symptom of some other problem? FWIW, his workstation-class
 laptop has a FirePro m8900 video card with up to date drivers.

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

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

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


[osg-users] RenderBin implementation not found

2011-09-15 Thread Cory Riddell
A customer is having trouble running our OSG-based application on his
computer. I sent him osgviewer.exe and when he runs osgviewer.exe
cow.osg it works, but this message is printed on the console:
  Warning: RenderBin RenderBin implementation not found, using default
RenderBin as a fallback.

It's just a warning and he does see the cow, but I'm wondering if this
message is a symptom of some other problem? FWIW, his workstation-class
laptop has a FirePro m8900 video card with up to date drivers.

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


Re: [osg-users] RenderBin implementation not found

2011-09-15 Thread Cory Riddell
It turns out when they disable their antivirus software (Trend Micro),
the problems go away. Very strange.

Cory

On 9/15/2011 11:51 AM, Cory Riddell wrote:
 A customer is having trouble running our OSG-based application on his
 computer. I sent him osgviewer.exe and when he runs osgviewer.exe
 cow.osg it works, but this message is printed on the console:
   Warning: RenderBin RenderBin implementation not found, using default
 RenderBin as a fallback.

 It's just a warning and he does see the cow, but I'm wondering if this
 message is a symptom of some other problem? FWIW, his workstation-class
 laptop has a FirePro m8900 video card with up to date drivers.

 Cory
 ___
 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] using ClipNode to cut a model in two, then cap the open side

2011-08-01 Thread Cory Riddell
Javier,

Thanks so much for the link. I haven't seen this thread before.

I'm looking at your code and I'm not exactly sure how the CappingEffect
node fits into the scene graph.

Say I want to cut the cow in half and cap it. I am going to need a
ClipNode / ClipPlane and the CappingEffect node, correct? Do I then have
to have a topmost group node, with CappingEffect and ClipNode children
then have the cow scene be a child to both of those nodes?

Cory



On 7/26/2011 6:44 AM, Javier Taibo wrote:
   Hi Cory,

   Sorry I came a bit late to this thread, but just in case you sill
 find it useful, I sent some code to the list about a year ago, that
 implements the stencil technique described in the red book. It is in
 this message:

 http://lists.openscenegraph.org/pipermail/osg-users-openscenegraph.org/2010-September/044664.html


   Regards,


 On Wed, Jul 20, 2011 at 5:48 PM, Cory Riddell c...@codeware.com wrote:
 I've been thinking about using a ClipNode to cut my model in two to
 expose the inside details like a cutaway drawing. Just sticking a
 ClipNode at the root of my model graph does remove half of it, but the
 model ends up looking hollow rather than solid. I want to cap the open
 side. For example, if a sphere is cut in two, I would cap the open side
 with a circle.

 A bit of searching for how to do this with OpenGL turned up this page
 (http://glbook.gamedev.net/moglgp/advclip.asp) that caps the open side
 using the stencil buffer. Does the technique outlined in the article
 look like a reasonable OSG-friendly approach? Any advice or pointers to
 other examples? Grepping the example code turns up a bunch of stencil
 code, but I'm still a little lost (OpenGL newbie).

 Thanks,
 Cory
 ___
 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] using ClipNode to cut a model in two, then cap the open side

2011-07-20 Thread Cory Riddell
I've been thinking about using a ClipNode to cut my model in two to
expose the inside details like a cutaway drawing. Just sticking a
ClipNode at the root of my model graph does remove half of it, but the
model ends up looking hollow rather than solid. I want to cap the open
side. For example, if a sphere is cut in two, I would cap the open side
with a circle.

A bit of searching for how to do this with OpenGL turned up this page
(http://glbook.gamedev.net/moglgp/advclip.asp) that caps the open side
using the stencil buffer. Does the technique outlined in the article
look like a reasonable OSG-friendly approach? Any advice or pointers to
other examples? Grepping the example code turns up a bunch of stencil
code, but I'm still a little lost (OpenGL newbie).

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


Re: [osg-users] using ClipNode to cut a model in two, then cap the open side

2011-07-20 Thread Cory Riddell
Paul, thanks for the opinion. I think I'm getting close to the limits of
what I can do with OSG without knowing a thing about OpenGL (and I'm
pretty stoked about how much I was able to accomplish without really
knowing what I'm doing).

Time to buckle down and learn some (modern) OpenGL. I'm going to start
with Joe Groff's tutorial
(http://duriansoftware.com/joe/An-intro-to-modern-OpenGL.-Table-of-Contents.html)
and build from there.

Thanks,
Cory

On 7/20/2011 12:00 PM, Paul Martz wrote:
 Using stencil for capping is an old trick and works well. I don't know
 of any example code for it, and it's been years, more than a decade,
 since I've done it myself. Your only other option would be some type
 of CSG approach, which would be computationally expensive, especially
 if the clip plane is dynamic.
-Paul


 On 7/20/2011 9:48 AM, Cory Riddell wrote:
 I've been thinking about using a ClipNode to cut my model in two to
 expose the inside details like a cutaway drawing. Just sticking a
 ClipNode at the root of my model graph does remove half of it, but the
 model ends up looking hollow rather than solid. I want to cap the open
 side. For example, if a sphere is cut in two, I would cap the open side
 with a circle.

 A bit of searching for how to do this with OpenGL turned up this page
 (http://glbook.gamedev.net/moglgp/advclip.asp) that caps the open side
 using the stencil buffer. Does the technique outlined in the article
 look like a reasonable OSG-friendly approach? Any advice or pointers to
 other examples? Grepping the example code turns up a bunch of stencil
 code, but I'm still a little lost (OpenGL newbie).

 Thanks,
 Cory
 ___
 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] using ClipNode to cut a model in two, then cap the open side

2011-07-20 Thread Cory Riddell
Hi Robert,

The osgreflect example is the one I was using as a guide along with the 
article I linked to in my first post. I didn't get it working, but I
have an inkling of how it should work. I really need to step back though
and learn some fundamentals first.

Cory

On 7/20/2011 3:14 PM, Robert Osfield wrote:
 Hi Cory,

 Have a look at the osgreflect example to see how you can set up
 stencil buffer usage in the OSG.

 Robert.

 On Wed, Jul 20, 2011 at 7:27 PM, Cory Riddell c...@codeware.com wrote:
 Paul, thanks for the opinion. I think I'm getting close to the limits of
 what I can do with OSG without knowing a thing about OpenGL (and I'm
 pretty stoked about how much I was able to accomplish without really
 knowing what I'm doing).

 Time to buckle down and learn some (modern) OpenGL. I'm going to start
 with Joe Groff's tutorial
 (http://duriansoftware.com/joe/An-intro-to-modern-OpenGL.-Table-of-Contents.html)
 and build from there.

 Thanks,
 Cory

 On 7/20/2011 12:00 PM, Paul Martz wrote:
 Using stencil for capping is an old trick and works well. I don't know
 of any example code for it, and it's been years, more than a decade,
 since I've done it myself. Your only other option would be some type
 of CSG approach, which would be computationally expensive, especially
 if the clip plane is dynamic.
-Paul


 On 7/20/2011 9:48 AM, Cory Riddell wrote:
 I've been thinking about using a ClipNode to cut my model in two to
 expose the inside details like a cutaway drawing. Just sticking a
 ClipNode at the root of my model graph does remove half of it, but the
 model ends up looking hollow rather than solid. I want to cap the open
 side. For example, if a sphere is cut in two, I would cap the open side
 with a circle.

 A bit of searching for how to do this with OpenGL turned up this page
 (http://glbook.gamedev.net/moglgp/advclip.asp) that caps the open side
 using the stencil buffer. Does the technique outlined in the article
 look like a reasonable OSG-friendly approach? Any advice or pointers to
 other examples? Grepping the example code turns up a bunch of stencil
 code, but I'm still a little lost (OpenGL newbie).

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

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

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

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


Re: [osg-users] using ClipNode to cut a model in two, then cap the open side

2011-07-20 Thread Cory Riddell
On 7/20/2011 3:34 PM, Paul Martz wrote:
 :-) There are a lot of people that try to write OSG code without
 knowing what's going on under the hood. I strongly recommend the
 OpenGL red book:

 http://www.amazon.com/OpenGL-Programming-Guide-Official-Learning/dp/0321552628/ref=sr_1_1?s=booksie=UTF8qid=1311193922sr=1-1



I think that speaks a great deal about what the quality of the OSG
abstraction. With only the vaguest of notions of how this stuff is
working, I've been able to put together some really neat stuff.

I'm curious, why didn't you suggest your own book? Because it isn't for
version 3+? Do you recommend the red book over the superbible? One of
the superbible reviews on Amazon says that they teach their toolkit
rather than the underlying API and that worries me a bit. The red book
reviews are even worse!

Cory


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


Re: [osg-users] advice for highlighting node under mouse

2011-06-24 Thread Cory Riddell
Thank you Sergey. I knew there had to be a better way.

Cory

On 6/24/2011 7:00 AM, Sergey Polischuk wrote:
 Hi, Cory

 You can write technique for outline effect to use additional passes with 
 different settings, and add different cull masks to each pass, so you can use 
 effect node at top of your graph and apply masks on nodes to get correct 
 effect passes running on them.

 You will need to change traverse method like this:
   void traverse(osg::NodeVisitor nv, osgFX::Effect* fx)
   {
   if (!getNumPasses())
   {
   define_passes();
   }

   osgUtil::CullVisitor *cv = 
 dynamic_castosgUtil::CullVisitor *(nv);
   if (!cv) return;
   unsigned int mask = cv-getTraversalMask();

   for (unsigned i=0; igetNumPasses(); ++i)
   {
   if (cv)
   {
   cv-pushStateSet(getPassStateSet(i));
   }

   if (i  masks.size())
   {
   cv-setTraversalMask(masks[i]);
   fx-inherited_traverse(nv);
   }
   else
   {
   cv-setTraversalMask(mask);
   fx-inherited_traverse(nv);
   }

   if (cv)
   {
   cv-popStateSet();
   }
   }
   cv-setTraversalMask(mask);
   }

 masks is vector with traverse masks to be used by cull visitor for each pass.

 Cheers,
 Sergey.


 23.06.2011, 23:18, Cory Riddell c...@codeware.com:
 I've been playing with the osgFX classes and I'm thinking about using
 osgFX::Outline() to highlight the node(s) under the mouse.

 First, I would need a list of highlighted nodes. Initially it would be
 empty.

 Every highlightable node would have a parent osgFX::Outline instance
 with an initial thin black outline.

 I would handle osgGA::GUIEventAdapter::MOVE events. Using the
 osgUtil::LineSegmentIntersector to find what's under the mouse pointer.
 I would compare my list of nodes under the mouse pointer with my list of
 highlighted nodes. Any nodes on the highlighted list not under the
 mouse, would be reverted to a thin black outline. Any nodes under the
 mouse would get a thicker, yellow outline. The list of highlighted nodes
 would be updated to reflect the current state.

 Is this reasonable? Is having an osgFX::Outline instance on every node a
 heavy way of accomplishing this? Is hit-testing every move event crazy?

 Alternatively, I thought about just lightening the face color of every
 node under the mouse. This wouldn't require any osgFX::Outline() nodes.

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

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


[osg-users] advice for highlighting node under mouse

2011-06-23 Thread Cory Riddell
I've been playing with the osgFX classes and I'm thinking about using
osgFX::Outline() to highlight the node(s) under the mouse.

First, I would need a list of highlighted nodes. Initially it would be
empty.

Every highlightable node would have a parent osgFX::Outline instance
with an initial thin black outline.

I would handle osgGA::GUIEventAdapter::MOVE events. Using the
osgUtil::LineSegmentIntersector to find what's under the mouse pointer.
I would compare my list of nodes under the mouse pointer with my list of
highlighted nodes. Any nodes on the highlighted list not under the
mouse, would be reverted to a thin black outline. Any nodes under the
mouse would get a thicker, yellow outline. The list of highlighted nodes
would be updated to reflect the current state.

Is this reasonable? Is having an osgFX::Outline instance on every node a
heavy way of accomplishing this? Is hit-testing every move event crazy?

Alternatively, I thought about just lightening the face color of every
node under the mouse. This wouldn't require any osgFX::Outline() nodes.

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


Re: [osg-users] changing the up direction of the SphericalManiuplator

2010-10-20 Thread Cory Riddell


  
  
Tim

Thanks for the reassurance and the explanation. My code is working
well now and I'm very happy with it. I hardly had to change
anything, so that makes me think I got it right.

I do kind of wish I could always have my orbits be around the center
of my scene rather than the center of the view. I typically only
have one blob of stuff in my entire scene and it would be nice to
make it look like my blob of stuff is being rotated rather than I'm
orbiting the camera around some arbitrary center point (which starts
at the center of my blob but can be moved by a pan).

Cory


On 10/20/2010 2:24 AM, Tim Moore wrote:
On Mon, Oct 18, 2010 at 10:23 PM, Cory Riddell c...@codeware.com
  wrote:
  

   I've been plowing
through this and I can almost get what I need, I just don't
entirely understand a couple of things.

Is it safe to think of the view matrix as the camera
position and orientation? By doing so, I think I understand
SphericalManipulator::getMatrix() method. It returns:

  

As was mentioned recently, the view matrix is actually the
  inverse of camera position and orientation in the world. You
  can also think of it as the position and orientation of the
  world in eye space. The "matrix" returned by the manipulator
  classes is the camera pose; the matrix returned by
  getInverseMatrix() is the view matrix.


return
osg::Matrixd::translate(osg::Vec3d(0.0, 0.0, m_distance))*
 osg::Matrixd::rotate(M_PI_2-m_elevation, 1.0,
0.0, 0.0)*
 osg::Matrixd::rotate(M_PI_2+m_heading, 0.0, 0.0,
1.0)*
 osg::Matrixd::translate(m_center);

This manipulator has two parameters - heading and elevation.
Heading is the angle from the x-axis in the x-y plane and
elevation is the angle from the x-y plane (pi/2 would give
you the z-axis). 

If I want the x-axis to be up rather than the z-axis, I add
an additional rotation:

 return osg::Matrixd::translate(osg::Vec3d(0.0, 0.0,
m_distance))*
 osg::Matrixd::rotate(M_PI_2-m_elevation, 1.0,
0.0, 0.0)*
 osg::Matrixd::rotate(M_PI_2+m_heading, 0.0, 0.0,
1.0)*
  osg::Matrixd::rotate(M_PI_2, 0.0, 1.0, 0.0)*
// NEW!
 osg::Matrixd::translate(m_center);

Am I tinkering with the right stuff here? (I've also made
the appropriate change to my getInverseMatrix() method.)
  

Yes, that looks fine.
Tim

   
It's feeling ok, but I do need to make more changes to the
manipulators code that handles pans.

Cory

  

On 10/15/2010 5:03 PM, Cory Riddell wrote: 


  
 I have been using the
  SphericalManipulator and it works really well for my
  application.
  
  One thing I would like to do is change which direction
  is up. The default is Z == up. Sometimes I want X to
  be up. If I understand the code, I need to make fairly
  extensive modifications to the existing manipulator.
  Before I start down that road, I just wanted to ask if
  that sounds right. I'm hoping I'm not missing some
  place where I obviously just need to apply some
  transformation matrix.
  
  I actually want my entire scene to go sideways, not
  just orbit up and down on my screen rather than right
  and left. For example, if I were modeling a pencil
  (coaxial the z axis), I sometimes want it standing on
  end, and sometimes lying on its side on my screen.
  
  I think I'm asking a question that has been asked
  before:
  
http://www.mail-archive.com/osg-users@lists.openscenegraph.org/msg33695.html
  
  Cory
  
  

  
  
___
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

Re: [osg-users] changing the up direction of the SphericalManiuplator

2010-10-18 Thread Cory Riddell


  
  
I've been plowing through this and I can almost get what I need, I
just don't entirely understand a couple of things.

Is it safe to think of the view matrix as the camera position and
orientation? By doing so, I think I understand
SphericalManipulator::getMatrix() method. It returns:

 return osg::Matrixd::translate(osg::Vec3d(0.0, 0.0,
m_distance))*
 osg::Matrixd::rotate(M_PI_2-m_elevation, 1.0, 0.0, 0.0)*
 osg::Matrixd::rotate(M_PI_2+m_heading, 0.0, 0.0, 1.0)*
 osg::Matrixd::translate(m_center);

This manipulator has two parameters - heading and elevation. Heading
is the angle from the x-axis in the x-y plane and elevation is the
angle from the x-y plane (pi/2 would give you the z-axis). 

If I want the x-axis to be up rather than the z-axis, I add an
additional rotation:

 return osg::Matrixd::translate(osg::Vec3d(0.0, 0.0,
m_distance))*
 osg::Matrixd::rotate(M_PI_2-m_elevation, 1.0, 0.0, 0.0)*
 osg::Matrixd::rotate(M_PI_2+m_heading, 0.0, 0.0, 1.0)*
  osg::Matrixd::rotate(M_PI_2, 0.0, 1.0, 0.0)* // NEW!
 osg::Matrixd::translate(m_center);

Am I tinkering with the right stuff here? (I've also made the
appropriate change to my getInverseMatrix() method.)

It's feeling ok, but I do need to make more changes to the
manipulators code that handles pans.

Cory

On 10/15/2010 5:03 PM, Cory Riddell wrote:

  
  I have been using the SphericalManipulator and it works really
  well for my application.
  
  One thing I would like to do is change which direction is up. The
  default is Z == up. Sometimes I want X to be up. If I understand
  the code, I need to make fairly extensive modifications to the
  existing manipulator. Before I start down that road, I just wanted
  to ask if that sounds right. I'm hoping I'm not missing some place
  where I obviously just need to apply some transformation matrix.
  
  I actually want my entire scene to go sideways, not just orbit up
  and down on my screen rather than right and left. For example, if
  I were modeling a pencil (coaxial the z axis), I sometimes want it
  standing on end, and sometimes lying on its side on my screen.
  
  I think I'm asking a question that has been asked before:
  
http://www.mail-archive.com/osg-users@lists.openscenegraph.org/msg33695.html
  
  Cory
  
  
  

___
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] changing the up direction of the SphericalManiuplator

2010-10-15 Thread Cory Riddell


  
  
I have been using the SphericalManipulator and it works really well
for my application.

One thing I would like to do is change which direction is up. The
default is Z == up. Sometimes I want X to be up. If I understand the
code, I need to make fairly extensive modifications to the existing
manipulator. Before I start down that road, I just wanted to ask if
that sounds right. I'm hoping I'm not missing some place where I
obviously just need to apply some transformation matrix.

I actually want my entire scene to go sideways, not just orbit up
and down on my screen rather than right and left. For example, if I
were modeling a pencil (coaxial the z axis), I sometimes want it
standing on end, and sometimes lying on its side on my screen.

I think I'm asking a question that has been asked before:

http://www.mail-archive.com/osg-users@lists.openscenegraph.org/msg33695.html

Cory


  

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


Re: [osg-users] conflict with non-OSG OpenGL view?

2010-08-20 Thread Cory Riddell
 Thanks Robert. That sounds right to me.

Our application is a multiple document application meaning that more
than one document can be open simultaneously. If I have two OSG views,
each running in their own threads, will I have the same problem? Do I
need a mutex so that only one frame() method is running at any given time?

Cory

On 8/20/2010 3:27 AM, Robert Osfield wrote:
 Hi Cory,

 I won't be able to directly diagnose the problem but my guess is that
 it'll be an issue with keeping the context current.  I would suggest
 letting one of the two sets of rendering tack complete control over
 the graphics context and just call the other set rendering to just do
 basic OpenGL calls.

 Robert.

 On Thu, Aug 19, 2010 at 5:50 PM, Cory Riddell c...@codeware.com wrote:
 My application has an OSG view and a second non-OSG OpenGL view.
 Occasionally, I'm getting a crash in
 GraphicsWindowWin32::swapBuffersImplementation() with what looks like a
 bad _hdc. The crash is an access violation due to an attempted write to 0.

 I think the relevant code is:

  void GraphicsWindowWin32::swapBuffersImplementation()
  {
  if (!_realized) return;
  if (!::SwapBuffers(_hdc)  ::GetLastError() != 0)
  {

 reportErrorForScreen(GraphicsWindowWin32::swapBuffersImplementation() -
 Unable to swap display buffers, _traits-screenNum, ::GetLastError());
  }
  }

 I'm not certain if this is correct because the crash is actually
 happening down in the atioglxx.dll file. Does anybody know if AMD has a
 public symbol server?

 I think it has something to do with OpenGL state between my two views
 because the crash normally happens when I'm manipulating my non-OSG view
 (and my OSG view is still drawing nonstop in its own thread). Is this a
 bad thing to do?

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

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

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


[osg-users] conflict with non-OSG OpenGL view?

2010-08-19 Thread Cory Riddell
My application has an OSG view and a second non-OSG OpenGL view.
Occasionally, I'm getting a crash in
GraphicsWindowWin32::swapBuffersImplementation() with what looks like a
bad _hdc. The crash is an access violation due to an attempted write to 0.

I think the relevant code is:

  void GraphicsWindowWin32::swapBuffersImplementation()
  {
  if (!_realized) return;
  if (!::SwapBuffers(_hdc)  ::GetLastError() != 0)
  {
 
reportErrorForScreen(GraphicsWindowWin32::swapBuffersImplementation() -
Unable to swap display buffers, _traits-screenNum, ::GetLastError());
  }
  }

I'm not certain if this is correct because the crash is actually
happening down in the atioglxx.dll file. Does anybody know if AMD has a
public symbol server?

I think it has something to do with OpenGL state between my two views
because the crash normally happens when I'm manipulating my non-OSG view
(and my OSG view is still drawing nonstop in its own thread). Is this a
bad thing to do?

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


Re: [osg-users] Optimizer is awesome!

2010-07-30 Thread Cory Riddell
On 7/30/2010 4:06 AM, Robert Osfield wrote:
 The Optimizer has a range of optimization traversals that deal with
 various problems commonly exist in databases, in an ideal scene graph
 the optimizer wouldn't do anything for you, so one should view it like
 patch for a problem.  

It is definitely a patch for a problem. We aren't loading anything from
a database. Rather we are using a commercial geometric modeling kernel
to create and tesselate fairly complex bodies. OSG's Optimizer is
cleaning up the output from the tesselation library.

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


[osg-users] Optimizer is awesome!

2010-07-29 Thread Cory Riddell
I'm getting to the point where I have to start tuning my app a bit and
so I added a call to Optimizer::optimize() today. Wow!

On a typical model, my app was able to push just under 40 fps at
1920x1200 (debug build). After running the optimizer, it's pushing
around 100 fps.

The trade off of course is that it takes 20 seconds to run through all
optimizations. That's a little long, but now I can start looking at the
individual optimizations and see what the cost and benefit of each is.

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


Re: [osg-users] Optimizer is awesome!

2010-07-29 Thread Cory Riddell




Our app is very CAD-like. The purpose of it is to create and edit
models. Reloading models is a relatively rare activity. 

Cory

On 7/29/2010 1:54 PM, Trajce (Nick) Nikolov wrote:

  you can save your model after optimization and load it
optimized  no need to wait 20 seconds then
  
-Nick
  
  
  On Thu, Jul 29, 2010 at 10:39 PM, Cory
Riddell c...@codeware.com wrote:
  I'm
getting to the point where I have to start tuning my app a bit and
so I added a call to Optimizer::optimize() today. Wow!

On a typical model, my app was able to push just under 40 fps at
1920x1200 (debug build). After running the optimizer, it's pushing
around 100 fps.

The trade off of course is that it takes 20 seconds to run through all
optimizations. That's a little long, but now I can start looking at the
individual optimizations and see what the cost and benefit of each is.

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

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



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


Re: [osg-users] Optimizer is awesome!

2010-07-29 Thread Cory Riddell




I should add that our primary save format is .sat (ACIS), not .osg.

On 7/29/2010 2:35 PM, Cory Riddell wrote:

  
Our app is very CAD-like. The purpose of it is to create and edit
models. Reloading models is a relatively rare activity. 
  
Cory
  
On 7/29/2010 1:54 PM, Trajce (Nick) Nikolov wrote:
  
you can save your model after optimization and load
it
optimized  no need to wait 20 seconds then

-Nick


On Thu, Jul 29, 2010 at 10:39 PM, Cory
Riddell c...@codeware.com wrote:
I'm
getting
to the point where I have to start tuning my app a bit and
so I added a call to Optimizer::optimize() today. Wow!
  
On a typical model, my app was able to push just under 40 fps at
1920x1200 (debug build). After running the optimizer, it's pushing
around 100 fps.
  
The trade off of course is that it takes 20 seconds to run through all
optimizations. That's a little long, but now I can start looking at the
individual optimizations and see what the cost and benefit of each is.
  
Cory
___
osg-users mailing list
  osg-users@lists.openscenegraph.org
  http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org






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

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



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


Re: [osg-users] osgViewerMFC example (linking errors)

2010-07-27 Thread Cory Riddell
On 7/26/2010 10:59 AM, Sanat Talmaki wrote:
 I have linked all libs from the osg visual studio package as well as the 3rd 
 party dependencies. 
 -Do I need to set any other libs I;m guessing the linker error is from some 
 lib I've not set.

 I've set the following settings for my project:
 Use of MFC: Use MFC in a Shared DLL
 Character Set: Not Set
 Common Language Runtime Support: Common Language Runtime Support (/clr)


 The error I'm still getting is:


 Code:
 1Linking...
 1msvcrt.lib(crtexe.obj) : error LNK2001: unresolved external symbol _main
 1C:\Projects\OSG_examples\Release\OSG_examples.exe : fatal error LNK1120: 1 
 unresolved externals
 1Build log was saved at 
 file://c:\Projects\OSG_examples\Release\BuildLog.htm
 1OSG_examples - 2 error(s), 0 warning(s)
 == Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==

   

If it is looking for a main(), then I think you might be linking for a
console application rather than a windows application. Look in your
linker settings and see what subsystem you have selected.

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


[osg-users] display lists draw callbacks

2010-07-06 Thread Cory Riddell
I have a very simple draw callback defined that uses a bool to decide if
the drawable should be drawn. The body of the callback's
drawImplementation() looks like:

  if (m_enable)
  {
drawable-drawImplementation(renderInfo);
  }

I have drawables scattered all over my scene that use the same instance
of this callback. By doing this, I'm able to toggle all of those
drawables on or off by setting a single bool.

This only seems to work though if the drawable has display lists
disabled. My code to set the callback looks like:

  drawable-setUseDisplayList(false);
  // callback is my shared callback instance
  drawable-setDrawCallback(callback);

Is this expected behaviour? If I understand this correctly, to use
display lists, I would have to tell each drawable to recompile
(dirtyDisplayList()) whenever I toggle my m_enable bool. Since the whole
point of my shared draw callback is to avoid traversing my graph, doing
so would defeat the purpose of my callback. So, do I understand this
correctly?

It looks like display lists can prevent a draw callback from being
called. Is that right?

Cory



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


Re: [osg-users] display lists draw callbacks

2010-07-06 Thread Cory Riddell
Robert,

Thanks for the quick reply.

If I understand the NodeMask and CullMask, these would cull entire
nodes, not individual osg::Drawable instances, correct?

For example, I have geode's that contain a text label as one of their
drawables. I thought about using a switch node to toggle the text on and
off, but that seemed a bit heavy compared to a callback. With my draw
callback, I can easily turn labels on or off for the entire graph. The
penalty is that those drawables cannot use display lists.

Cory

On 7/6/2010 3:16 PM, Robert Osfield wrote:
 Hi Cory,

 This is expected behaviour as the draw callback is nested within the
 code that sets up display lists, so once the display list is created
 it'll not call the callback again.  If you disable the use of display
 lists via drawable-setUseDisplayLists(false); then your callback will
 be called on every frame.

 Another approach you could take to switching on/off various subgraphs
 is to use a combination of NodeMask and CullMask.  Have a look at the
 osgstereoimage example for inspiration on this approach.

 Robert.

 On Tue, Jul 6, 2010 at 8:19 PM, Cory Riddell c...@codeware.com wrote:
   
 I have a very simple draw callback defined that uses a bool to decide if
 the drawable should be drawn. The body of the callback's
 drawImplementation() looks like:

  if (m_enable)
  {
drawable-drawImplementation(renderInfo);
  }

 I have drawables scattered all over my scene that use the same instance
 of this callback. By doing this, I'm able to toggle all of those
 drawables on or off by setting a single bool.

 This only seems to work though if the drawable has display lists
 disabled. My code to set the callback looks like:

  drawable-setUseDisplayList(false);
  // callback is my shared callback instance
  drawable-setDrawCallback(callback);

 Is this expected behaviour? If I understand this correctly, to use
 display lists, I would have to tell each drawable to recompile
 (dirtyDisplayList()) whenever I toggle my m_enable bool. Since the whole
 point of my shared draw callback is to avoid traversing my graph, doing
 so would defeat the purpose of my callback. So, do I understand this
 correctly?

 It looks like display lists can prevent a draw callback from being
 called. Is that right?

 Cory



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

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

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


Re: [osg-users] display lists draw callbacks

2010-07-06 Thread Cory Riddell




Robert  Tim, 

Thanks for the information and advice. I guess it's time to take some
measurements and see what the cost of my draw callback actually is.

Cory



On 7/6/2010 5:13 PM, Tim Moore wrote:

  
  On Tue, Jul 6, 2010 at 11:14 PM, Cory
Riddell c...@codeware.com wrote:
  Robert,

Thanks for the quick reply.

If I understand the NodeMask and CullMask, these would cull entire
nodes, not individual osg::Drawable instances, correct?
  
  Yes, but you can store one Drawable per Geode node, or perhaps
group of these Drawables that can be turned off into a single Geode.
  
For example, I have geode's that contain a text label as one of their
drawables. I thought about using a switch node to toggle the text on and
off, but that seemed a bit heavy compared to a callback. With my draw
callback, I can easily turn labels on or off for the entire graph. The
penalty is that those drawables cannot use display lists.


  That could be a stiff penalty. Using a node mask also saves OSG
work in the cull and draw phases of the rendering loop.
  
  
  Tim
  
Cory



On 7/6/2010 3:16 PM, Robert Osfield wrote:
 Hi Cory,

 This is expected behaviour as the draw callback is nested within
the
 code that sets up display lists, so once the display list is
created
 it'll not call the callback again. If you disable the use of
display
 lists via drawable-setUseDisplayLists(false); then your
callback will
 be called on every frame.

 Another approach you could take to switching on/off various
subgraphs
 is to use a combination of NodeMask and CullMask. Have a look at
the
 osgstereoimage example for inspiration on this approach.

 Robert.

 On Tue, Jul 6, 2010 at 8:19 PM, Cory Riddell c...@codeware.com
wrote:

 I have a very simple draw callback defined that uses a bool to
decide if
 the drawable should be drawn. The body of the callback's
 drawImplementation() looks like:

 if (m_enable)
 {
  drawable-drawImplementation(renderInfo);
 }

 I have drawables scattered all over my scene that use the same
instance
 of this callback. By doing this, I'm able to toggle all of
those
 drawables on or off by setting a single bool.

 This only seems to work though if the drawable has display
lists
 disabled. My code to set the callback looks like:

 drawable-setUseDisplayList(false);
 // callback is my shared callback instance
 drawable-setDrawCallback(callback);

 Is this expected behaviour? If I understand this correctly, to
use
 display lists, I would have to tell each drawable to recompile
 (dirtyDisplayList()) whenever I toggle my m_enable bool. Since
the whole
 point of my shared draw callback is to avoid traversing my
graph, doing
 so would defeat the purpose of my callback. So, do I
understand this
 correctly?

 It looks like display lists can prevent a draw callback from
being
 called. Is that right?

 Cory



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


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


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


  
  
  
  

___
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] OSG Windows Icon Handler?

2010-06-16 Thread Cory Riddell
For our app, we want our file icons to show a thumbnail image of the
contents. In Windows you accomplish this with an icon handler which is
just a shell extension handler (see
http://msdn.microsoft.com/en-us/library/bb776857(VS.85).aspx
http://msdn.microsoft.com/en-us/library/bb776857%28VS.85%29.aspx).

Has this already been written? I don't want to spend my time writing
something that already exists elsewhere and this is such a common thing
I figured somebody has probably already written an osg icon handler.

Cory

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


Re: [osg-users] Visual Studio 2010 and VPB

2010-06-16 Thread Cory Riddell




On 6/16/2010 3:10 AM, Christiansen, Brad wrote:

  
  
  

  
  Hi,
  
  I have managed to build
OSG (and 3rd party dependencies)
using Visual Studio 2010 but I have hit a snag with VPB. The error has
been
reported before by Matrin Naylor, but there didnt seem to be any
resolution. The error is:
  
  1osgDB.lib(osgDB.dll)
: error LNK2005: "public:
void __thiscall std::basic_ofstreamchar,struct
std::char_traitschar
::`vbase destructor'(void)"
(??_d?$basic_ofstr...@du?$char_traits@d...@std@@@std@@QAEXXZ) already
defined in
SpatialProperties.obj
  1 Creating
library
D:/adi_vsfz/projects/OSG/osg-trunk-2010/vpb-build/lib/Release/vpb.lib
and
object
D:/adi_vsfz/projects/OSG/osg-trunk-2010/vpb-build/lib/Release/vpb.exp
  1D:\adi_vsfz\projects\OSG\osg-trunk-2010\vpb-build\lib\Release\vpb.dll
:
fatal error LNK1169: one or more multiply defined symbols found
  


You can always tell the linker to ignore the problem with /FORCE:MULTIPLE.
I'd only do that as a last resort though because there might actually
be a problem here.

Are both projects compiled with VS2010 with the same settings? 

Cory



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


Re: [osg-users] OT: VS2010 is slow

2010-05-26 Thread Cory Riddell
I read up on that a bit. Sadly, we use things like #import, incremental
compilation, and precompiled headers. All these are incompatible with
the new multi-process build switch.

Besides, our application is actually composed of a bunch of sub-projects
and these are all compiled in parallel. If I watch my system monitor, I
have the CPU's pegged at 100% for a significant portion of the build. I
suspect the multi-process build wouldn't give much of a speed boost.

Cory

On 5/26/2010 12:32 AM, Torben Dannhauer wrote:
 Hi,

 Speed issues of VS2010 are often reporten (-google)
 You could speed up your compile process by using multiple cores for compiling.

 Read /MP documentation: http://msdn.microsoft.com/en-us/library/bb385193.aspx

 Thank you!

 Cheers,
 Torben

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





 ___
 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] OT: VS2010 is slow

2010-05-25 Thread Cory Riddell
Sorry for the off topic post, but I would like to find out what other
people who have tried Visual Studio 2010 have experienced. I'm finding
it significantly slower than VS2005 (the version I am upgrading from).

I'm running on a fairly fast quad core machine with 4 GB of RAM and a
fast SSD drive and VS2010 seems to crawl on this machine. By that, I'm
talking about compile times. They have done a good job keeping the UI
responsive, but long build times are starting to annoy me.

Does this line up with what you have found? Is there anything you did to
help the situation? Do I need more memory or CPUs?

BTW, no problems building OSG trunk or the dependencies other than long
build times.


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


Re: [osg-users] 3d site based on OSG.

2010-05-05 Thread Cory Riddell
Ran,

On 5/4/2010 2:24 AM, Ran Arbel wrote:
 In the last couple of month we been working on a a web site that broadcast 3d 
 (first phase). You are all invited to have a quick look and comment.
   

So, I took a look and couldn't figure out why it wasn't working. Then I
realized it runs only on IE and is based on an ActiveX control. I hate
to be negative, but this isn't usable by most of the browsers out there.

IE has 54% market share (according to
http://en.wikipedia.org/wiki/Usage_share_of_web_browsers) and a
substantial number of those are in corporations that lock down the
browser and prohibit ActiveX installs (often for good reason).

I'm sure you have a better idea of your target market than I do (as I
have none), so perhaps it won't be a problem. Sadly, that's as much
comment as I can make because I don't trust 3rd party ActiveX controls
and so I wasn't able to actually see very much.

Honestly, I would be looking at what could be done with HTML 5's canvas
element. IMHO, it has a much brighter future than any ActiveX technology.

Cory


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


Re: [osg-users] toggle osg::Drawable (text) visibility?

2010-05-04 Thread Cory Riddell
J-S,

On 5/4/2010 12:34 PM, Jean-Sébastien Guay wrote:
 If you want to toggle visibility of all your text elements under a
 same Geode, you can use the node mask on the Geode.
My problem is that I have mixed my text elements with other geometry
elements (the labels are part of the thing they are labelling). So that
rules out using the node mask.

 ... you could use a Drawable::DrawCallback attached to each text
 element to decide if you want to draw the text or not (call the
 drawable's drawImplementation() or not). You could also subclass
 osgText::Text and override its drawImplementation() method to simply
 exit if some boolean attribute is false (like _visible).

Subclassing osgText::Text doesn't feel quite right. I think I'm going to
go with a custom callback.

Thanks so much for your help.

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


Re: [osg-users] stereo mode for part of a scene graph?

2010-03-31 Thread Cory Riddell
Robert,

On 3/31/2010 3:34 AM, Robert Osfield wrote:
 In the case of the stats these are just drawn on the image plane,
 controlled by an override of the projection and view matrix so it is
 in effect not computed in stereo at all.   If the stats did not use
 their own osg::Camera to override the projection and view matrix then
 you'd need to carefully position the drawables in depth and
 orientation to match the position of the image plane in scene.
   

I'll take a look at this code and see if I can do something similar for
the background stuff that I draw. Thanks for the hints.

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


[osg-users] stereo mode for part of a scene graph?

2010-03-30 Thread Cory Riddell
In my scene graph, I have a static image for the background (a
white-blue gradient). When I turn on stereo mode, I get a red stripe on
the right and a blue stripe on the left side of the window. I thought I
was drawing my background the same way statistics are drawn, but
apparently I'm not (btw, stats draw just fine - no red/blue).

What controls if something is subject to stereo separation?

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


Re: [osg-users] opengl 3 course: march 30 - april 2, 2010 - los angeles

2010-03-11 Thread Cory Riddell
I was interested in the OpenGL course (still am), but there isn't
exactly a lot of info about the course available. It would be nice to
know where it is (more specific than Los Angeles), what the
pre-requisites are (software environment) and what is and isn't included
(lunch?). The daily schedule would be good to know as well to make
planning easier (especially arrival and departure).

Plus when you click on the buy link, you get a San Francisco course
added to the shopping cart. Seems a little dodgy to me.

Cory

On 3/10/2010 9:02 AM, Allen Saucier wrote:
 Hi,
 any update on osg training? 
 ... 

 Thank you!

 Cheers,
 Allen

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





 ___
 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] source for 3d glasses?

2010-03-09 Thread Cory Riddell
Just wondering if anybody had a good source for anaglyphic glasses?
There are some on eBay for about $10 per pair. Is that reasonable?

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


[osg-users] representing connected entities in a scene graph

2010-03-03 Thread Cory Riddell
How are you representing connected entities in your scene graph?

For example, say you wanted to create a model of a guitar from
headstock, fretboard, and body objects.

I've been doing this with scene graphs that look like:

Transform #1
  Headstock geode
  Transform #2
Fretboard geode
Transfrom #3
  body geode

Here I'm using indentation to specify parent-child relationships. For
example, Transform #2 has transform #1 for a parent and the fretboard
and tranform #3 nodes for children.

This seems somewhat awkward and I'm thinking that I'm not seeing
something obvious. Care to clue me in?

Cory

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


Re: [osg-users] representing connected entities in a scene graph

2010-03-03 Thread Cory Riddell
I'm thinking about this more and I think the scene graph structure is
probably solid. I'm really having problems coming up with object
representations that facilitate generating the correct transforms and I
that's not really an OSG issue and thus, is offtopic.

Sorry.




On 3/3/2010 3:57 PM, Cory Riddell wrote:
 How are you representing connected entities in your scene graph?

 For example, say you wanted to create a model of a guitar from
 headstock, fretboard, and body objects.

 I've been doing this with scene graphs that look like:

 Transform #1
   Headstock geode
   Transform #2
 Fretboard geode
 Transfrom #3
   body geode

 Here I'm using indentation to specify parent-child relationships. For
 example, Transform #2 has transform #1 for a parent and the fretboard
 and tranform #3 nodes for children.

 This seems somewhat awkward and I'm thinking that I'm not seeing
 something obvious. Care to clue me in?

 Cory

 ___
 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] monitoring OpenGL memory usage

2010-02-16 Thread Cory Riddell
I'm getting the infamous Warning: detected OpenGL error 'out of memory'
after RenderBin::draw(,) message.

Any advice on handling this? My scene isn't very big (maybe 150,000
vertices) and my machine has 3 GB of RAM. Do you monitor or profile
memory usage to dynamically tune your application's display? If I knew
when I was getting close to exhausting the OpenGL pool, I could
re-tesselate to come up with lower resolution models.

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


Re: [osg-users] backface culling question - black model?

2010-01-05 Thread Cory Riddell
Hi Paul,

Paul Martz wrote:
 Cory Riddell wrote:
 I've attached an example osg file. Load it with osgviewer and it looks
 black. Hit 'b' twice and suddenly it looks correct.

 It has something to do with the transform (to a left-handed system), but
 I haven't been able to track down the problem. Any suggestions would be
 very appreciated.

 Hi Cory -- The problem is that you're transforming with a negative Y
 scale. If I remove that, the model behaves normally.
I missed this last month.

Is there a problem having a negative y scale? I do that to get a
left-handed system. Is there a better way to accomplish this?

If it is a problem having the negative y, shouldn't toggling 'b' always
return it to the all-black rendering?

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


[osg-users] backface culling question - black model?

2009-12-07 Thread Cory Riddell
I have an osg file that is about 50 MB (not huge but not trivial). When
I load it, the model is entirely black, as if you are looking at a
silhouette of it. If I press the 'b' key nothing happens. If I press it
again, suddenly everything looks correct. If I keep hitting 'b', it
toggles between the silhouette view and the properly coloured view.

Any idea why it would be coming up initially black? Why would pressing
the 'b' key twice fix the display?

Thanks,
Cory




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


Re: [osg-users] OpenGL error 'out of memory'

2009-11-10 Thread Cory Riddell




Nope. Running an ATI FireGL V7700 card.

What are some of the legitimate reasons that OpenGL may be unable to
allocate memory? Is it likely to be video memory or some other type of
memory?

Cory

Kim Bale wrote:

  Hi Cory,

Are you using frame buffer objects and an nvidia card?

Try running the osgprerender example and see if you get the same
error. If you do it's a nvidia driver bug. I've come this a number of
times and whilst there are legitimate reasons for getting the error in
my case it's always been a driver bug.

Kim.



2009/11/10 Cory Riddell c...@codeware.com:
  
  
When I render my scene, I'm getting this in the log:



  Warning: detected OpenGL error 'out of memory' after RenderBin::draw(,)
  

This is on a Windows XP machine with 4GB of RAM. I suspect it isn't
complaining about running out of that memory though. Is it video RAM
that I have run out of?

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


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

  



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


[osg-users] OpenGL error 'out of memory'

2009-11-09 Thread Cory Riddell
When I render my scene, I'm getting this in the log:

  Warning: detected OpenGL error 'out of memory' after RenderBin::draw(,)

This is on a Windows XP machine with 4GB of RAM. I suspect it isn't
complaining about running out of that memory though. Is it video RAM
that I have run out of?

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


Re: [osg-users] multiple root graphs?

2009-10-29 Thread Cory Riddell
Paul Martz wrote:
 Cory Riddell wrote:
 I want to create a graph where some nodes have more than one parent,
 but
 every parent node doesn't necessary have a non-backtracking path
 back to
 the root node. Does this make sense? How about some bad ascii art:

 A
 |
 B  C
 | /
 D

 A has been designated as the root but there is a node C that
 isn't a
 child of that root. Is this possible?

 Unless you've hidden some deeper question within your question, the
 answer is to simply do this:
   A-addChild( B );
   B-addChild( D );
   C-addChild( D );

Well, I haven't actually tried it yet, but Gordon says none of the
traversal routines will ever see C. This makes sense to me. Is it wrong?

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


[osg-users] multiple root graphs?

2009-10-28 Thread Cory Riddell
I want to create a graph where some nodes have more than one parent, but
every parent node doesn't necessary have a non-backtracking path back to
the root node. Does this make sense? How about some bad ascii art:

A
|
B  C
| /
D

A has been designated as the root but there is a node C that isn't a
child of that root. Is this possible?

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


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

2009-10-19 Thread Cory Riddell
Hi Ulrich,

Ulrich Hertlein wrote:
 On 16/10/09 6:37 PM, Cory Riddell wrote:
 Ulrich Hertlein wrote:
 ...

 Yes, CPUs usually have their own caches and data can be different in
 the different caches.  However, this isn't what synchronization is
 solving.  This problem (cache coherency) is handled by the hardware.

 The reason you need to do locking is because two threads (which may or
 may not run on separate cores) might alter the same data in ways so
 that the result is no longer sane.

 ...
 I thought cache coherency depended on cues from the software. For
 example, acquiring or releasing a mutex forces any pending writes to
 complete then flushed the caches, marking a value as volatile prevented
 any caching, etc... Is this wrong?

 No, a mutex doesn't affect the cache (other than side effects) - the
 mutex doesn't know what area of memory (variables) it is locking. 
 It's only there to assure that nooneelse enters the critical section
 at the same time.


You're right, of course. I was confusing cache flushing with simple
memory barriers (which, I believe, is what a mutex provides).

 Marking a variable as 'volatile' means that it's read from memory
 every time it is accessed (the compiler won't attempt to read it into
 a register).  The idea is that someone else (another thread or
 hardware) might modify the value.

 'volatile' an be used in some cases instead of a lock, for example if
 one thread writes a bool (to indicate some event) and another thread
 only reads that value.

Yep. It turns out that whenever I write some code using a volatile to
avoid synchronizing, I invariably end up replacing it with a mutex
protected block because a volatile write is not a memory barrier.
Usually, it's some variation of this pseudo code:

volatile bool isValid = 0
int i = 0

// in thread 1
acquire mutex
  i = 42
  isValid = true
release mutex

// in thread 2
if (isValid)
  use i

This doesn't work because setting i and isValid inside the critical
section may be reordered.

Do I have this right?

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


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

2009-10-16 Thread Cory Riddell
Ulrich,

Ulrich Hertlein wrote:
 Hi Cory,

 On 13/10/09 3:47 PM, Cory Riddell wrote:
 As I understand it, basically every core has it's own cache. So, if some
 data is shared between multiple threads, it may be loaded into multiple
 caches all at once. If one thread makes a change, the value cached by
 the other core/thread is now stale. Synchronizing flushes the caches, so
 any pending writes are made to the main store. The next time anybody
 tries to read that value, it won't be in their cache and the data will
 be read from the main store.

 Just to clarify:

 Yes, CPUs usually have their own caches and data can be different in
 the different caches.  However, this isn't what synchronization is
 solving.  This problem (cache coherency) is handled by the hardware.

 The reason you need to do locking is because two threads (which may or
 may not run on separate cores) might alter the same data in ways so
 that the result is no longer sane.

You might be right. If you want to rely on that, then you really need to
know what hardware you are running on and what the memory model is. I
don't believe C++ has a standard memory model.

The last time I really dug into this was a couple of years ago. If I
remember correctly, the Intel chips of that era promised only a very
weak memory model. In practice, they had a much stronger memory model.
In fact, the only cpu that I know had a very weak memory model was the
Alpha and those haven't been around for a while now.

I thought cache coherency depended on cues from the software. For
example, acquiring or releasing a mutex forces any pending writes to
complete then flushed the caches, marking a value as volatile prevented
any caching, etc... Is this wrong?

Cory

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


[osg-users] text height question

2009-10-14 Thread Cory Riddell
If I create some text using SCREEN_COORDS and a character size of 20,
should I expect text 20 pixels high? Say I have three lines total (two
\n characters in my text string), should it take up 60 pixels of
vertical screen space?

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


[osg-users] MatrixTransform and DYNAMIC

2009-10-13 Thread Cory Riddell
Ok, stupid question.

Does a MatrixTransform that will be modified in an update callback need
to be declared DYNAMIC?

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


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

2009-10-13 Thread Cory Riddell
J-S' advice is right on.

You also need to be careful about sharing data between threads.
Multithreaded programming is a minefield of difficult to diagnose
problems, most caused by locking order problems or data races. I'm still
learning about this stuff too and am starting to get some really good
results. My biggest problem is making sure I'm always properly
synchronizing access to shared data. On modern multi-core machines, it's
especially important to get this right.

As I understand it, basically every core has it's own cache. So, if some
data is shared between multiple threads, it may be loaded into multiple
caches all at once. If one thread makes a change, the value cached by
the other core/thread is now stale. Synchronizing flushes the caches, so
any pending writes are made to the main store. The next time anybody
tries to read that value, it won't be in their cache and the data will
be read from the main store.

I chose to use the boost threads library (I believe this is going to
become part of a future C++ standard library) and use boost::mutex for
synchronizing access to data.

Cory


Shiina Ringo wrote:
 Hi, J-S

 Thank you for your fantastic advice!

 Cheers,
 Shiina

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





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

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


[osg-users] Text::setFont() installs the Font's StateSet?

2009-10-08 Thread Cory Riddell




My app uses the same font everywhere. So, I have a global method to
return a reference to a single Font instance:
osg::ref_ptrosgText::Font getArialFont() {
 static osg::ref_ptrosgText::Font s_font =
osgText::readFontFile("fonts/arial.ttf");
 return s_font;
}

When I pass it to Text::setFont(), the Text instance's StateSet gets
set to the Font's StateSet. Every Text instance ends up sharing the
same StateSet and changes to it end up acting globally. Here's the code
from osgText::Text:

void Text::setFont(osg::ref_ptrFont font)
{
 if (_font==font) return;
 
 osg::StateSet* previousFontStateSet = _font.valid() ?
_font-getStateSet() : DefaultFont::instance()-getStateSet();
 osg::StateSet* newFontStateSet = font.valid() ?
font-getStateSet() : DefaultFont::instance()-getStateSet();
 
 if (getStateSet() == previousFontStateSet)
 {
 setStateSet( newFontStateSet );
 }
 
 _font = font;
 
 computeGlyphRepresentation();
}

If I later set some text to be depth sorted and other text to not be
depth sorted, then whomever makes the setting last, wins.

I have two questions.
1) Why would you want the Font's StateSet to become the Text's
StateSet? Text and Font are very different concepts.
2) Ideally, StateSet would have COW semantics, but it doesn't and it
wouldn't be trivial to add. Would it be reasonable to pass a copy of
newFontStateSet to Text::setStateSet()?

Cory





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


Re: [osg-users] Text color not what I'm expecting

2009-10-07 Thread Cory Riddell




1. Fixed the typo in the subject. (now - not)
2. I discovered that if I remove the material setting at the geode
level, the material set in my osgText::Text instance takes effect. 

I'm still confused.

Cory

Cory Riddell wrote:

  Can somebody please take a look at the attached osg file. If you open it
with osgviewer, you will see the alphabet rendered at the bottom of the
screen (might be small) in white. I'm trying to figure out why the text
isn't black. I've set a material on my osgText::Text instance but it
seems to be ignored.

To find the text drawable, search for "ABCDEF". The material looks like:
  Material {
UniqueID Material_106
ColorMode AMBIENT
ambientColor 0.2 0.2 0.2 1
diffuseColor FRONT 0 0 0 1
diffuseColor BACK  0.8 0.8 0.8 1
specularColor FRONT 1 1 1 1
specularColor BACK  0 0 0 1
emissionColor 0 0 0 1
shininess FRONT 120
shininess BACK  0
  }

Thanks.
Cory


  
  

___
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] Resolved! Re: Text color not what I'm expecting

2009-10-07 Thread Cory Riddell




I'm not sure if this is correct, but it seems that my text was picking
up a material setting from some parent node. It was rendering the text
with the diffuse color from the material.

I ended up turning GL_LIGHTING off for my osgText::Text node and now
the text is being rendered with the color I was expecting.

One question, is the GL_LIGHTING bit the correct setting to turn off,
or is there a more correct way to turn of material usage for a drawable?

Thanks,
cory

Cory Riddell wrote:

  
1. Fixed the typo in the subject. (now - not)
2. I discovered that if I remove the material setting at the geode
level, the material set in my osgText::Text instance takes effect. 
  
I'm still confused.
  
Cory
  
Cory Riddell wrote:
  
Can somebody please take a look at the attached osg file. If you open it
with osgviewer, you will see the alphabet rendered at the bottom of the
screen (might be small) in white. I'm trying to figure out why the text
isn't black. I've set a material on my osgText::Text instance but it
seems to be ignored.

To find the text drawable, search for "ABCDEF". The material looks like:
  Material {
UniqueID Material_106
ColorMode AMBIENT
ambientColor 0.2 0.2 0.2 1
diffuseColor FRONT 0 0 0 1
diffuseColor BACK  0.8 0.8 0.8 1
specularColor FRONT 1 1 1 1
specularColor BACK  0 0 0 1
emissionColor 0 0 0 1
shininess FRONT 120
shininess BACK  0
  }

Thanks.
Cory


  

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

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



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


Re: [osg-users] [build] How to open OSG in a CView MFC ?

2009-10-05 Thread Cory Riddell
Hi Nemo,

Nemo Ulysse wrote:
 I already work on this example but the 3d model is open in full screen and I 
 don’t manage to change that.
   

Are you saying the example program is doing what you want, except you
don't want the view to be maximized? If you click on the restore button,
do you get the window layout that you are looking for?

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


Re: [osg-users] OT: do I need to recompile OSG?

2009-09-02 Thread Cory Riddell




Hi Gordon,

Thanks for the advice. I'm going to bite the bullet and do as you
suggested. The list of dependencies aren't really all that bad.

Cory

Tomlinson, Gordon wrote:

  Hi

In there wisdom MS decided it would be a good idea to use different CRT
( for C++ in debug use different memory allocators and dealocators ,
they through a lot of debug memory padding etc. etc. etc. etc. etc.
doing a Google will bring up lots of reference material on this.
( this is typically no an issue on UNIX and Linux systems, dang I miss
IRIX .. ). If an app was purely link with C lib its not an issues


Most of the OSG 3rd party requirements are typically built with C++ so
you need to ensure they are build with the same CRT and settings. Things
like libJpeg, png, tiff, gdal, collada, xerces, proj4, libxml geos,
boost etc

While first time round it can take a little time to assemble your OSG
3rdparty sources and set them up, in the long run it is worth it ( at
least for me ), for a commercial application I need to know that all the
libraries I use meet  the standard build requirments, and the only way
to ensure that is to build them myself




Gordon
Product Manager 3d
__
Gordon Tomlinson
Email  : gtomlinson @ overwatch.textron.com
__


-Original Message-
From: osg-users-boun...@lists.openscenegraph.org
[mailto:osg-users-boun...@lists.openscenegraph.org] On Behalf Of Cory
Riddell
Sent: Tuesday, September 01, 2009 3:03 PM
To: OpenSceneGraph Users
Subject: Re: [osg-users] OT: do I need to recompile OSG?

Hi Gordon,

Tomlinson, Gordon wrote:
  
  
Generally it is recommend you build every thing with the same compiler

  
  
  
  
version ( it saves time in the long run )
  

  
  
I started out thinking this is the obvious answer, but the more I think
about it, I'm not so sure. For example, OSG uses OpenGL from operating
system libraries or libraries supplied by my video card maker. These may
not even be compiled by a Microsoft compiler and there certainly isn't
any way for me to recompile them. This makes me think that it doesn't
really matter.

I would like to understand what the problem is with mixing object files
built against different versions of library files.

Cory

___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.or
g
___
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] OT: do I need to recompile OSG?

2009-09-01 Thread Cory Riddell
Sorry for an off-topic post, but...

I recently updated my Visual Studio installation (VS2005) and found that
Microsoft had fixed some bugs in the C runtime. My CRT went from version
8.0.50727.762 to 8.0.50727.4053. Would this mean that I need to
recompile OSG? Is it safe for my app built with version .4053 to use OSG
build with version .762? Any rules of thumb for when I need to rebuild
my supporting libraries or contact vendors for updates of closed-source
libraries?

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


Re: [osg-users] OT: do I need to recompile OSG?

2009-09-01 Thread Cory Riddell
Hi Gordon,

Tomlinson, Gordon wrote:
 Generally it is recommend you build every thing with the same compiler
 version ( it saves time in the long run ) 
   

I started out thinking this is the obvious answer, but the more I think
about it, I'm not so sure. For example, OSG uses OpenGL from operating
system libraries or libraries supplied by my video card maker. These may
not even be compiled by a Microsoft compiler and there certainly isn't
any way for me to recompile them. This makes me think that it doesn't
really matter.

I would like to understand what the problem is with mixing object files
built against different versions of library files.

Cory

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


Re: [osg-users] OT: do I need to recompile OSG?

2009-09-01 Thread Cory Riddell




Chris,

Chris 'Xenon' Hanson wrote:

  Cory Riddell wrote:
  
  
I started out thinking this is the obvious answer, but the more I think
about it, I'm not so sure. For example, OSG uses OpenGL from operating
system libraries or libraries supplied by my video card maker. These may
not even be compiled by a Microsoft compiler and there certainly isn't
any way for me to recompile them. This makes me think that it doesn't
really matter.
I would like to understand what the problem is with mixing object files
built against different versions of library files.

  
  
  In this case, I believe it is acknowledged that the new patch does want stuff
recompiled. I don't know the details exactly, but it's using a different C/C++ runtime
(CRT) library which is causing havoc for developers.

  Libraries like OpenGL do not utilize the C/C++ runtime, rather they do without (things
like streams, or stdio) use the core Windows Win32 API functions. Most Windows system
libraries will be this way. Third-party libraries, especially those with poratability in
mind, avoid system-specifc APIs like Win32 wherever possible in favor of the portable
C/C++ runtime. but that means they are dependent on linking with the right version of CRT.
  


Ok, this actually makes a lot of sense to me. Now I wonder how I can
figure out if a particular library does depend on the CRT library. I've
had some luck doing:
 dumpbin /directives FOO.lib
but I'm thinking there is likely a better way.

For the OSG stuff posted on the downloads page for Microsoft systems,
versions 2.8.0, 2.81, and 2.8.2 are made for the .762 version of the
CRT and I'm guessing 2.8.3 will require .4053. You know, I'm surprised
any software ever works.

Cory


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


Re: [osg-users] OT: do I need to recompile OSG?

2009-09-01 Thread Cory Riddell




Chris 'Xenon' Hanson wrote:

  Cory Riddell wrote:
  
  
Ok, this actually makes a lot of sense to me. Now I wonder how I can
figure out if a particular library does depend on the CRT library. I've
had some luck doing:
  dumpbin /directives FOO.lib
but I'm thinking there is likely a better way.

  
  
  If it uses the CRT as a DLL, "Dependency Walker" should tell you. Google it.

And say a third party library has been compiled for the non-dll version
of the c runtime (I think this is libc or libcmt for the multi threaded
variant). If the third party library is a dll I may have problems
passing data between my app and the dll, correct? If the third party
library is a lib, then I'll just get a bunch of linker errors. Yikes!

Cory


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


Re: [osg-users] Newb looking for tutorial

2009-08-10 Thread Cory Riddell
Hi David,

Check out Paul's excellent quick start guide:
  http://www.osgbooks.com/books/osg_qs.html

There's a free downloadable version or you can buy a printed copy.

Cory



David Goering wrote:
 Hey, I have been fooling arround with OpenSceneGraph and OSGART the last few 
 weeks, and have very much benefited from your help so far, so thank you ;)
 Anyhow, I have now successfully added the tracking and video plugin from 
 OSGART and it works nicely, now I was wondering if t here are any good 
 tutorials out there concerning OSG and handling model files.
 For example simple translation, transformation, scaling etc. of loaded model 
 files or adding another model to the scene with a fixed position from another 
 model, just the basics of OSG.
 I have searched arround and found a few things, but maybe some people have 
 some nice tuts that helped them out,
 thanks again,
 David

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





 ___
 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] Visual Studio 2005

2009-08-05 Thread Cory Riddell
Hi Michael,

Have you generated the solution file with cmake yet?

Cory

Michael W. Hall wrote:
 Since I am having issues with my linux box, I am tinkering with OSG in
 Visual Studio 2005.  I am not having much luck.  I was wondering if
 anyone can point me to some good example code for VS 2005.

 I am wanting to do C++/CLR.

 Thanks for any help.

 ___
 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] race condition in GraphicsWindowWin32?

2009-06-29 Thread Cory Riddell




I was using the Windows close button in the title bar or alt-f4.

It does not happen with osgwindow because (as far as I can see), it
closes down via a different route. In that example, osgwindow gets a
WM_CLOSE message which is handled by the event handler as a
CLOSE_WINDOW message and everything seems to shut down in an orderly
manner.

For the MFC example, OSG is terminated with a WM_DESTROY message. The
WM_CLOSE message is handled by the parent frame window and OSG never
sees it.

Cory

Robert Osfield wrote:

  Hi Cory,

How did you close the application?  Pressing escape or closing it via
the window close button?

Does the problem happen with other examples, such as osgwindow?

Robert.

On Fri, Jun 26, 2009 at 9:28 PM, Cory Riddellc...@codeware.com wrote:
  
  
In another message thread I've been talking about a threading problem in
my app. I just figured out how to reproduce it with one of the samples,
so I thought I would post that here in hopes that somebody else would
have an idea on how to fix this.

I think it's a shutdown sequence race. To reproduce the problem, start
the osgviewerMFC sample app. Load the cow, turn on stats (hit 's') then
close the app. Sometimes you will get a crash. To make the crash happen
all the time, add a Sleep() call to the start of the WM_DESTROY handler
in MFC_OSG_MDIView.cpp:


  void CMFC_OSG_MDIView::OnDestroy()
{
  Sleep(1200);
  if(mOSG != 0) delete mOSG;

  WaitForSingleObject(mThreadHandle, 1000);

  CView::OnDestroy();
}
  

As far as I can see, when GraphicsWindowWin32 process the WM_DESTROY
message, it sets _valid to false for the context. This prevents
~Viewer() from closing the context. This leaves a thread running and
that generates an access violation because it tires to use elements that
have been deleted. If the Viewer destructor is processed first, then
everything is ok.

This is related to the presence of a slave camera (that's why you have
to turn the stats display on).

Any ideas?

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


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

  



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


Re: [osg-users] ViewerBase::stopThreading() and renderers

2009-06-26 Thread Cory Riddell




David,

Thanks for the information. It sounds like there might actually be a
problem here. Rather than code around it, I'm going to keep poking
around to see if I can figure out what's going on. It's nice to have a
plan B though, so thank you for the advice.

Right now it looks like the Viewer::getContexts(contexts, true) method
is being called from ViewerBase::stopThreading(). The thread that is
still running (GraphicsContext which I believe was started when I
called realize()) isn't marked as valid and thus is not reported by
getContexts(). Now I'm trying to figure out how that thread can still
be running and not be valid.

One thing that is slightly strange about my scene graph is that I have
a slave camera rendering a subgraph for the background. Did you have
more than one camera?

Cory

David Spilling wrote:
Cory,
  
FWIW, I do what you do : I have an OpenThreads::Thread class which
_has_ a viewer. The parent application starts this thread up, and lets
it get on with viewer creation, frame dispatch, viewer deletion and so
on.
  
I had very similar problems to you a while ago ( 1 year? ) when I
originally set this up.
  
...assuming that it is ok to call
viewer-setDone() from a different thread?
  
This sounds familiar. I only call viewer-setDone from within the
thread that owns it. (The thread that owns the viewer has a "Stop"
method, which calls setDone).
  
This works for me.
  
Hope that helps,
  
David
  

___
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] ViewerBase::stopThreading() and renderers

2009-06-26 Thread Cory Riddell




David  Robert,

I think I found the race that is giving me problems. 

When I close my app, sometimes GraphicsWindowWin32 gets the WM_DESTROY
message before I call viewer-setDone(). In these cases, the
GraphicsWindowWin32 gets destroyed (marked invalid), but I think the
graphics thread remains (not certain of this). So, the context doesn't
get closed by the Viewer destructor.

I think I should be able to get around the problem by either manually
closing the graphics context or by carefully orchestrating the shutdown
sequence.

Cory

Cory Riddell wrote:

  
David,
  
Thanks for the information. It sounds like there might actually be a
problem here. Rather than code around it, I'm going to keep poking
around to see if I can figure out what's going on. It's nice to have a
plan B though, so thank you for the advice.
  
Right now it looks like the Viewer::getContexts(contexts, true) method
is being called from ViewerBase::stopThreading(). The thread that is
still running (GraphicsContext which I believe was started when I
called realize()) isn't marked as valid and thus is not reported by
getContexts(). Now I'm trying to figure out how that thread can still
be running and not be valid.
  
One thing that is slightly strange about my scene graph is that I have
a slave camera rendering a subgraph for the background. Did you have
more than one camera?
  
Cory
  
David Spilling wrote:
  Cory,

FWIW, I do what you do : I have an OpenThreads::Thread class which
_has_ a viewer. The parent application starts this thread up, and lets
it get on with viewer creation, frame dispatch, viewer deletion and so
on.

I had very similar problems to you a while ago ( 1 year? ) when I
originally set this up.

...assuming that it is ok to call
viewer-setDone() from a different thread?

This sounds familiar. I only call viewer-setDone from within the
thread that owns it. (The thread that owns the viewer has a "Stop"
method, which calls setDone).

This works for me.

Hope that helps,

David

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

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



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


Re: [osg-users] ViewerBase::stopThreading() and renderers

2009-06-26 Thread Cory Riddell




I'm quite confident this is my problem. I added a handler for
WM_DESTROY that sleeps my main thread for 1000 ms. This is enough time
for the second thread to process the message, marking the
GraphicsWindowWin32 instance as invalid which prevents the viewer from
closing the context (invalid contexts are not picked up by the call to
getContexts() and thus do not have their close() method called).

With the sleep in place, I can reproduce the problem every time.

To fix the problem, I'm trapping WM_DESTROY messages and I'm halting
OSG before passing the destroy message on to my OSG view window. 

Cory

Cory Riddell wrote:

  
  
David  Robert,
  
I think I found the race that is giving me problems. 
  
When I close my app, sometimes GraphicsWindowWin32 gets the WM_DESTROY
message before I call viewer-setDone(). In these cases, the
GraphicsWindowWin32 gets destroyed (marked invalid), but I think the
graphics thread remains (not certain of this). So, the context doesn't
get closed by the Viewer destructor.
  
I think I should be able to get around the problem by either manually
closing the graphics context or by carefully orchestrating the shutdown
sequence.
  
Cory
  
Cory Riddell wrote:
  

David,

Thanks for the information. It sounds like there might actually be a
problem here. Rather than code around it, I'm going to keep poking
around to see if I can figure out what's going on. It's nice to have a
plan B though, so thank you for the advice.

Right now it looks like the Viewer::getContexts(contexts, true) method
is being called from ViewerBase::stopThreading(). The thread that is
still running (GraphicsContext which I believe was started when I
called realize()) isn't marked as valid and thus is not reported by
getContexts(). Now I'm trying to figure out how that thread can still
be running and not be valid.

One thing that is slightly strange about my scene graph is that I have
a slave camera rendering a subgraph for the background. Did you have
more than one camera?

Cory

David Spilling wrote:
Cory,
  
FWIW, I do what you do : I have an OpenThreads::Thread class which
_has_ a viewer. The parent application starts this thread up, and lets
it get on with viewer creation, frame dispatch, viewer deletion and so
on.
  
I had very similar problems to you a while ago ( 1 year? ) when I
originally set this up.
  
...assuming that it is ok to call
viewer-setDone() from a different thread?
  
This sounds familiar. I only call viewer-setDone from within the
thread that owns it. (The thread that owns the viewer has a "Stop"
method, which calls setDone).
  
This works for me.
  
Hope that helps,
  
David
  
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
  


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

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



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


[osg-users] race condition in GraphicsWindowWin32?

2009-06-26 Thread Cory Riddell
In another message thread I've been talking about a threading problem in
my app. I just figured out how to reproduce it with one of the samples,
so I thought I would post that here in hopes that somebody else would
have an idea on how to fix this.

I think it's a shutdown sequence race. To reproduce the problem, start
the osgviewerMFC sample app. Load the cow, turn on stats (hit 's') then
close the app. Sometimes you will get a crash. To make the crash happen
all the time, add a Sleep() call to the start of the WM_DESTROY handler
in MFC_OSG_MDIView.cpp:
 void CMFC_OSG_MDIView::OnDestroy()
 {
 Sleep(1200);
 if(mOSG != 0) delete mOSG;

 WaitForSingleObject(mThreadHandle, 1000);

 CView::OnDestroy();
 }

As far as I can see, when GraphicsWindowWin32 process the WM_DESTROY
message, it sets _valid to false for the context. This prevents
~Viewer() from closing the context. This leaves a thread running and
that generates an access violation because it tires to use elements that
have been deleted. If the Viewer destructor is processed first, then
everything is ok.

This is related to the presence of a slave camera (that's why you have
to turn the stats display on).

Any ideas?

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


Re: [osg-users] race condition in GraphicsWindowWin32?

2009-06-26 Thread Cory Riddell




Putting a call to setGraphicsThread(0) near the top of
GraphicsWindowWin32::destroyWindow() prevents the problem. Does this
seem like a hack, or should I submit a patch?

Is there any reason why a graphics thread should still be running after
a graphics window has been destroyed?

Cory

Cory Riddell wrote:

  In another message thread I've been talking about a threading problem in
my app. I just figured out how to reproduce it with one of the samples,
so I thought I would post that here in hopes that somebody else would
have an idea on how to fix this.

I think it's a shutdown sequence race. To reproduce the problem, start
the osgviewerMFC sample app. Load the cow, turn on stats (hit 's') then
close the app. Sometimes you will get a crash. To make the crash happen
all the time, add a Sleep() call to the start of the WM_DESTROY handler
in MFC_OSG_MDIView.cpp:
  
  
void CMFC_OSG_MDIView::OnDestroy()
{
Sleep(1200);
if(mOSG != 0) delete mOSG;

WaitForSingleObject(mThreadHandle, 1000);

CView::OnDestroy();
}

  
  
As far as I can see, when GraphicsWindowWin32 process the WM_DESTROY
message, it sets _valid to false for the context. This prevents
~Viewer() from closing the context. This leaves a thread running and
that generates an access violation because it tires to use elements that
have been deleted. If the Viewer destructor is processed first, then
everything is ok.

This is related to the presence of a slave camera (that's why you have
to turn the stats display on).

Any ideas?

Thanks,
Cory
___
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] ViewerBase::stopThreading() and renderers

2009-06-25 Thread Cory Riddell




You know, I keep coming back to the done flag. It isn't volatile and I
don't see the mechanism that keeps the value synchronized between
threads. I know there has to be something that does it, because nobody
else is seeing thread related shut down problems. 

Perhaps that's my first problem: assuming that it is ok to call
viewer-setDone() from a different thread?

Cory

Robert Osfield wrote:

  Hi Cory,

Could you modify one of the OSG examples to reproduce the problem you
are seeing so that others can have a bash at reproducing the problem
as trying to debug this type of stuff remotely is next to impossible.

Robert.

On Tue, Jun 23, 2009 at 10:45 PM, Cory Riddellc...@codeware.com wrote:
  
  
Robert et al,

So, the 2.9.5 build doesn't fix my problem.

My app has two threads. The second one is my viewer thread. To shutdown, my
main threads calls viewer-setDone(true) then waits on a shared lock. The
viewer thread stops running (I start the viewer with viewer-run()) and then
calls viewer-stopThreading() and verifies that getAllThreads(threads,true)
returns 0. It then notifies the main thread and exits.

I really don't understand why getAllThreads() would return 0 when
GraphicsContext::runOperations() still seems to be running. This is why I
was asking about the done flag being reset to true (you told me it was
reinitializing) and about the non-volatile-ness of the done flags.

I'm no multithreading guru, but this isn't my first multithreaded app
either. I'm confused.

Cory

Cory Riddell wrote:

Hi Robert,

I just saw your post about the release of 2.9.5 and it includes threading
fixes. I think I'll grab that and give it a go before I bother the list
about this any more.

Thanks,
Cory

Robert Osfield wrote:

Hi Cory,

Do you find that normal OSG apps have problems when shutting down?

Which version of the OSG are you using?

When you say delete, exactly how are you going about delete?  Could
you supply an example of the clean up code you are using, it does
sound like there is something amiss.

Robert.

On Mon, Jun 22, 2009 at 4:19 PM, Cory Riddellc...@codeware.com wrote:


Hi Robert,

The reason I started to look at this flag is because I'm getting frequent
access violations when shutting down my app.

Usually, the problem is in GraphicsContext::runOperations().

When I shut down, I call setDone(true) on my viewer instance. I also call
stopThreading() and make sure that getAllThreads(threads, true) returns 0,
then I delete everything. I thought this would be sufficient, but I'm still
getting an access violation in GraphicsContext::runOperations() when it
tries to dereference a camera pointer and the camera has been deleted. My
scene includes two cameras, the primary one and a second one to render the
background.

Is there some other indicator that OSG threads are still running that I
should be waiting on?

Cory

Robert Osfield wrote:

HI Cory,

The Done flag is a hint to say tell threads that work should stop, so
once it's stopped you want to reset things so that we you start the
threads again it doesn't think that it's done again.

Robert.

On Mon, Jun 15, 2009 at 9:37 PM, Cory Riddellc...@codeware.com wrote:


ViewerBase::stopThreading() includes this block of code:

 for(Cameras::iterator camItr = cameras.begin();
 camItr != cameras.end();
 ++camItr)
 {
 osg::Camera* camera = *camItr;
 Renderer* renderer = dynamic_castRenderer*(camera-getRenderer());
 if (renderer)
 {
 renderer-setGraphicsThreadDoesCull( true );
 renderer-setDone(false);
 }
 }

Since threading is being stopped, shouldn't the line in red be setting done
to true?

Cory

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




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



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




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




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


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



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

  



___
osg-users

Re: [osg-users] ViewerBase::stopThreading() and renderers

2009-06-22 Thread Cory Riddell




Hi Robert,

The reason I started to look at this flag is because I'm getting
frequent access violations when shutting down my app.

Usually, the problem is in GraphicsContext::runOperations(). 

When I shut down, I call setDone(true) on my viewer instance. I also
call stopThreading() and make sure that getAllThreads(threads, true)
returns 0, then I delete everything. I thought this would be
sufficient, but I'm still getting an access violation in
GraphicsContext::runOperations() when it tries to dereference a camera
pointer and the camera has been deleted. My scene includes two cameras,
the primary one and a second one to render the background.

Is there some other indicator that OSG threads are still running that I
should be waiting on?

Cory

Robert Osfield wrote:

  HI Cory,

The Done flag is a hint to say tell threads that work should stop, so
once it's stopped you want to reset things so that we you start the
threads again it doesn't think that it's done again.

Robert.

On Mon, Jun 15, 2009 at 9:37 PM, Cory Riddellc...@codeware.com wrote:
  
  
ViewerBase::stopThreading() includes this block of code:

 for(Cameras::iterator camItr = cameras.begin();
 camItr != cameras.end();
 ++camItr)
 {
 osg::Camera* camera = *camItr;
 Renderer* renderer = dynamic_castRenderer*(camera-getRenderer());
 if (renderer)
 {
 renderer-setGraphicsThreadDoesCull( true );
 renderer-setDone(false);
 }
 }

Since threading is being stopped, shouldn't the line in red be setting done
to true?

Cory

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



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

  



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


Re: [osg-users] ViewerBase::stopThreading() and renderers

2009-06-22 Thread Cory Riddell




Hi Robert,

I just saw your post about the release of 2.9.5 and it includes
threading fixes. I think I'll grab that and give it a go before I
bother the list about this any more.

Thanks,
Cory

Robert Osfield wrote:

  Hi Cory,

Do you find that normal OSG apps have problems when shutting down?

Which version of the OSG are you using?

When you say delete, exactly how are you going about delete?  Could
you supply an example of the clean up code you are using, it does
sound like there is something amiss.

Robert.

On Mon, Jun 22, 2009 at 4:19 PM, Cory Riddellc...@codeware.com wrote:
  
  
Hi Robert,

The reason I started to look at this flag is because I'm getting frequent
access violations when shutting down my app.

Usually, the problem is in GraphicsContext::runOperations().

When I shut down, I call setDone(true) on my viewer instance. I also call
stopThreading() and make sure that getAllThreads(threads, true) returns 0,
then I delete everything. I thought this would be sufficient, but I'm still
getting an access violation in GraphicsContext::runOperations() when it
tries to dereference a camera pointer and the camera has been deleted. My
scene includes two cameras, the primary one and a second one to render the
background.

Is there some other indicator that OSG threads are still running that I
should be waiting on?

Cory

Robert Osfield wrote:

HI Cory,

The Done flag is a hint to say tell threads that work should stop, so
once it's stopped you want to reset things so that we you start the
threads again it doesn't think that it's done again.

Robert.

On Mon, Jun 15, 2009 at 9:37 PM, Cory Riddellc...@codeware.com wrote:


ViewerBase::stopThreading() includes this block of code:

 for(Cameras::iterator camItr = cameras.begin();
 camItr != cameras.end();
 ++camItr)
 {
 osg::Camera* camera = *camItr;
 Renderer* renderer = dynamic_castRenderer*(camera-getRenderer());
 if (renderer)
 {
 renderer-setGraphicsThreadDoesCull( true );
 renderer-setDone(false);
 }
 }

Since threading is being stopped, shouldn't the line in red be setting done
to true?

Cory

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




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



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



  
  ___
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] setDataVariance(osg::Object::DYNAMIC);

2009-06-16 Thread Cory Riddell
Rabbi,

Rabbi Robinson wrote:
 Hi, I wonder when I should use setDataVariance(osg::Object::DYNAMIC);
   

I was wondering this as well. It's in Object, so pretty much everything
has a data variance attribute and I really don't understand what it
could possibly mean in most contexts. For example, in the context of a
Geode, I think you are just saying the drawables may change. Ok, fine.
What about in the context of a switch node or a group node? Is a dynamic
group one in which the membership is variable? How about in the context
of a callback? Or an Array? Or a Viewer? Or a RenderStage?

It seems to me that it doesn't really belong in Object and perhaps there
should be an interface that exposes get and setDataVariance() (and any
other data centric accessors). Objects for which data variance makes
sense would implement this interface.

With similar reasoning, I don't think the resizeGLObjectBuffers() and
releaseGLObjects() methods belong in Object either. There must be
performance reasons for doing so.

Cory



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


[osg-users] should ViewerBase::_done be volatile?

2009-06-15 Thread Cory Riddell
Subject says it all: shouldn't the done flag be volatile? If it isn't,
how can you be certain that the viewer thread will ever notice it has
changed from false to true?

Some context here: I call ViewerBase::run() in its own thread. To shut
it down, I call viewerBase-setDone(true) from my main thread.

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


[osg-users] ViewerBase::stopThreading() and renderers

2009-06-15 Thread Cory Riddell




ViewerBase::stopThreading() includes this block of code:

 for(Cameras::iterator camItr = cameras.begin();
 camItr != cameras.end();
 ++camItr)
 {
 osg::Camera* camera = *camItr;
 Renderer* renderer =
dynamic_castRenderer*(camera-getRenderer());
 if (renderer)
 {
 renderer-setGraphicsThreadDoesCull( true );
 renderer-setDone(false);
 }
 }

Since threading is being stopped, shouldn't the line in red be setting
done to true? 

Cory


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


Re: [osg-users] CPU usage

2009-06-08 Thread Cory Riddell




Hi Robert,


  On Fri, Jun 5, 2009 at 8:21 PM, Cory Riddellc...@codeware.com wrote:
  
  
Does anybody see less than 100% CPU utilization when running osgviewer
cow.osg on an ATI card? I had just been accepting that as normal.

  
  
100% CPU is not normal at all.
  


Yikes! I think there must be something seriously wrong with my system
then.

I updated my video drivers to the latest this morning and enabled
vsync. Enabling vsync sent my framerate from 1200 fps to 15 fps! Vsync
on or off made no difference on the cpu load- I always have 100%
utilization on one core.

I have a FireGL V7700 with 512 MB of RAM. I'm running the 8.603 drivers
on quad core XP Pro machine. My one-and-only monitor is a 24" Dell
panel at 1920x1200.

I turned vsync back off. With it on, my cow looked like it was being
rotated by a stepper motor.

If you or anybody else has troubleshooting suggestions, I would be very
happy to hear them. 

Cory


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


Re: [osg-users] CPU usage

2009-06-08 Thread Cory Riddell




I had my cpu monitor open while running osgviewer. I just noticed that
after closing the cpu monitor, my vsync'd framerate immediately jumped
to 60 (the monitor native rate).

So, it seems that Heisenberg has struck again. I can't measure the
thing with out radically changing it. Or perhaps I'm just not using the
right tools. Does anybody have any suggestions for decent Windows
performance analysis tools? I was using SysInternal's ProcessExplorer.

Cory

Cory Riddell wrote:

  
  
Hi Robert,
  
  
On Fri, Jun 5, 2009 at 8:21 PM, Cory Riddellc...@codeware.com wrote:
  

  Does anybody see less than 100% CPU utilization when running osgviewer
cow.osg on an ATI card? I had just been accepting that as normal.



100% CPU is not normal at all.
  
  
  
Yikes! I think there must be something seriously wrong with my system
then.
  
I updated my video drivers to the latest this morning and enabled
vsync. Enabling vsync sent my framerate from 1200 fps to 15 fps! Vsync
on or off made no difference on the cpu load- I always have 100%
utilization on one core.
  
I have a FireGL V7700 with 512 MB of RAM. I'm running the 8.603 drivers
on quad core XP Pro machine. My one-and-only monitor is a 24" Dell
panel at 1920x1200.
  
I turned vsync back off. With it on, my cow looked like it was being
rotated by a stepper motor.
  
If you or anybody else has troubleshooting suggestions, I would be very
happy to hear them. 
  
Cory
  

___
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] Putting text on top of a static background

2009-06-05 Thread Cory Riddell
I thought this would be easy, but 1/2 day later and I'm still stuck.

I'm using a technique similar to the osgHUD example to replace my window
background with a gradient fill. Now I want to be able to put some text
in the background too. At first, I thought I wasn't getting any text at
all, then I changed my background quad to only fill part of the screen.
Now I can see that my text is under the gradient background.

I've been trying things like changing the z coordinateof the text,
messing with StateSet stuff, and reordering my geodes and nothing is
working. My text always seems to get covered by the background gradient.

What settings should I be looking at? I'm really stuck on this.

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


Re: [osg-users] Putting text on top of a static background

2009-06-05 Thread Cory Riddell
I wrote the background scene to an osg file and the viewer displays it
correctly. So now I know the problem must be with my camera settings or
something else external to the scene. Any suggestions?

Cory

Cory Riddell wrote:
 I thought this would be easy, but 1/2 day later and I'm still stuck.

 I'm using a technique similar to the osgHUD example to replace my window
 background with a gradient fill. Now I want to be able to put some text
 in the background too. At first, I thought I wasn't getting any text at
 all, then I changed my background quad to only fill part of the screen.
 Now I can see that my text is under the gradient background.

 I've been trying things like changing the z coordinateof the text,
 messing with StateSet stuff, and reordering my geodes and nothing is
 working. My text always seems to get covered by the background gradient.

 What settings should I be looking at? I'm really stuck on this.

 Thanks,
 Cory
 ___
 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] CPU usage

2009-06-05 Thread Cory Riddell
Out of curiosity, do you get similar frame rates on the two systems? Are
the other stats similar?

I had asked about this one time and in the end I decided that it was
using 100% of one core intentionally. The run loop is not throttled in
any way, and so I think it will use as much cpu as it can.

Perhaps the nVidia system is better at offloading working or blocks the
CPU differently than the ATI system. In the end, I think this just
points to the CPU being the bottleneck in the ATI system and something
else (video card?) being the bottleneck in the nVidia system.

Cory

Florian Winter wrote:
 Hi,

 Sorry for reusing this old thread. It seems that nobody has found a
 solution for the problem yet that also works for me.

 When running osgviewer cow.osg on a dual-core PC, I get a CPU usage of
 50%, which indicates that one core is used at 100%.

 System:
 ATI Mobility Radeon HD 2400
 Windows XP

 However, with the same application, CPU usage is only at 5% on the
 following system:

 nVidia GeForce 9400
 Windows XP

 I have tried --SingleThreaded on the ATI system, but it seems to have no
 effect.

 Furthermore, I also get 50% CPU usage on another dual-core system with
 Windows Vista and nVidia GeForce 9400 if the single threaded model is
 used. With the default threading model, CPU usage goes up to 100%.

 I am using OSG version 2.6.0.
 V-Sync was enabled in all tests (using global driver settings, e.g. in
 Catalyst Control Center). The frame rate was constant and there was no
 tearing.

 So far, I have read all kinds of rumors about this issue from various
 sources. There are even older threads about this on the OSG mailing
 list. This is what I found so far:

 http://lists.openscenegraph.org/pipermail/osg-users-openscenegraph.org/2007-November/004363.html
 http://www.gamedev.net/community/forums/topic.asp?topic_id=445562

 Has anyone found a definitive solution to this problem yet?
 Can anyone confirm or deny that this is actually a problem and not a bug
 in Windows Task Manager showing the wrong CPU usage?
 Has something been done to address this problem in newer versions of OSG?

 Tearing prevention is absolutely necessary in my application, and a
 manual implementation of V-sync seems to be not accurate enough for
 the task.

 Thanks in advance,
 fw
 ___
 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] Putting text on top of a static background

2009-06-05 Thread Cory Riddell
Jason,

Jason Daly wrote:
 Cory Riddell wrote:
 I wrote the background scene to an osg file and the viewer displays it
 correctly. So now I know the problem must be with my camera settings or
 something else external to the scene. Any suggestions?
   

 Try putting the text in a different render bin, with a higher number
 than the background.  The background should be defaulting to bin 0, so
 try this:

 text-setRenderBinDetails(1, DefaultBin);

 If you're still not seeing the text, then it's probably failing the Z
 test, and you need to push your background farther away (or you could
 disable the Z test on your text).

Thanks for your suggestsions. The render bin didn't help, but the z test
did. I added these lines:

  // make sure the text always draws
  osg::StateSet* stateSet = text-getOrCreateStateSet();
  stateSet-setMode(GL_DEPTH_TEST, osg::StateAttribute::OFF);

and I was still not seeing anything. Then I set the text position to be
(0,0,0) rather than (0,0,1) and everything started working. I'm not sure
why putting the text slightly above the background plane was causing
problems. Thankfully, all seems to be working now.

Cory

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


Re: [osg-users] CPU usage

2009-06-05 Thread Cory Riddell
Does anybody see less than 100% CPU utilization when running osgviewer
cow.osg on an ATI card? I had just been accepting that as normal.

Cory

Jason Daly wrote:
 Cory Riddell wrote:
 I had asked about this one time and in the end I decided that it was
 using 100% of one core intentionally. The run loop is not throttled in
 any way, and so I think it will use as much cpu as it can.

 Perhaps the nVidia system is better at offloading working or blocks the
 CPU differently than the ATI system. In the end, I think this just
 points to the CPU being the bottleneck in the ATI system and something
 else (video card?) being the bottleneck in the nVidia system.
   

 I doubt that's the case if he's just running cow.osg.  More likely,
 VSync is not being properly detected on the ATI system, so the viewer
 is just running free and not waiting for the frame to be drawn on the
 screen.

 First thing I'd suggest is to make sure you've got the latest drivers
 for the ATI card.  ATI's OpenGL support has gotten a lot better
 recently, so it's possible that a driver upgrade will allow OSG to
 properly detect the VSync signal.

 --J

 ___
 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] MFC or Win32 based viewer

2009-05-28 Thread Cory Riddell




The osgviewer app that comes with OSG works in Windows. Also, the
bundled examples include an MFC based viewer called osgviewerMFC. 

Cory

Clay, Bruce wrote:

  
  
  
  
  I have tried all of the
ones except for osgWin32Demo (the
link is nonresponsive) in the windowing Toolkit section and can not get
them to
compile with the current version of OSG for various reasons. One uses
a
CameraManipulator which doe4s not seem to be in the current build.
Another is
looking for getOrCreateDatabasePager
in
registry.
  
  
  Does anyone have basic
viewer code that works with a MFC or
Win32 framework? 
  
  Bruce
  
  
  
  
  
This message and any enclosures are intended only for the addressee.  Please  
notify the sender by email if you are not the intended recipient.  If you are  
not the intended recipient, you may not use, copy, disclose, or distribute this  
message or its contents or enclosures to any other person and any such actions  
may be unlawful.  Ball reserves the right to monitor and review all messages  
and enclosures sent to or from this email address.
  

___
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] OpenThreads::Condition and spurious wakeups

2009-05-26 Thread Cory Riddell
I'm using boost::threads, but not any of the timed wait stuff. I run my
viewer in its own thread.

It is my understanding that for a timed wait, you do need to manually
track how much time has actually elapsed and restart the wait if necessary.

Cory

J.P. Delport wrote:
 Hi all,

 I'm using OpenThreads in a cross-platform application and wanted to
 use the Condition implementation, specifically the wait(timeout)
 version. However, the pthread docs suggest that pthread_cond_timedwait
 (that is used by OT) can return without explicitly being signalled
 (so-called spurious wakeups [1]). Now if I used pthreads directly I
 can just put the wait in a while loop checking my condition, because
 pthread_cond_timedwait takes an absolute time as a parameter and not a
 relative time as OT::Condition does.

 With the current OT::Condition there is no way to easily restart the
 timed wait (one will have to keep track of time oneself and OT does
 not have functions for it).

 I've searched for places in OSG where the timed wait is used and it is
 not used much. It is used in block(timeout) too, but that is also not
 used much in OSG. However, in the new ffmpeg plugin there is also this
 comment before using the timed wait:

 ---8---
 // We don't wait in a loop to avoid an infinite loop (as the ms
 timeout would not be decremented).
 // This means that timedPop() could return with (is_empty = true)
 before the timeout has been hit.
 ---8---

 Does anyone have more information on how to handle this issue? Should
 I just write my code to cope with this limitation? Has anyone used
 boost threads (and associated sync utils) with OSG?

 rgds
 jp


 [1] see the pthread docs or
 http://en.wikipedia.org/wiki/Spurious_wakeup

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


Re: [osg-users] OpenThreads::Condition and spurious wakeups

2009-05-26 Thread Cory Riddell
The first reply to this question is pretty good:
 
http://stackoverflow.com/questions/625340/spurious-unblocking-in-boost-thread

Cory

J.P. Delport wrote:
 Hi all,

 I'm using OpenThreads in a cross-platform application and wanted to
 use the Condition implementation, specifically the wait(timeout)
 version. However, the pthread docs suggest that pthread_cond_timedwait
 (that is used by OT) can return without explicitly being signalled
 (so-called spurious wakeups [1]). Now if I used pthreads directly I
 can just put the wait in a while loop checking my condition, because
 pthread_cond_timedwait takes an absolute time as a parameter and not a
 relative time as OT::Condition does.

 With the current OT::Condition there is no way to easily restart the
 timed wait (one will have to keep track of time oneself and OT does
 not have functions for it).

 I've searched for places in OSG where the timed wait is used and it is
 not used much. It is used in block(timeout) too, but that is also not
 used much in OSG. However, in the new ffmpeg plugin there is also this
 comment before using the timed wait:

 ---8---
 // We don't wait in a loop to avoid an infinite loop (as the ms
 timeout would not be decremented).
 // This means that timedPop() could return with (is_empty = true)
 before the timeout has been hit.
 ---8---

 Does anyone have more information on how to handle this issue? Should
 I just write my code to cope with this limitation? Has anyone used
 boost threads (and associated sync utils) with OSG?

 rgds
 jp


 [1] see the pthread docs or
 http://en.wikipedia.org/wiki/Spurious_wakeup

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


Re: [osg-users] Running viewer loop and physic calculations in different threads

2009-05-22 Thread Cory Riddell




Hi Alfonso,

I'm doing something similar to what you are doing. My viewer is running
in it's own thread. I have a shared object that I use to communicate
between the threads. If you are looking for sample code, I can try to
distill what I have to something relatively simple.

I'm using the boost threads library. It seems to work quite well and is
cross platform. Have you written multi-threaded apps before? Are you
familiar with mutexes (mutices?), conditions, volatile variables,
spurious wakes, etc...? 

If you aren't familiar with the boost stuff, I would recommend spending
some time getting familiar with it. 

Aside: if anybody can explain why spurious wakes exist, I'd love to
hear an explanation.

Cory


Alfonso Callejo Goena wrote:

  Hello everyone:
  
  I'm developing a OSG-based graphic engine for a real time
mechanical simulator. I would like that the physics and the graphic
display would run in separate threads so that they could work
independently without bothering each other. The communication between
them isa kind of buffer or list to which the physics program pushes
the last calculation and the graphic program pulls the appropriate one.
  I don't know which is the best (and most simple) way of setting
up and managing the threads. DoestheosgViewer classhave a way of
doing this? Where can I find an example which follows this technique?
  
  Thank you,
  Alfonso
  

___
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] Running viewer loop and physic calculations in different threads

2009-05-22 Thread Cory Riddell




Alfonso,

I've distilled my code down. I hope I haven't cut out too much. The
most complicated part for me was getting the halting sequence correct.
I tell the viewer to stop drawing and then have to wait until the
viewer thread is finished and notifies me that it is complete. 

I have a view class that "owns" the scene graph and the display. It
looks something like:

class MyView {
private:
 /// the OSG view onto the scene
 osg::ref_ptrosgViewer::Viewer m_viewer;
 /// the thread sets this to {...@code true} when the viewer thread has
stopped
 bool m_viewerThreadStopped;
 /// the mutex to protect access to {...@link #m_viewerThreadStopped}
 boost::mutex m_viewerThreadStoppedMutex;
 /// the condition variable for signalling {...@link
#m_viewerThreadStopped} has been set
 boost::condition_variable m_viewerThreadStoppedCond;

public:
 MyView() : m_viewerThreadStopped(false) { }
 ~MyView();
 void initialize();
...
};


MyView::~MyView() {
 if (m_viewer) {
  boost::unique_lockboost::mutex
lock(m_viewerThreadStoppedMutex);
  m_viewer-setDone(true);
 // this while loop has to be here because of spurious wakes
  while (!m_viewerThreadStopped) {
 // unblock and wait for it to signal that it is done running
   m_viewerThreadStoppedCond.wait(lock);
  }
  m_viewer-stopThreading();
  }
}


void MyView::initialize() {
 // set up the scene graph here
 ...

 // start the thread that does the OSG rendering
 boost::thread(startThread, m_viewer, m_viewerThreadStopped,
m_viewerThreadStoppedMutex, m_viewerThreadStoppedCond);
}


void startThread(osg::ref_ptrosgViewer::Viewer pViewer, 
 bool* doneFlag, boost::mutex* mutex,
boost::condition_variable* cond) 
{ 
 pViewer-run(); 
 boost::lock_guardboost::mutex lock(*mutex);
 *doneFlag = true;
 cond-notify_all();
}



Alfonso Callejo Goena wrote:

  Cory Riddell c...@... writes:

  
  

Hi Alfonso,
I'm doing something similar to what you are doing. My viewer is running
in it's own thread. I have a shared object that I use to communicate
between the threads. If you are looking for sample code, I can try to
distill what I have to something relatively simple.
I'm using the boost threads library. It seems to work quite well and is
cross platform. Have you written multi-threaded apps before? Are you
familiar with mutexes (mutices?), conditions, volatile variables,
spurious wakes, etc...? 
If you aren't familiar with the boost stuff, I would recommend spending
some time getting familiar with it. 
Aside: if anybody can explain why spurious wakes exist, I'd love to
hear an explanation.
Cory

  
  

Hi Cory,

I would appreciate very much your sample code, because I don't have much 
experience in this issue.
Did you consider using what Paul has suggested (osgDB::DatabasePager)? In my 
case the physical calculations are in fact a standalone program, and it is not 
just "loaded data"...

Thank you very much,
Alfonso


___
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] Bad OSG geometry

2009-05-22 Thread Cory Riddell
Did anybody else on the mailing list see this message but not rest of
the thread? I checked my spam folder too. No sign of the parent messages
anywhere. When I click the link to view the message in the forum, then I
can see the entire thread.

Cory

Andrew Cunningham wrote:
 Hi,
 Thanks for the tips guys - I did not think the light source node was included 
 in the BBox... obvious once you think of it..

 Thank you!

 Cheers,
 Andrew

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





 ___
 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-2.8.1 released :-)

2009-05-19 Thread Cory Riddell
Awesome. Thank you very much.

Cory

Robert Osfield wrote:
 Hi All,

 I have just tagged the OpenSceneGraph-2.8.1 release, and have started
 updating the website with all the details.  The source code can be
 grabbed from:

 source package : OpenSceneGraph-2.8.1.zip
 svn tag: svn co
 http://www.openscenegraph.org/svn/osg/OpenSceneGraph/tags/OpenSceneGraph-2.8.1
 OpenSceneGraph

 Or from the download page:

http://www.openscenegraph.org/projects/osg/wiki/Downloads?version=90

 News item for this release is:

http://www.openscenegraph.org/projects/osg/wiki/News/Press/OSG2.8.1

 We don't yet have any binaries, so could volunteers on the various
 platforms pull down the 2.8.1 sources and build the packages as we did
 for OpenSceneGraph-2.8.0.   It should be possible to ftp the binary
 packages on the OSG webiste, I'm afraid I don't recall the log in
 details over the top of my head.  Perhaps Jose Luis Hidalgo can point
 us in the right direction ;-)

 Many thanks to all those long suffering contributors that have been
 testing and help bug fix on this release.

 Happy coding :-)
 Robert.

 --  Updates between 2.8.1 and 2.8.0 releases include: ¶

 * Build fixes under !FreeBSD and IBM AIX, and RedHat Enterprise Linux.
 * Improved compatibility with SWIG wrapper building
 * Crash fixes in osg::State, osg::Geometry and osgWidget.
 * Bug fixes to :
   o draw instanced support
   o Optimizer - MergeGeometryVisitor,
 RemoveLoadedProxyNodesVisitor and SpatializeGroupsVistor
   o hdr image loader
   o handling of opacity maps in 3ds loader
   o dxf loader
   o frame buffer object
   o cursor/event handling in windows
   o windows threading
   o memory leak in Collada loader
   o fixes to display lists/vbo creation that prevent crash
 under ATI drivers
   o subface PolygonOffset setting in OpenFlight
   o osgconv --formats under OSX
   o osgTerrain::Layer bounding volume calculation.

 Updates between 2.8 and 2.6 include: ¶

 * New osgVolume library for volume rendering, with support for:
   o High quality GPU based Ray tracing
   o Transfer functions
   o Per pixel lighting
   o Iso surface rendering
   o Maximum Intensity Projection rendering
   o Non-power-of-two 3D textures, and 3D texture compression
   o DICOM loading for reading dicom medical data
 * New osgAnimation library for character and scene animation.
 * New plugin for reading Biovision hierarchical files (.BVH) to
 generate character motion animations.
 * New osgShadow support for Light Space Perspective Shadow Maps (LispSM).
 * Three new scene graph widgets for placing traditional 2D
 capability into fully interactive 3D scenes:
   o PDF widget (based on libPoppler)
   o VNC client widget (based on libVNCServer)
   o Internet browser client widget (based on Gecko/UBrowser)
 * New plugins for loading Half-Life 2 maps and models.
 * New plugin for loading EXR, high dynamic range imagery
 * Improvements to DatabasePager, tailored for low latency paging.
 * Improved runtime stats collection and on screen reporting.
 * Performance improvements through optimization of matrix operations.
 * Support for the OpenGL draw instanced extension.
 * Support for zlib compressed native .ive and .gz files
 * Improvements to COLLADA support.
 * Build reporting using CDash
 * New packaging support using CPack
 * A wide range of build and bug fixes
 ___
 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] handling trig exceptions due to floating point inaccuracies

2009-05-18 Thread Cory Riddell
I've been trying to use the SphericalManipulator class that was posted
to the submission list a few weeks ago and it is throwing exceptions
when it is trying to calculate acos(1.002) in the last line of
this function:

  void SphericalManipulator::setByMatrix(const osg::Matrixd matrix)
  {
  _center=osg::Vec3(0,0,-_distance)*matrix;
  _azimuth=atan2(-matrix(0,0),matrix(0,1));
  if(_rotationMode != MODE_2D)
  _zenith=acos(matrix(2,2));
  }

In my code, the matrix parameter is created by an inverse operation.

In general, is there some way to avoid this problem, or do I need to add
code that range checks critical values? Should the last line be changed
to this block:
  double val = matrix(2,2);
  if ((val = 1) || (val = 1))  zenith = 0;
  else zenith = acos(val);
Yuck.  

Cory

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


Re: [osg-users] handling trig exceptions due to floating point inaccuracies

2009-05-18 Thread Cory Riddell
Ack- acos(-1) is not pi. But the rest of my question still stands.

Cory Riddell wrote:
 I've been trying to use the SphericalManipulator class that was posted
 to the submission list a few weeks ago and it is throwing exceptions
 when it is trying to calculate acos(1.002) in the last line of
 this function:

   void SphericalManipulator::setByMatrix(const osg::Matrixd matrix)
   {
   _center=osg::Vec3(0,0,-_distance)*matrix;
   _azimuth=atan2(-matrix(0,0),matrix(0,1));
   if(_rotationMode != MODE_2D)
   _zenith=acos(matrix(2,2));
   }

 In my code, the matrix parameter is created by an inverse operation.

 In general, is there some way to avoid this problem, or do I need to add
 code that range checks critical values? Should the last line be changed
 to this block:
   double val = matrix(2,2);
   if ((val = 1) || (val = 1))  zenith = 0;
   else zenith = acos(val);
 Yuck.  

 Cory

 ___
 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] moving the camera to predefined locations smoothly

2009-05-18 Thread Cory Riddell
Ulrich,

Ulrich Hertlein wrote:
 On 16/5/09 10:57 PM, Cory Riddell wrote:
 Today I tried to do the FRAME event method and it didn't work. So now
 I'm thinking that AnimationPath is actually what I should be using.
 Would AnimationPath provide a way for me to move the camera from some
 arbitrary position to a predefined position?

 Why doesn't it work?

 Going the AnimationPath route is of course possible (and might make
 things easier) but the main task in both cases is to compute the
 actual path, e.g. a B-spline with proper start/end points,
 ease-in/ease-out, ensure the viewer is facing the right direction etc.

After you asked me that, I went back to try to figure out what didn't
work. It turns out that I was able to get it working with a few small
changes. I don't know what the correct parametric equation for moving a
camera between two points on the surface of a sphere is. I changed my
code to move the camera along a chord from point A to point B and that
seems to work just fine.

Any idea what the parametric equation for the arc connecting to points
on a sphere is?

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


Re: [osg-users] What is everyone doing for GUIs?

2009-05-16 Thread Cory Riddell
Mike,

Mike Hall wrote:
 Hey All,

 What are you all doing for GUI development in OSG?
   


We are plugging OSG into existing software. Sadly, it's Windows only and
uses MFC. OSG and MFC work surprisingly well together.

I would *love* to dump MFC for something like Qt, but that just isn't
going to happen in the next couple of years.

Cory




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


Re: [osg-users] moving the camera to predefined locations smoothly

2009-05-16 Thread Cory Riddell
Jean-Sébastien Guay wrote:
 event handler callback and move the eye a fraction of the way towards
 the destination. Successive FRAME events would eventually get the camera
 in the right place and it should be a smooth move. Is this a reasonable
 way to accomplish my goal?
 Yes, that seems like a good way. You could also do it with an
 UpdateCallback (again, moving a fraction of the way each frame), or
 just set the camera's view matrix (or the camera manipulator's eye
 position) each frame by breaking your frame loop into its component
 parts (instead of using viewer.run()).

Today I tried to do the FRAME event method and it didn't work. So now
I'm thinking that AnimationPath is actually what I should be using.
Would AnimationPath provide a way for me to move the camera from some
arbitrary position to a predefined position?

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


[osg-users] osganimationtimeline question

2009-05-15 Thread Cory Riddell
When I try to run osganimationtimeline on my machine, I get an error
that says:
  This example works only with osgAnimation/nathan.osg

Does anybody have a copy of this file? I think it should probably be
distributed with the example, or the example should be removed from the
distribution. I'm running 2.8.1 rc4.

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


[osg-users] moving the camera to predefined locations smoothly

2009-05-15 Thread Cory Riddell
I'd like to add be able to move the camera to a predefined location at
the click of a toolbar button (e.g. top, bottom, front, side, etc...). I
don't want to change the up direction or the center (at) location, so I
think all I need to do is change my eye location.

I'm thinking about adding a handler for GUIEventAdapter::FRAME to my
event handler callback and move the eye a fraction of the way towards
the destination. Successive FRAME events would eventually get the camera
in the right place and it should be a smooth move. Is this a reasonable
way to accomplish my goal?

Cory

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


Re: [osg-users] osganimationtimeline question

2009-05-15 Thread Cory Riddell
Jean-Sébastien,

Thanks. I had the data from the 2.6 release... :(

Cory


Jean-Sébastien Guay wrote:
 Hello Cory,

 When I try to run osganimationtimeline on my machine, I get an error
 that says:
   This example works only with osgAnimation/nathan.osg

 Does anybody have a copy of this file? I think it should probably be
 distributed with the example, or the example should be removed from the
 distribution. I'm running 2.8.1 rc4.

 Download OpenSceneGraph-Data from here:

 http://www.openscenegraph.org/projects/osg/wiki/Downloads/SampleDatasets

 and then set OSG_FILE_PATH to point to it. Many examples expect to
 find data that's in that zip, and the data can't be distributed with
 the sources or else they wouldn't just be sources anymore :-) plus it
 would bloat the sources when you can download the data just once for
 all releases...

 Even the classic cow.osg is there for your testing pleasure.

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


Re: [osg-users] Support becoming less and less personal

2009-05-06 Thread Cory Riddell




Hi Robert,

This thread is more than a little worrisome for me. I'm one of the
newbies here (been here 5 or 6 months). I looked at OSG and a few other
scene graph packages (one of which is not open source). I settled on
OSG because the support I received here was by far the most helpful as
I started scaling the learning curve. Your voice is one of a handful
that have consistently been there answering my (often inane) questions.
I truly appreciate it.

Nobody has mentioned the big elephant over there, so I will. Why don't
you sever the link between the forum and the mailing list? I understand
that some people prefer the forum, but we all lose if forum noise kills
your enthusiasm for OSG support. The forum could continue independently
and if there are enough people who prefer that format, it will thrive.

As for the "old school" comment- I think that is probably how a lot of
people feel about mailing lists. I wouldn't consider it an insult
though. You could always threaten to move everything to an nntp server
:).

Cory Riddell


Robert Osfield wrote:

  Hi Art,

On Wed, May 6, 2009 at 1:07 PM, Art Tevs arti_t...@yahoo.de wrote:
  
  
So you think using only one name (first or last name, whatever) is already enough for us? I just do want to have some concrete knowledge of what do you want to have. We need some rules, however, in order to implement filtering systems, I need concrete wishes.

  
  
Ideally you'd have both, the full name so you know which John or Jose
you are talking to, and the personal name used in 1 to 1 conversation.


  
  
Believe me or not, but this possibility is already there. There is some kind of template message appearing whenever you want to write a post through the forum. So users don't even need to type something extra, it is already there. The template looks like:
---
Hi,

...

Thank you!
---

Maybe you have seen the "..." in the posted messages in the last days ;)

So, what should I do more? If a user isn't able to even follow that template, what should we then do??? I have no answer for this.

  
  

The template is useful for sure and may well be a the route to making
things map better between forums and mailing list.  J.P's suggest of
putting the posters name after the Thank you!/Cheers would be probably
be good.  Forum users seeing something similar to what mailing list
users see would certainly be a good sanity check before posting.

I was wondering about the signature itself being customizable/tailored
to each user.

The fullname is already typically displayed as the From address.

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

  



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


  1   2   >