Hello Thomas,

On 05/19/2011 08:37 AM, Henn, Thomas wrote:
I'm trying to draw a geometry using two different materials. While a plane 
intersects the geometry into two halves, the materials should be applied to 
these two half geometries. As I don't want to duplicate my geometry, I tried to 
solve this with a MultiPassMaterial. So I defined two materials with two 
ClipPlaneChunks having different plane definitions and added them to the 
MultiPassMaterial.

Although the geometry is rendered twice using both material's color 
information, only the second clip plane definition is used for both rendering 
passes.

Might this be a bug or did I hit any OpenGL specific limitation?

i think it's a bug in ClipPlaneChunk::changeFrom, it is a bit too aggressive in trying to avoid unnecessary state changes and does not consider the case that old and new chunk may both be enabled and have the same beacon but a different plane equation.
Can you try the attached patch and see if that fixes it?

It's unclear to me how MultiPassMaterial works exactly.

it just renders the geometry once for each pass with that pass' material, nothing fancy ;)

        Cheers,
                Carsten
Index: Source/System/State/OSGClipPlaneChunk.cpp
===================================================================
RCS file: /cvsroot/opensg/OpenSG/Source/System/State/OSGClipPlaneChunk.cpp,v
retrieving revision 1.9
diff -u -r1.9 OSGClipPlaneChunk.cpp
--- Source/System/State/OSGClipPlaneChunk.cpp   9 Jun 2008 07:30:42 -0000       
1.9
+++ Source/System/State/OSGClipPlaneChunk.cpp   19 May 2011 14:20:12 -0000
@@ -217,8 +217,9 @@
 
     cameraMat.mult(beaconMat);
 
-    if(getEnable() != old->getEnable() ||
-       getBeacon() != old->getBeacon())
+    if(getEquation() != old->getEquation() ||
+       getEnable  () != old->getEnable  () ||
+       getBeacon  () != old->getBeacon  ()   )
     {
         if(getEnable())
         {
------------------------------------------------------------------------------
What Every C/C++ and Fortran developer Should Know!
Read this article and learn how Intel has extended the reach of its 
next-generation tools to help Windows* and Linux* C/C++ and Fortran 
developers boost performance applications - including clusters. 
http://p.sf.net/sfu/intel-dev2devmay
_______________________________________________
Opensg-users mailing list
Opensg-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/opensg-users

Reply via email to