[osg-users] VBO

forest37 at 163.com forest37 at 163.com
Sun Jan 6 07:21:41 PST 2008


 
 
 
What does  fastPath mean? Is it related to VBO?
 
There is a sentence "if (_vertexData.indices.valid()) _fastPath = false;"
in the function Geometry::computeFastPathsUsed()
It seems that i can't use fastPath when i use setVertexIndices();
 
I just want to use Vertex_Buffer_Object,what should i do?
thanks!
 

在2008-01-04,osg-users-request at lists.openscenegraph.org 写道:

Send osg-users mailing list submissions to
	osg-users at lists.openscenegraph.org

To subscribe or unsubscribe via the World Wide Web, visit
	http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

or, via email, send a message with subject or body 'help' to
	osg-users-request at lists.openscenegraph.org

You can reach the person managing the list at
	osg-users-owner at lists.openscenegraph.org

When replying, please edit your Subject line so it is more specific
than "Re: Contents of osg-users digest..."


Today's Topics:

   1. Re: Error: 'Debug Assertion Failure!' (Gordon Tomlinson)
   2. Re: Error: 'Debug Assertion Failure!' (Rafa Gaitan)
   3. Re: Error: 'Debug Assertion Failure!' (Renan Mendes)
   4. Re: Error: 'Debug Assertion Failure!' (Ralph Kern)
   5. Re: Selective lighting in OSG (Pavlos Mavridis)
   6. Re: Selective lighting in OSG (Robert Osfield)
   7. Re: Error: 'Debug Assertion Failure!' (Gordon Tomlinson)
   8. Re: See images ( Eduardo Guti?rrez Sanmart?n )
   9. Re: Selective lighting in OSG (Pavlos Mavridis)
  10. osgViewer SCENE_STATS (Alberto Nortes)
  11. Re: Selective lighting in OSG (Robert Osfield)
  12. Re: osgViewer SCENE_STATS (Robert Osfield)
  13. Re: OSX installation changes (Andreas Vox)
  14. Re: Error: 'Debug Assertion Failure!' (Renan Mendes)
  15. Re: Error: 'Debug Assertion Failure!' (Renan Mendes)
  16. Re: Error: 'Debug Assertion Failure!' (Gordon Tomlinson)


----------------------------------------------------------------------

Message: 1
Date: Thu, 3 Jan 2008 08:05:12 -0000
From: "Gordon Tomlinson" <gordon at gordon-tomlinson.com>
Subject: Re: [osg-users] Error: 'Debug Assertion Failure!'
To: "'OpenSceneGraph Users'" <osg-users at lists.openscenegraph.org>
Message-ID:
	<!&!AAAAAAAAAAAYAAAAAAAAAFtXL6rImltBiRq+OnsD4FHCgAAAEAAAAAB77Svm8HRMjSHGYLcsgmsBAAAAAA==@gordon-tomlinson.com>
	
Content-Type: text/plain; charset="us-ascii"

The assertion is doing its job and telling you the issue a bad index ( also
might be good to tell us which line of code is doing this, I'm assuming
which one here ;)  )
 
Will you always have 2 or more children ? as your code is removing child
number 2 every time(indices are zero based), so if you have 2 children the
second time around your code would fail due to there only being 1 child
after one had been removed the first time etc...
 
 
root->removeChild(root->getChildIndex((*ponto_itr)), 1);
 
Should the 1 be 0?  or the last child ? if the last then you need to do an
int idx = root->getNumChildren() -1; and use that idx rather than 1 or 0
 
also for me I would be do something like the following, checking for valid
pointers etc...
 
osg::Group* root = (*ponto_itr)->getParent(0); 
 
if( root && root->getChildIndex((*ponto_itr)), 0))
   root->removeChild(root->getChildIndex((*ponto_itr)), 0);
 

__________________________________________________________
Gordon Tomlinson 

Email   : gordon at GordonTomlinson.com
Website : www.vis-sim.com www.gordontomlinson.com 


__________________________________________________________

"Self defence is not a function of learning tricks 
but is a function of how quickly and intensely one 
can arouse one's instinct for survival" 
-Master Tambo Tetsura 

 

  _____  

From: osg-users-bounces at lists.openscenegraph.org
[mailto:osg-users-bounces at lists.openscenegraph.org] On Behalf Of Renan
Mendes
Sent: 03 January 2008 01:48
To: OSG Mailing List
Subject: [Norton AntiSpam] [osg-users] Error: 'Debug Assertion Failure!'


Hi, everyone.

      When testing my application, an error message appeared saying: 'Debug
Assertion Failure' and 'vector subscription out of range'. This error
occured when:

1) I wrote the following code: 

case(osgGA::GUIEventAdapter::KEYDOWN):
            {
                if(!ponto.empty()) // ponto is defined as:
std::vector<Ponto*> ponto; in which Ponto is a class created by me.
                {
                    for(ponto_itr = ponto.begin(); ponto_itr != ponto.end();
ponto_itr++)
                    {
                        if((*ponto_itr)->verifySelection()) // verifies if
the shape associated with an instance of the class Ponto was picked 
                        {
                            switch(ea.getKey())
                            {
                            case(ea.KEY_Delete):
                                {
                                    osg::Group* root =
(*ponto_itr)->getParent(0); 
 
root->removeChild(root->getChildIndex((*ponto_itr)), 1);
                                }
                            }
                        }
                    } 
                }


2) AND when I do the following:
      1 - select one point;
      2 - delete it;
      3 - press delete again, having or NOT selected another 'ponto'
(instance of class Ponto) on the screen. 

NOTE: when a drawable from 'ponto' is selected (picked), the 'ponto' is
allocated in the vector.


      Thanks,

          Renan M Z Mendes

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.openscenegraph.org/pipermail/osg-users-openscenegraph.org/attachments/20080103/08946260/attachment.htm 

------------------------------

