[osg-users] Can I add more then one ClipNodeBox to a scene?

Karl Karsten kkarsten62 at yahoo.de
Tue Sep 16 04:46:49 PDT 2008

Hello Robert,

many thanks for the detailed explanation. I have solved my problem now by using ONE ClipNode and a ClipPlaneList where I store my planes from the other boxes. Then I switch the 6 packs of planes by using a Qt Combobox. This works fine for me for the time being.
Now I will go on to discover the switch functionality. I will check the CullCallback functionality later on.

Thanks again.

Karl ...


Hi Karl,

glClipPlane (and associated osg::ClipPlane) are positional state,
which means that the modelview matrix which is current when glClipLane
is called affects the setting down on the GPU of the associated
parameters, this is very different from most OpenGL state that is
totally unaffected by modelview matrix.  The consequence of being
positional state is that the OSG has to tightly control the modelview
matrix before the osg::ClipPlane is called, so that the plane goes in
the correct place rather than jump around randomly as would be the
cause if you just allow state sorting to do its work with any old
modelview matrix being applied.

To control the modelview matrix for clip planes the OSG has a special
node osg::ClipNode, which tells cull traversal to build a rendering
backend that binds the modelview matrix, inherited down to the
ClipNode, with the clip planes associated with the ClipNode; and then
during the draw traversal all the positional state for each
RenderiStage is applied together so that they are all placed in their
correct positions.

While this system does solve the problem of placing positional state
correctly in the scene it does mean that each clip plane can only have
one position per stage in the draw traversal - which is why you are
seeing only one ClipNode active.  To be able to multiple ClipNode you
either need to keep the clip plane numbers distinct (which is limited
because OpenGL only supports a small number of clip planes (typically
just 8), or for you to set up your scene graph so that each ClipNode
subgraph is placed in its own RenderStage - for this you'll need to
write a CullCallback.


On Sun, Sep 14, 2008 at 7:33 PM, Karl Karsten <[EMAIL PROTECTED]> wrote:
> Hello,
> I am still a newbie and I am just coding around ClipNode Boxes. My intention
> is to have multiple ClipNode Boxes in a scene.
> I try to extend the osgclip example with a simple second box. Now my problem
> is that only the last ClipNodeBox will taken into account.
> Can have I have more than one ClipNodeBox  in a scene?
> If yes does anybody have an example code?
> Many thanks for a  help .
> Best regards
> Karl ...
> ...
> //Code from osgclip.cpp
>     osg::ClipNode* clipnode = new osg::ClipNode;
>     osg::BoundingSphere bs = subgraph->getBound();
>     bs.radius()*= 0.4f;
>     osg::BoundingBox bb;
>     bb.expandBy(bs);
>     clipnode->createClipBox(bb);
>     clipnode->setCullingActive(false);
>     transform->addChild(clipnode);
>     rootnode->addChild(transform);
>     // create clipped part.
>     osg::Group* clipped_subgraph = new osg::Group;
>     clipped_subgraph->setStateSet(clipnode->getStateSet());
>     clipped_subgraph->addChild(subgraph);
>     rootnode->addChild(clipped_subgraph);
> // My extension code for a 2nd ClipNodeBox
>     osg::ClipNode * clipNode2 = new osg::ClipNode;
>     clipNode2->createClipBox(osg::BoundingBox(-5, -5, -5, -3, 5, 5));
>     clipNode2->setCullingActive(false);
>     rootnode->addChild(clipNode2);
>     osg::Group* clipped_subgraph2 = new osg::Group;
>     clipped_subgraph2->setStateSet(clipNode2->getStateSet());
>     clipped_subgraph2->addChild(subgraph);
>     rootnode->addChild(clipped_subgraph2);
> ...
> osg-users mailing list
> osg-users at lists.openscenegraph.org
> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

 Babylon English-English 
prep. in, on, near; indicating time or location; toward 

AT (anti-tank) 
designed for use against tanks or other armored vehicles 

AT (Advanced Technology) 
model of IBM PC introduced in 1984 

 Wikipedia English - The Free Encycl... 
AT may mean:
	* AT Field, a force field in the anime Neon Genesis Evangelion
	* Acceptance test
	* Aero triangulation
	* Alimentary tract
	* Allied Telesyn
	* Atmel Corporation
	* Anaerobic threshold
	* Análisis Transaccional (Spanish "Transactional analysis"), a psychological method
	* Anguilla, a World Meteorological Organization country code
	* Anti-tank weapons
	* Counter-terrorism, also known as "anti-terrorism" (AT)
	* Appalachian Trail
	* Aphex Twin
	* Appropriate Technology
	* Ashmore and Cartier Islands (FIPS 10-4 territory code and obsolete NATO country code
	* Assistive technology
	* IBM Personal Computer/AT
	* AT form factor for motherboards and computer cases
	* The common name for the 5-pin DIN keyboard connector
	* Ataxia telangiectasia, an immunodeficiency disorder
	* Atchison County, Kansas (county code)
	* Attack Team (game), a 2000 computer game
	* Audit trail
	* Austria's ISO, 2-letter country code
	* .at is the Internet country code top-level domain for Austria
	* Auto Trend
	* Automatic transmission
	* Aviation Electronics Technician (United States Navy ratings), an enlisted rating in the United States Navy
	* Hayes command set for computer modems (all commands begin with the characters "AT")
	* Royal Air Maroc (IATA airline designator)
	* Abel Tasman, a seventeenth century Dutch explorer and merchant

 See more at Wikipedia.org... 

.at is the Internet country code top-level domain (ccTLD) for Austria. It is administered by NIC.AT.
The .at top-level domain has a number of second-level domains. These are:

	* .gv.at - for governmental institutions
	* .ac.at - for academic and educational institutions (registration is handled by the University of Vienna)
	* .co.at - intended for companies (unrestricted registration)
	* .or.at - intended for organizations (unrestricted registration)

 See more at Wikipedia.org... 

 Babylon German-English 
AT (Altes Testament) 
OT, Old Testament, first division of the Christian Bible; Jewish Bible (including the Law, the Prophets, and the Writings) 

At (Astat) 
AT, astatine, rare radioactive element (Chemistry) 

 Babylon French-English 
AT (Ancien testament) 
Old Testament, first of the two main sections of the Christian Bible (comprised of the 5 books of Moses, the Prophets and the Hagiographa) 

 Babylon Italian-English 
n. @, symbol known as the "at sign" that is used to signify the word "at" (Internet) 

Please support us by using Babylon search engine

Do You Yahoo!?
Sie sind Spam leid? Yahoo! Mail verfügt über einen herausragenden Schutz gegen Massenmails. 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openscenegraph.org/pipermail/osg-users-openscenegraph.org/attachments/20080916/060ed440/attachment-0003.htm>

More information about the osg-users mailing list