From 2cf2193bd81fe387b4339b699f2e33b3091bbac9 Mon Sep 17 00:00:00 2001
From: Matevz Tadel <matevz.tadel@cern.ch>
Date: Fri, 20 Jun 2008 17:52:37 +0000
Subject: [PATCH] TGLRnrCtx --------- Add new member 'Bool_t fHighlightOutline'
 that is set during the outline-pass of the highlight.

TGLObject
---------
Disable use of display-lists for multi-colored objects only in the
outline pass of the highlight.

TGLPhysicalShape
----------------
Set HighlightOutline and HighlightOutline of the rnr-ctx during highlight.


git-svn-id: http://root.cern.ch/svn/root/trunk@24444 27541ba8-7e3a-0410-8455-c3a389f83636
---
 graf3d/gl/inc/TGLRnrCtx.h          | 6 +++++-
 graf3d/gl/src/TGLObject.cxx        | 2 +-
 graf3d/gl/src/TGLPhysicalShape.cxx | 4 +++-
 graf3d/gl/src/TGLRnrCtx.cxx        | 5 ++---
 4 files changed, 11 insertions(+), 6 deletions(-)

diff --git a/graf3d/gl/inc/TGLRnrCtx.h b/graf3d/gl/inc/TGLRnrCtx.h
index 60881fc8533..750d3799808 100644
--- a/graf3d/gl/inc/TGLRnrCtx.h
+++ b/graf3d/gl/inc/TGLRnrCtx.h
@@ -104,7 +104,8 @@ protected:
    Bool_t          fHasTimedOut;
 
    // Highlight / Selection stuff
-   Bool_t          fHighlight;
+   Bool_t          fHighlight;        // True when in highlight.
+   Bool_t          fHighlightOutline; // True when in highlight-outline.
    Bool_t          fSelection;
    Bool_t          fSecSelection;
    Int_t           fPickRadius;
@@ -186,6 +187,9 @@ public:
    // Highlight / Selection stuff
    Bool_t  Highlight()    const           { return fHighlight;      }
    void    SetHighlight(Bool_t hil)       { fHighlight = hil;       }
+   Bool_t  HighlightOutline() const       { return fHighlightOutline; }
+   void    SetHighlightOutline(Bool_t ho) { fHighlightOutline = ho;   }
+
    Bool_t  Selection()    const           { return fSelection;      }
    void    SetSelection(Bool_t sel)       { fSelection = sel;       }
    Bool_t  SecSelection() const           { return fSecSelection;   }
diff --git a/graf3d/gl/src/TGLObject.cxx b/graf3d/gl/src/TGLObject.cxx
index ed728ad9699..c729f6587a7 100644
--- a/graf3d/gl/src/TGLObject.cxx
+++ b/graf3d/gl/src/TGLObject.cxx
@@ -48,7 +48,7 @@ Bool_t TGLObject::ShouldDLCache(const TGLRnrCtx & rnrCtx) const
    if (!fDLCache ||
        !fScene   ||
        (rnrCtx.SecSelection() && SupportsSecondarySelect()) ||
-       (fMultiColor && (rnrCtx.Highlight() || rnrCtx.IsDrawPassOutlineLine())))
+       (fMultiColor && (rnrCtx.HighlightOutline() || rnrCtx.IsDrawPassOutlineLine())))
    {
       return kFALSE;
    }
diff --git a/graf3d/gl/src/TGLPhysicalShape.cxx b/graf3d/gl/src/TGLPhysicalShape.cxx
index b4b80eb1c28..429e83058ca 100644
--- a/graf3d/gl/src/TGLPhysicalShape.cxx
+++ b/graf3d/gl/src/TGLPhysicalShape.cxx
@@ -382,6 +382,7 @@ void TGLPhysicalShape::Draw(TGLRnrCtx & rnrCtx) const
       // TGLCapabilitySwitch bs(GL_BLEND, kTRUE), lss(GL_LINE_SMOOTH, kTRUE);
 
       rnrCtx.SetHighlight(kTRUE);
+      rnrCtx.SetHighlightOutline(kTRUE);
       TGLUtil::LockColor();
       Int_t first_outer = (rnrCtx.CombiLOD() == TGLRnrCtx::kLODHigh) ? 0 : 4;
       for (int i = first_outer; i < 8; ++i)
@@ -391,7 +392,7 @@ void TGLPhysicalShape::Draw(TGLRnrCtx & rnrCtx) const
          fLogicalShape->Draw(rnrCtx);
       }
       TGLUtil::UnlockColor();
-      rnrCtx.SetHighlight(kFALSE);
+      rnrCtx.SetHighlightOutline(kFALSE);
 
       SetupGLColors(rnrCtx);
       for (int i = 0; i < 4; ++i)
@@ -401,6 +402,7 @@ void TGLPhysicalShape::Draw(TGLRnrCtx & rnrCtx) const
          fLogicalShape->Draw(rnrCtx);
       }
       glViewport(vp.X(), vp.Y(), vp.Width(), vp.Height());
+      rnrCtx.SetHighlight(kFALSE);
 
       SetupGLColors(rnrCtx);
       Float_t dr[2];
diff --git a/graf3d/gl/src/TGLRnrCtx.cxx b/graf3d/gl/src/TGLRnrCtx.cxx
index 5e2a1996e3a..29ff34098ff 100644
--- a/graf3d/gl/src/TGLRnrCtx.cxx
+++ b/graf3d/gl/src/TGLRnrCtx.cxx
@@ -74,9 +74,8 @@ TGLRnrCtx::TGLRnrCtx(TGLViewerBase* viewer) :
    fIsRunning    (kFALSE),
    fHasTimedOut  (kFALSE),
 
-   fHighlight    (kFALSE),
-   fSelection    (kFALSE),
-   fSecSelection (kFALSE),
+   fHighlight    (kFALSE),  fHighlightOutline (kFALSE),
+   fSelection    (kFALSE),  fSecSelection     (kFALSE),
    fPickRadius   (0),
    fPickRectangle(0),
    fSelectBuffer (0),
-- 
GitLab