Message: 2
Date: Thu, 3 Jan 2008 09:14:25 +0100
From: "Rafa Gaitan" <rafa.gaitan at gmail.com>
Subject: Re: [osg-users] Error: 'Debug Assertion Failure!'
To: "OpenSceneGraph Users" <osg-users at lists.openscenegraph.org>
Message-ID:
	<6f1464270801030014r76c02cf1ped9149d216c5ee06 at mail.gmail.com>
Content-Type: text/plain; charset="iso-8859-1"

Hi Renan,

Did you clean your ponto vector after removing the child of the parent?. If
you don't
do that, you find that ponto has (for example) one element which value is
NULL. The problem
is that you don't use ref_ptr to save elements inside the vector and OSG
does. So when you
remove the children they are unreferenced and deleted.

Solution: Add a auxiliar vector of iterators to delete, and after your
process, delete all
iterators (ponto.remove(itr)) or something similar.

Hope this helps.
Rafa.


On Jan 3, 2008 2:47 AM, Renan Mendes <renanmzmendes at gmail.com> wrote:

> Hi, everyone.
>
>       When testing my application, an error message appeared saying:
> 'Debug Assertion Failure' and 'vector subscription out of range'. This error
> occured when:
>
> 1) I wrote the following code:
>
> case(osgGA::GUIEventAdapter::KEYDOWN):
>             {
>                 if(!ponto.empty()) // ponto is defined as:
> std::vector<Ponto*> ponto; in which Ponto is a class created by me.
>                 {
>                     for(ponto_itr = ponto.begin(); ponto_itr != ponto.end();
> ponto_itr++)
>                     {
>                         if((*ponto_itr)->verifySelection()) // verifies if
> the shape associated with an instance of the class Ponto was picked
>                         {
>                             switch(ea.getKey())
>                             {
>                             case(ea.KEY_Delete):
>                                 {
>                                     osg::Group* root =
> (*ponto_itr)->getParent(0);
>
> root->removeChild(root->getChildIndex((*ponto_itr)), 1);
>                                 }
>                             }
>                         }
>                     }
>                 }
>
>
> 2) AND when I do the following:
>       1 - select one point;
>       2 - delete it;
>       3 - press delete again, having or NOT selected another 'ponto'
> (instance of class Ponto) on the screen.
>
> NOTE: when a drawable from 'ponto' is selected (picked), the 'ponto' is
> allocated in the vector.
>
>
>       Thanks,
>
>           Renan M Z Mendes
>
> _______________________________________________
> osg-users mailing list
> osg-users at lists.openscenegraph.org
> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
>
>


-- 
Rafael Gait?n Linares
Instituto de Autom?tica e Inform?tica Industrial  http://www.ai2.upv.es
Ciudad Polit?cnica de la Innovaci?n
Universidad Polit?cnica de Valencia
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.openscenegraph.org/pipermail/osg-users-openscenegraph.org/attachments/20080103/7ff38bd1/attachment-0001.html 

------------------------------

Message: 3
Date: Thu, 3 Jan 2008 06:58:08 -0200
From: "Renan Mendes" <renanmzmendes at gmail.com>
Subject: Re: [osg-users] Error: 'Debug Assertion Failure!'
To: gordon at gordon-tomlinson.com,	"OpenSceneGraph Users"
	<osg-users at lists.openscenegraph.org>
Message-ID:
	<295c75220801030058v379c307cn108662d870d8f71d at mail.gmail.com>
Content-Type: text/plain; charset="iso-8859-1"

Hi, Gordon.

      I've looked up the doxygen documentation, and the second argument of
removeChild is numChildrenToRemove, which I thought stood for 'number of
children to remove'. If so, wouldn't I want 1 child to be removed? Isn't my
index correct?

                 Thanks,

                     Renan M Z Mendes
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.openscenegraph.org/pipermail/osg-users-openscenegraph.org/attachments/20080103/17aaad4c/attachment.htm 

------------------------------

Message: 4
Date: Thu, 03 Jan 2008 10:09:17 +0100
From: Ralph Kern <usenet04 at rk-se.de>
Subject: Re: [osg-users] Error: 'Debug Assertion Failure!'
To: osg-users at lists.openscenegraph.org
Message-ID: <fli8nt$oqg$1 at ger.gmane.org>
Content-Type: text/plain; charset=ISO-8859-1

What Gordon wants to tell you is that you just have to carefully clean
up the contents of your ponto vector also. Be careful not to erase
elements of a std::vector while iterating through.

regards Ralph


Renan Mendes schrieb:
> Hi, Gordon.
> 
>       I've looked up the doxygen documentation, and the second argument
> of removeChild is numChildrenToRemove, which I thought stood for 'number
> of children to remove'. If so, wouldn't I want 1 child to be removed?
> Isn't my index correct?
> 
>                  Thanks,
> 
>                      Renan M Z Mendes
> 



------------------------------

Message: 5
Date: Thu, 03 Jan 2008 11:03:20 +0200
From: Pavlos Mavridis <pavlos at fhw.gr>
Subject: Re: [osg-users] Selective lighting in OSG
To: OpenSceneGraph Users <osg-users at lists.openscenegraph.org>
Message-ID: <477CA4D8.8060303 at fhw.gr>
Content-Type: text/plain; charset=ISO-8859-1; format=flowed

Hi Paul,
Your suggestion to use shaders and perhaps pass the light parameters 
using uniforms,
as Terry suggested, seems very reasonable to me. That way we can bypass 
the OSG
backend and manage the lights in our code. And it's probably simpler 
than messing
with the backend.

Of course, if there's a better or more elegant approach I would like to 
hear it.

Pavlos

Paul Martz wrote:
> As Robert said, using the fixed function pipe involves knowledge of  
> the backend. I believe multiple RenderStages would allow multiple  
> PositionalState, which means you could support more than the fixed  
> function limit for lights. This gets complex.
>
> It'd probably be easier to use shaders to do what you want, as they  
> aren't limited by the number of fixed function lights.
>
> Paul Martz
> Skew Matrix Software
>
>
> On Jan 2, 2008, at 5:06 PM, "Terry Welsh" <mogumbo at gmail.com> wrote:
>
>   
>> Hi Pavlos,
>> I'm interested in this topic too.  I haven't found the discussions in
>> the archives, but I probably just haven't picked the right search
>> keywords.
>>
>> My problem is very similar to yours I think.  I want to have a lot of
>> lights in my scene that falloff completely after a reasonable distance
>> and only apply 3 of them to each piece of geometry, probably choosing
>> them based on proximity and/or brightness.  I was thinking of only
>> activating lights 0, 1, and 2 and applying a cull callback to all my
>> geodes that would set different light positions and colors for each
>> geode that doesn't get culled.  The positions and colors would be
>> chosen from a much larger pool of lights that I store in my own data
>> structures outside of OpenGL and OSG.  I haven't figured out if I
>> would do this by setting parameters for OpenGL lights 0, 1, and 2, or
>> by setting custom shader Uniforms.
>>
>> Or there might be a much better approach I haven't thought of.
>> Anyway, I'd like to discuss this more or hear from anyone who has done
>> this....
>> - Terry
>>
>>     
>>> Message: 3
>>> Date: Wed, 2 Jan 2008 16:42:37 +0000
>>> From: "Robert Osfield" <robert.osfield at gmail.com>
>>> Subject: Re: [osg-users] Selective lighting in OSG
>>> To: "OpenSceneGraph Users" <osg-users at lists.openscenegraph.org>
>>> Message-ID:
>>>        <7ffb8e9b0801020842u21ae4b26ra38b4a624ceefd37 at mail.gmail.com>
>>> Content-Type: text/plain; charset=ISO-8859-1
>>>
>>> Hi Pavlos,
>>>
>>> I'm afraid handling more than max number of OpenGL lights is awkward
>>> in the OSG, it is possible but you'll need to learn quite a bit about
>>> the internals of how the rendering back end is setup and traversed.
>>> This topic has been discussed in the past on osg-users so have a bash
>>> at going through the email archives.
>>>
>>> Robert.
>>>
>>> On Jan 2, 2008 4:13 PM, Pavlos Mavridis <pavlos at fhw.gr> wrote:
>>>       
>>>> Selective lighting in OSG
>>>>
>>>> Hello everyone,
>>>> what is the best way to define a light that affects not the entire
>>>> scenegraph, but only a part of it?
>>>>
>>>> For example I have a scene with many objects. Each one of them is  
>>>> lit by
>>>> one light that is
>>>> different from one object to another. So the number of lights can be
>>>> greater than GL_MAX_LIGHTS,
>>>> but since each object is lit only by one light, using opengl we  
>>>> could
>>>> render the entire scene using
>>>> only one hardware light (lets say GL_LIGHT0), by resetting its
>>>> parameters per object.
>>>>
>>>> In the general case we can have more than one light per object and  
>>>> the
>>>> lights can be
>>>> turned on and off per frame. So, what is the best way to do this  
>>>> in OSG?
>>>>
>>>> I've tried passing the stateset of the sub-tree I want to light on a
>>>> lighsource node using:
>>>>    lightsource->setStateSetModes(stateset,osg::StateAttribute::ON);
>>>> but it doesn't work as expected.
>>>>
>>>> Also I've tried changing the stateset of the sub-tree I want to  
>>>> light
>>>> directly,
>>>> without using any lighsource nodes:
>>>>    stateset->setAttributeAndModes(light, osg::StateAttribute::ON);
>>>>    stateset->setMode( GL_LIGHT0 + num, osg::StateAttribute::ON );
>>>> to enable a light and
>>>>    stateset->setAttributeAndModes(light, osg::StateAttribute::OFF);
>>>> to remove it.
>>>>
>>>> The last method seems to work when the number of lights is  
>>>> constant per
>>>> frame,
>>>> but it brakes when I try to dynamically turn on and off lights per
>>>> frame. (perhaps
>>>> because I have to manually enable/disable the corresponding opengl  
>>>> lights?)
>>>>
>>>> So, what is the best way to do this in OSG?
>>>>
>>>> Thanks in advance
>>>>
>>>> Pavlos Mavridis
>>>>
>>>>         
>> _______________________________________________
>> osg-users mailing list
>> osg-users at lists.openscenegraph.org
>> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
>>     
> _______________________________________________
> osg-users mailing list
> osg-users at lists.openscenegraph.org
> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
>
>   



------------------------------

Message: 6
Date: Thu, 3 Jan 2008 09:25:51 +0000
From: "Robert Osfield" <robert.osfield at gmail.com>
Subject: Re: [osg-users] Selective lighting in OSG
To: "OpenSceneGraph Users" <osg-users at lists.openscenegraph.org>
Message-ID:
	<7ffb8e9b0801030125nd940cc1y23cf518f1c5f14c5 at mail.gmail.com>
Content-Type: text/plain; charset=ISO-8859-1

Hi Pavlos,

Using shaders is certainly more flexible, but it does bring its own
complexities.

FYI, the complexities in handling standard OpenGL lighting with more
than the max supported comes down to the way that the OSG handles that
fact that lights are positional state, and positional state has to be
bound to a specific modelview matrix to position it in the correct
place - OpenGL lights can't just be assigned at any time in the draw
traversal as their modelview matrices will be indeterminate and end up
jumping around the place relative to different chunks of your scene
graph.

To cope with the correct binding of position state with the intended
modelview matrix the OSG detects the LightSource nodes in the scene
graph during cull traversal and then binds the modelview matrix
inhertied down to this LightSource with the Light attached to the
LightSource, then this pairing of matrix and light are assigned to the
current RenderStage (a render backend object that manages the
rendering of a single stage in the rendering pipeline).  Each
RenderStage can only have up to the max supported lights assigned to
at any one time and a single light can't be in more than one place at
one time as there is only one entry for it.  To handle more lights you
need to segment you scene up so that different parts render into
different RenderStage, these RenderStage will need to be chain so that
the first one does the usual OpenGL clear of colour and depth
buffers(as is default for a RenderStage), the subsequent ones then
switch off the clear, so they overlay on top.   You can do custom
control of the RenderStage by using a cull callback that
creates/maintains them appropriately.

Robert.




On Jan 3, 2008 9:03 AM, Pavlos Mavridis <pavlos at fhw.gr> wrote:
> Hi Paul,
> Your suggestion to use shaders and perhaps pass the light parameters
> using uniforms,
> as Terry suggested, seems very reasonable to me. That way we can bypass
> the OSG
> backend and manage the lights in our code. And it's probably simpler
> than messing
> with the backend.
>
> Of course, if there's a better or more elegant approach I would like to
> hear it.
>
> Pavlos
>
>
> Paul Martz wrote:
> > As Robert said, using the fixed function pipe involves knowledge of
> > the backend. I believe multiple RenderStages would allow multiple
> > PositionalState, which means you could support more than the fixed
> > function limit for lights. This gets complex.
> >
> > It'd probably be easier to use shaders to do what you want, as they
> > aren't limited by the number of fixed function lights.
> >
> > Paul Martz
> > Skew Matrix Software
> >
> >
> > On Jan 2, 2008, at 5:06 PM, "Terry Welsh" <mogumbo at gmail.com> wrote:
> >
> >
> >> Hi Pavlos,
> >> I'm interested in this topic too.  I haven't found the discussions in
> >> the archives, but I probably just haven't picked the right search
> >> keywords.
> >>
> >> My problem is very similar to yours I think.  I want to have a lot of
> >> lights in my scene that falloff completely after a reasonable distance
> >> and only apply 3 of them to each piece of geometry, probably choosing
> >> them based on proximity and/or brightness.  I was thinking of only
> >> activating lights 0, 1, and 2 and applying a cull callback to all my
> >> geodes that would set different light positions and colors for each
> >> geode that doesn't get culled.  The positions and colors would be
> >> chosen from a much larger pool of lights that I store in my own data
> >> structures outside of OpenGL and OSG.  I haven't figured out if I
> >> would do this by setting parameters for OpenGL lights 0, 1, and 2, or
> >> by setting custom shader Uniforms.
> >>
> >> Or there might be a much better approach I haven't thought of.
> >> Anyway, I'd like to discuss this more or hear from anyone who has done
> >> this....
> >> - Terry
> >>
> >>
> >>> Message: 3
> >>> Date: Wed, 2 Jan 2008 16:42:37 +0000
> >>> From: "Robert Osfield" <robert.osfield at gmail.com>
> >>> Subject: Re: [osg-users] Selective lighting in OSG
> >>> To: "OpenSceneGraph Users" <osg-users at lists.openscenegraph.org>
> >>> Message-ID:
> >>>        <7ffb8e9b0801020842u21ae4b26ra38b4a624ceefd37 at mail.gmail.com>
> >>> Content-Type: text/plain; charset=ISO-8859-1
> >>>
> >>> Hi Pavlos,
> >>>
> >>> I'm afraid handling more than max number of OpenGL lights is awkward
> >>> in the OSG, it is possible but you'll need to learn quite a bit about
> >>> the internals of how the rendering back end is setup and traversed.
> >>> This topic has been discussed in the past on osg-users so have a bash
> >>> at going through the email archives.
> >>>
> >>> Robert.
> >>>
> >>> On Jan 2, 2008 4:13 PM, Pavlos Mavridis <pavlos at fhw.gr> wrote:
> >>>
> >>>> Selective lighting in OSG
> >>>>
> >>>> Hello everyone,
> >>>> what is the best way to define a light that affects not the entire
> >>>> scenegraph, but only a part of it?
> >>>>
> >>>> For example I have a scene with many objects. Each one of them is
> >>>> lit by
> >>>> one light that is
> >>>> different from one object to another. So the number of lights can be
> >>>> greater than GL_MAX_LIGHTS,
> >>>> but since each object is lit only by one light, using opengl we
> >>>> could
> >>>> render the entire scene using
> >>>> only one hardware light (lets say GL_LIGHT0), by resetting its
> >>>> parameters per object.
> >>>>
> >>>> In the general case we can have more than one light per object and
> >>>> the
> >>>> lights can be
> >>>> turned on and off per frame. So, what is the best way to do this
> >>>> in OSG?
> >>>>
> >>>> I've tried passing the stateset of the sub-tree I want to light on a
> >>>> lighsource node using:
> >>>>    lightsource->setStateSetModes(stateset,osg::StateAttribute::ON);
> >>>> but it doesn't work as expected.
> >>>>
> >>>> Also I've tried changing the stateset of the sub-tree I want to
> >>>> light
> >>>> directly,
> >>>> without using any lighsource nodes:
> >>>>    stateset->setAttributeAndModes(light, osg::StateAttribute::ON);
> >>>>    stateset->setMode( GL_LIGHT0 + num, osg::StateAttribute::ON );
> >>>> to enable a light and
> >>>>    stateset->setAttributeAndModes(light, osg::StateAttribute::OFF);
> >>>> to remove it.
> >>>>
> >>>> The last method seems to work when the number of lights is
> >>>> constant per
> >>>> frame,
> >>>> but it brakes when I try to dynamically turn on and off lights per
> >>>> frame. (perhaps
> >>>> because I have to manually enable/disable the corresponding opengl
> >>>> lights?)
> >>>>
> >>>> So, what is the best way to do this in OSG?
> >>>>
> >>>> Thanks in advance
> >>>>
> >>>> Pavlos Mavridis
> >>>>
> >>>>
> >> _______________________________________________
> >> osg-users mailing list
> >> osg-users at lists.openscenegraph.org
> >> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
> >>
> > _______________________________________________
> > osg-users mailing list
> > osg-users at lists.openscenegraph.org
> > http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
> >
> >
>
> _______________________________________________
> osg-users mailing list
> osg-users at lists.openscenegraph.org
> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
>


------------------------------

Message: 7
Date: Thu, 3 Jan 2008 09:42:12 -0000
From: "Gordon Tomlinson" <gordon at gordon-tomlinson.com>
Subject: Re: [osg-users] Error: 'Debug Assertion Failure!'
To: "'OpenSceneGraph Users'" <osg-users at lists.openscenegraph.org>
Message-ID:
	<!&!AAAAAAAAAAAYAAAAAAAAAFtXL6rImltBiRq+OnsD4FHCgAAAEAAAADwDy3Y02AJJgXoT4wohxzYBAAAAAA==@gordon-tomlinson.com>
	
Content-Type: text/plain; charset="us-ascii"

HI Renan
 
Sorry my bad, I was thinking of Vega and Vega Prime how children work there
 
Looking at getChildIndex it returns the size of the children array if Child
node is not found.
 
 
This seems like a subtle bug because it returns a Zero for no children, but
zero is a valid index, perhaps this function should return  -1 if no
children or something as zero is clearly wrong here
 
 
Also as pointed out you need to make sure can clean up your array after you
remove a child as the pointers you have may no longer be valid etc
 

__________________________________________________________
Gordon Tomlinson 

Email   : gordon at GordonTomlinson.com
Website : www.vis-sim.com www.gordontomlinson.com 


__________________________________________________________

"Self defence is not a function of learning tricks 
but is a function of how quickly and intensely one 
can arouse one's instinct for survival" 
-Master Tambo Tetsura 

 

  _____  

From: Renan Mendes [mailto:renanmzmendes at gmail.com] 
Sent: 03 January 2008 08:58
To: gordon at gordon-tomlinson.com; OpenSceneGraph Users
Subject: [Norton AntiSpam] Re: [osg-users] Error: 'Debug Assertion Failure!'


Hi, Gordon.

      I've looked up the doxygen documentation, and the second argument of
removeChild is numChildrenToRemove, which I thought stood for 'number of
children to remove'. If so, wouldn't I want 1 child to be removed? Isn't my
index correct? 

                 Thanks,

                     Renan M Z Mendes
 
 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.openscenegraph.org/pipermail/osg-users-openscenegraph.org/attachments/20080103/8f585ed1/attachment-0001.html 

------------------------------

Message: 8
Date: Thu, 3 Jan 2008 11:48:34 +0100
From: " Eduardo Guti?rrez Sanmart?n " <edugutisan at gmail.com>
Subject: Re: [osg-users] See images
To: "OpenSceneGraph Users" <osg-users at lists.openscenegraph.org>
Message-ID:
	<3a21bdd80801030248s2deb0c9ft899f165833fa336b at mail.gmail.com>
Content-Type: text/plain; charset="iso-8859-1"

Hi, Pedro

Where you want show that texture?

For example, you can show that image on a square as follow, altering the
code of the file 'osgviewer.cpp':

osg::Drawable* createSquare(const osg::Vec3& corner, const osg::Vec3& width,
                            const osg::Vec3& height, osg::Image* image =
NULL)
{
    osg::Geometry* geom = new osg::Geometry;

    osg::Vec3Array* coords = new osg::Vec3Array(4);
    (*coords)[0] = corner;
    (*coords)[1] = corner+width;
    (*coords)[2] = corner+width+height;
    (*coords)[3] = corner+height;

    geom->setVertexArray(coords);

    osg::Vec3Array* norms = new osg::Vec3Array(1);
    (*norms)[0] = width^height;
    (*norms)[0].normalize();

    geom->setNormalArray(norms);
    geom->setNormalBinding(osg::Geometry::BIND_OVERALL);

    osg::Vec2Array* tcoords = new osg::Vec2Array(4);
    (*tcoords)[0].set(0.0f,0.0f);
    (*tcoords)[1].set(1.0f,0.0f);
    (*tcoords)[2].set(1.0f,1.0f);
    (*tcoords)[3].set(0.0f,1.0f);
    geom->setTexCoordArray(0,tcoords);

    geom->addPrimitiveSet(new
osg::DrawArrays(osg::PrimitiveSet::QUADS,0,4));

    if (image)
    {
        osg::StateSet* stateset = new osg::StateSet;
        osg::Texture2D* texture = new osg::Texture2D;
        texture->setImage(image);

stateset->setTextureAttributeAndModes(0,texture,osg::StateAttribute::ON);
        geom->setStateSet(stateset);
    }

    return geom;
}

And then, in function 'main()',

osg::Vec3 corner(-25.f, 0.f, 0.f);
osg::Vec3 width(50.f, 0.f, 0.f);
osg::Vec3 height(0.f, 0.f, 50.f);
osg::ref_ptr<osg::Geode> geode = new osg::Geode();
geode->addDrawable( createSquare(corner, width, height,
osgDB::readImageFile("porton.tif") );

viewer.setSceneData(geode.get());

I hope this help you.

Edu

PD: Please, don't attach the whole osg-users Digest :)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.openscenegraph.org/pipermail/osg-users-openscenegraph.org/attachments/20080103/bb579412/attachment.htm 

------------------------------

Message: 9
Date: Thu, 03 Jan 2008 12:54:26 +0200
From: Pavlos Mavridis <pavlos at fhw.gr>
Subject: Re: [osg-users] Selective lighting in OSG
To: OpenSceneGraph Users <osg-users at lists.openscenegraph.org>
Message-ID: <477CBEE2.1080107 at fhw.gr>
Content-Type: text/plain; charset=ISO-8859-1; format=flowed

Hi Robert,
Thank you for your rigorous explanation of the renderstage 
functionality.  It's good to know that OSG offers such flexibility. The 
separation of the scene to different renderstages is probably what I was 
looking for, but unfortunately it's not as simple as I was hoping.  I 
will look into culling callbacks and I will be back soon with more 
questions....

In the meantime, If anyone else has any other suggestions i would be 
glad to hear them.

Pavlos.

Robert Osfield wrote:
> Hi Pavlos,
>
> Using shaders is certainly more flexible, but it does bring its own
> complexities.
>
> FYI, the complexities in handling standard OpenGL lighting with more
> than the max supported comes down to the way that the OSG handles that
> fact that lights are positional state, and positional state has to be
> bound to a specific modelview matrix to position it in the correct
> place - OpenGL lights can't just be assigned at any time in the draw
> traversal as their modelview matrices will be indeterminate and end up
> jumping around the place relative to different chunks of your scene
> graph.
>
> To cope with the correct binding of position state with the intended
> modelview matrix the OSG detects the LightSource nodes in the scene
> graph during cull traversal and then binds the modelview matrix
> inhertied down to this LightSource with the Light attached to the
> LightSource, then this pairing of matrix and light are assigned to the
> current RenderStage (a render backend object that manages the
> rendering of a single stage in the rendering pipeline).  Each
> RenderStage can only have up to the max supported lights assigned to
> at any one time and a single light can't be in more than one place at
> one time as there is only one entry for it.  To handle more lights you
> need to segment you scene up so that different parts render into
> different RenderStage, these RenderStage will need to be chain so that
> the first one does the usual OpenGL clear of colour and depth
> buffers(as is default for a RenderStage), the subsequent ones then
> switch off the clear, so they overlay on top.   You can do custom
> control of the RenderStage by using a cull callback that
> creates/maintains them appropriately.
>
> Robert.
>
>
>
>
> On Jan 3, 2008 9:03 AM, Pavlos Mavridis <pavlos at fhw.gr> wrote:
>   
>> Hi Paul,
>> Your suggestion to use shaders and perhaps pass the light parameters
>> using uniforms,
>> as Terry suggested, seems very reasonable to me. That way we can bypass
>> the OSG
>> backend and manage the lights in our code. And it's probably simpler
>> than messing
>> with the backend.
>>
>> Of course, if there's a better or more elegant approach I would like to
>> hear it.
>>
>> Pavlos
>>
>>
>> Paul Martz wrote:
>>     
>>> As Robert said, using the fixed function pipe involves knowledge of
>>> the backend. I believe multiple RenderStages would allow multiple
>>> PositionalState, which means you could support more than the fixed
>>> function limit for lights. This gets complex.
>>>
>>> It'd probably be easier to use shaders to do what you want, as they
>>> aren't limited by the number of fixed function lights.
>>>
>>> Paul Martz
>>> Skew Matrix Software
>>>
>>>
>>> On Jan 2, 2008, at 5:06 PM, "Terry Welsh" <mogumbo at gmail.com> wrote:
>>>
>>>
>>>       
>>>> Hi Pavlos,
>>>> I'm interested in this topic too.  I haven't found the discussions in
>>>> the archives, but I probably just haven't picked the right search
>>>> keywords.
>>>>
>>>> My problem is very similar to yours I think.  I want to have a lot of
>>>> lights in my scene that falloff completely after a reasonable distance
>>>> and only apply 3 of them to each piece of geometry, probably choosing
>>>> them based on proximity and/or brightness.  I was thinking of only
>>>> activating lights 0, 1, and 2 and applying a cull callback to all my
>>>> geodes that would set different light positions and colors for each
>>>> geode that doesn't get culled.  The positions and colors would be
>>>> chosen from a much larger pool of lights that I store in my own data
>>>> structures outside of OpenGL and OSG.  I haven't figured out if I
>>>> would do this by setting parameters for OpenGL lights 0, 1, and 2, or
>>>> by setting custom shader Uniforms.
>>>>
>>>> Or there might be a much better approach I haven't thought of.
>>>> Anyway, I'd like to discuss this more or hear from anyone who has done
>>>> this....
>>>> - Terry
>>>>
>>>>
>>>>         
>>>>> Message: 3
>>>>> Date: Wed, 2 Jan 2008 16:42:37 +0000
>>>>> From: "Robert Osfield" <robert.osfield at gmail.com>
>>>>> Subject: Re: [osg-users] Selective lighting in OSG
>>>>> To: "OpenSceneGraph Users" <osg-users at lists.openscenegraph.org>
>>>>> Message-ID:
>>>>>        <7ffb8e9b0801020842u21ae4b26ra38b4a624ceefd37 at mail.gmail.com>
>>>>> Content-Type: text/plain; charset=ISO-8859-1
>>>>>
>>>>> Hi Pavlos,
>>>>>
>>>>> I'm afraid handling more than max number of OpenGL lights is awkward
>>>>> in the OSG, it is possible but you'll need to learn quite a bit about
>>>>> the internals of how the rendering back end is setup and traversed.
>>>>> This topic has been discussed in the past on osg-users so have a bash
>>>>> at going through the email archives.
>>>>>
>>>>> Robert.
>>>>>
>>>>> On Jan 2, 2008 4:13 PM, Pavlos Mavridis <pavlos at fhw.gr> wrote:
>>>>>
>>>>>           
>>>>>> Selective lighting in OSG
>>>>>>
>>>>>> Hello everyone,
>>>>>> what is the best way to define a light that affects not the entire
>>>>>> scenegraph, but only a part of it?
>>>>>>
>>>>>> For example I have a scene with many objects. Each one of them is
>>>>>> lit by
>>>>>> one light that is
>>>>>> different from one object to another. So the number of lights can be
>>>>>> greater than GL_MAX_LIGHTS,
>>>>>> but since each object is lit only by one light, using opengl we
>>>>>> could
>>>>>> render the entire scene using
>>>>>> only one hardware light (lets say GL_LIGHT0), by resetting its
>>>>>> parameters per object.
>>>>>>
>>>>>> In the general case we can have more than one light per object and
>>>>>> the
>>>>>> lights can be
>>>>>> turned on and off per frame. So, what is the best way to do this
>>>>>> in OSG?
>>>>>>
>>>>>> I've tried passing the stateset of the sub-tree I want to light on a
>>>>>> lighsource node using:
>>>>>>    lightsource->setStateSetModes(stateset,osg::StateAttribute::ON);
>>>>>> but it doesn't work as expected.
>>>>>>
>>>>>> Also I've tried changing the stateset of the sub-tree I want to
>>>>>> light
>>>>>> directly,
>>>>>> without using any lighsource nodes:
>>>>>>    stateset->setAttributeAndModes(light, osg::StateAttribute::ON);
>>>>>>    stateset->setMode( GL_LIGHT0 + num, osg::StateAttribute::ON );
>>>>>> to enable a light and
>>>>>>    stateset->setAttributeAndModes(light, osg::StateAttribute::OFF);
>>>>>> to remove it.
>>>>>>
>>>>>> The last method seems to work when the number of lights is
>>>>>> constant per
>>>>>> frame,
>>>>>> but it brakes when I try to dynamically turn on and off lights per
>>>>>> frame. (perhaps
>>>>>> because I have to manually enable/disable the corresponding opengl
>>>>>> lights?)
>>>>>>
>>>>>> So, what is the best way to do this in OSG?
>>>>>>
>>>>>> Thanks in advance
>>>>>>
>>>>>> Pavlos Mavridis
>>>>>>
>>>>>>
>>>>>>             
>>>> _______________________________________________
>>>> osg-users mailing list
>>>> osg-users at lists.openscenegraph.org
>>>> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
>>>>
>>>>         
>>> _______________________________________________
>>> osg-users mailing list
>>> osg-users at lists.openscenegraph.org
>>> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
>>>
>>>
>>>       
>> _______________________________________________
>> osg-users mailing list
>> osg-users at lists.openscenegraph.org
>> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
>>
>>     
> _______________________________________________
> osg-users mailing list
> osg-users at lists.openscenegraph.org
> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
>
>   



------------------------------

Message: 10
Date: Thu, 03 Jan 2008 12:11:22 +0100
From: Alberto Nortes <no3productionz at gmail.com>
Subject: [osg-users] osgViewer SCENE_STATS
To: osg-users at lists.openscenegraph.org
Message-ID: <477CC2DA.3000604 at gmail.com>
Content-Type: text/plain; charset=ISO-8859-1; format=flowed

Hello and happy new year to everyone!

I just want to know if it would be possible to retrieve the old 
osgProducer SCENE_STATS in osgViewer. I know  actually we dont have code 
for this functionality, so what would be the first steps (examples, 
guidelines...) to get the same data using osgViewer?

thanks very much, and best wishes!


------------------------------

Message: 11
Date: Thu, 3 Jan 2008 11:29:11 +0000
From: "Robert Osfield" <robert.osfield at gmail.com>
Subject: Re: [osg-users] Selective lighting in OSG
To: "OpenSceneGraph Users" <osg-users at lists.openscenegraph.org>
Message-ID:
	<7ffb8e9b0801030329g5aa4f82ev855709c48d3d8644 at mail.gmail.com>
Content-Type: text/plain; charset=ISO-8859-1

Hi Pavalos,

On Jan 3, 2008 10:54 AM, Pavlos Mavridis <pavlos at fhw.gr> wrote:
> Hi Robert,
> Thank you for your rigorous explanation of the renderstage
> functionality.  It's good to know that OSG offers such flexibility. The
> separation of the scene to different renderstages is probably what I was
> looking for, but unfortunately it's not as simple as I was hoping.  I
> will look into culling callbacks and I will be back soon with more
> questions....
>
> In the meantime, If anyone else has any other suggestions i would be
> glad to hear them.

I think perhaps we should have an osg example that illustrates how to
set things up, it should only take a few dozen lines of code to
support, but the trick is knowing which lines of code you need...

As a general note, the rendering back end of the OSG is its probably
its most complex part, the complexity comes from its flexibility.
Typically one doesn't need to worry too much about the rendering back
end, its just does it stuff behind the scenes, just occasionally one
needs cross the line and actually need to know specifics and control
things are a finer grained level, when you cross this line the
learning curve does unfortunately shoot up.

Robert.


------------------------------

Message: 12
Date: Thu, 3 Jan 2008 11:46:09 +0000
From: "Robert Osfield" <robert.osfield at gmail.com>
Subject: Re: [osg-users] osgViewer SCENE_STATS
To: "OpenSceneGraph Users" <osg-users at lists.openscenegraph.org>
Message-ID:
	<7ffb8e9b0801030346u32fdf815n29b549df68b8e45 at mail.gmail.com>
Content-Type: text/plain; charset=ISO-8859-1

Hi Alberto,

On Jan 3, 2008 11:11 AM, Alberto Nortes <no3productionz at gmail.com> wrote:
> Hello and happy new year to everyone!
>
> I just want to know if it would be possible to retrieve the old
> osgProducer SCENE_STATS in osgViewer. I know  actually we dont have code
> for this functionality, so what would be the first steps (examples,
> guidelines...) to get the same data using osgViewer?
>
> thanks very much, and best wishes!

There has been a submission to osg-submissions that added various
extra stats features to osgViewer, these even went beyond what
osgProducer has.  I have reviewed the submission but for now have
rejected as there were too many intrusive changes to the core OSG that
I felt were an inappropriate way to tackle the problem in hand i.e.
stats in the viewer classes should be part of the viewer library.
This submission might help suggest things to you.

I would like to see further improvements to the stats support in
osgViewer.  I'm still working on other tasks so can't put the
necessary time in myself yet, I would like to see these features
restored for 2.4 though.

Robert.


------------------------------

Message: 13
Date: Wed, 2 Jan 2008 15:33:40 +0000 (UTC)
From: Andreas Vox <avox at scribus.info>
Subject: Re: [osg-users] OSX installation changes
To: osg-users at lists.openscenegraph.org
Message-ID: <loom.20080102T153141-280 at post.gmane.org>
Content-Type: text/plain; charset=us-ascii

E. Wing <ewmailing at ...> writes:

> 
> I only intend to do the dmg/drag-and-drop release. It's extremely well
> documented and even has screencasts now. Somebody else did the
> installer but I don't think there are concrete plans to continue it.
> 
> Newbies should understand the concepts discussed in the screencasts,
> installer or not.

I installed the 2.2 release, but now I'm looking for the wrappers
(I want to try out osgLua). Are they not included in the OSX install?

/Andreas






------------------------------

Message: 14
Date: Thu, 3 Jan 2008 11:38:50 -0200
From: "Renan Mendes" <renanmzmendes at gmail.com>
Subject: Re: [osg-users] Error: 'Debug Assertion Failure!'
To: "OpenSceneGraph Users" <osg-users at lists.openscenegraph.org>
Message-ID:
	<295c75220801030538j5db32b44hc199d9db00da2b7 at mail.gmail.com>
Content-Type: text/plain; charset="iso-8859-1"

Hi, Rafa.

    I'll try and do that. Thanks.

                    Renan M Z Mendes
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.openscenegraph.org/pipermail/osg-users-openscenegraph.org/attachments/20080103/f9c7f3f0/attachment-0001.html 

------------------------------

Message: 15
Date: Thu, 3 Jan 2008 12:42:33 -0200
From: "Renan Mendes" <renanmzmendes at gmail.com>
Subject: Re: [osg-users] Error: 'Debug Assertion Failure!'
To: "OpenSceneGraph Users" <osg-users at lists.openscenegraph.org>
Message-ID:
	<295c75220801030642l317f5587ue8d7b68bd4edd5e2 at mail.gmail.com>
Content-Type: text/plain; charset="iso-8859-1"

Hi, Rafa,

        I've tried doing something like what you've said before: every time
before I checked for selections with verifySelection(), I searched for a
NULL member and erased it, like it's done below. Can you tell me why it
still isn't working? Is there a logical flaw in my code?

       Thanks,
           Renan M Z Mendes

        case(osgGA::GUIEventAdapter::KEYDOWN):
            {
                if(!ponto.empty())
                {
                    for(ponto_limp = ponto.begin(); ponto_limp != ponto.end();
ponto_limp++)
                    {
                        if(*ponto_limp == NULL)
                        {
                            ponto.erase(ponto_limp);
                        }
                    }

                    for(ponto_itr = ponto.begin(); ponto_itr != ponto.end();
ponto_itr++)
                    {
                        if((*ponto_itr)->verifySelection())
                        {
                            switch(ea.getKey())
                            {
                            case(ea.KEY_Delete):
                                {
                                    osg::Group* root =
(*ponto_itr)->getParent(0);

root->removeChild(root->getChildIndex((*ponto_itr)), 1);
                                }
                            }
                        }
                    }
                }
           }
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.openscenegraph.org/pipermail/osg-users-openscenegraph.org/attachments/20080103/bb4dab0f/attachment-0001.htm 

------------------------------

Message: 16
Date: Thu, 3 Jan 2008 16:08:04 -0000
From: "Gordon Tomlinson" <gordon at gordon-tomlinson.com>
Subject: Re: [osg-users] Error: 'Debug Assertion Failure!'
To: "'OpenSceneGraph Users'" <osg-users at lists.openscenegraph.org>
Message-ID:
	<!&!AAAAAAAAAAAYAAAAAAAAAFtXL6rImltBiRq+OnsD4FHCgAAAEAAAAGxmZqYT/tVOrWqcONSXS6YBAAAAAA==@gordon-tomlinson.com>
	
Content-Type: text/plain; charset="us-ascii"

I think you need to set your  (*ponto_itr) to NULL or remove it from the
vector after you have done the remove child, other wise the pointer still
has the address of the child you previously removed so you for loop above
(ponto_limp) will never do any thing
 
 
 

__________________________________________________________
Gordon Tomlinson 

Email   : gordon at GordonTomlinson.com
Website : www.vis-sim.com www.gordontomlinson.com 


__________________________________________________________

"Self defence is not a function of learning tricks 
but is a function of how quickly and intensely one 
can arouse one's instinct for survival" 
-Master Tambo Tetsura 

 

  _____  

From: osg-users-bounces at lists.openscenegraph.org
[mailto:osg-users-bounces at lists.openscenegraph.org] On Behalf Of Renan
Mendes
Sent: 03 January 2008 14:43
To: OpenSceneGraph Users
Subject: [Norton AntiSpam] Re: [osg-users] Error: 'Debug Assertion Failure!'


Hi, Rafa,

        I've tried doing something like what you've said before: every time
before I checked for selections with verifySelection(), I searched for a
NULL member and erased it, like it's done below. Can you tell me why it
still isn't working? Is there a logical flaw in my code? 

       Thanks,
           Renan M Z Mendes

        case(osgGA::GUIEventAdapter::KEYDOWN):
            {
                if(!ponto.empty())
                {
                    for(ponto_limp = ponto.begin(); ponto_limp !=
ponto.end(); ponto_limp++)
                    {
                        if(*ponto_limp == NULL)
                        {
                            ponto.erase(ponto_limp);
                        } 
                    }

                    for(ponto_itr = ponto.begin(); ponto_itr != ponto.end();
ponto_itr++)
                    {
                        if((*ponto_itr)->verifySelection())
                        { 
                            switch(ea.getKey())
                            {
                            case(ea.KEY_Delete):
                                {
                                    osg::Group* root =
(*ponto_itr)->getParent(0); 
 
root->removeChild(root->getChildIndex((*ponto_itr)), 1);
                                }
                            }
                        }
                    } 
                }
           }

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.openscenegraph.org/pipermail/osg-users-openscenegraph.org/attachments/20080103/1caa8f61/attachment.html 

------------------------------

_______________________________________________
osg-users mailing list
osg-users at lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


End of osg-users Digest, Vol 7, Issue 5
***************************************
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.openscenegraph.org/pipermail/osg-users-openscenegraph.org/attachments/20080106/d67b5987/attachment-0001.htm 


More information about the osg-users mailing list