ROOT logo
// @(#)root/gl:$Id: TGLPolyLine.cxx 29676 2009-08-04 16:18:07Z matevz $
// Author:  Timur Pocheptsov  03/08/2004
// NOTE: This code moved from obsoleted TGLSceneObject.h / .cxx - see these
// attic files for previous CVS history

/*************************************************************************
 * Copyright (C) 1995-2006, Rene Brun and Fons Rademakers.               *
 * All rights reserved.                                                  *
 *                                                                       *
 * For the licensing terms see $ROOTSYS/LICENSE.                         *
 * For the list of contributors see $ROOTSYS/README/CREDITS.             *
 *************************************************************************/
#include "TGLPolyLine.h"
#include "TGLRnrCtx.h"
#include "TGLIncludes.h"
#include "TGLUtil.h"

#include "TBuffer3D.h"
#include "TBuffer3DTypes.h"
#include "TAttLine.h"

// For debug tracing
#include "TClass.h"
#include "TError.h"

//______________________________________________________________________________
/* Begin_Html
<center><h2>GL Polyline</h2></center>
To draw a 3D polyline in a GL window.
End_Html */

ClassImp(TGLPolyLine)

//______________________________________________________________________________
TGLPolyLine::TGLPolyLine(const TBuffer3D & buffer) :
   TGLLogicalShape(buffer),
   fVertices(buffer.fPnts, buffer.fPnts + 3 * buffer.NbPnts()),
   fLineWidth(1.)
{
   // constructor
   //dynamic_cast because of multiple inheritance.
   if (TAttLine *lineAtt = dynamic_cast<TAttLine *>(buffer.fID))
      fLineWidth = lineAtt->GetLineWidth();
}


//______________________________________________________________________________
void TGLPolyLine::DirectDraw(TGLRnrCtx & rnrCtx) const
{
   // Debug tracing
   if (gDebug > 4) {
      Info("TGLPolyLine::DirectDraw", "this %d (class %s) LOD %d", this, IsA()->GetName(), rnrCtx.ShapeLOD());
   }

   if (rnrCtx.DrawPass() == TGLRnrCtx::kPassOutlineLine)
      return;

   Double_t oldWidth = 1.;
   glGetDoublev(GL_LINE_WIDTH, &oldWidth);

   TGLUtil::LineWidth(fLineWidth);

   glBegin(GL_LINE_STRIP);

   for (UInt_t i = 0; i < fVertices.size(); i += 3)
      glVertex3d(fVertices[i], fVertices[i + 1], fVertices[i + 2]);

   glEnd();

   glLineWidth(oldWidth);
}
 TGLPolyLine.cxx:1
 TGLPolyLine.cxx:2
 TGLPolyLine.cxx:3
 TGLPolyLine.cxx:4
 TGLPolyLine.cxx:5
 TGLPolyLine.cxx:6
 TGLPolyLine.cxx:7
 TGLPolyLine.cxx:8
 TGLPolyLine.cxx:9
 TGLPolyLine.cxx:10
 TGLPolyLine.cxx:11
 TGLPolyLine.cxx:12
 TGLPolyLine.cxx:13
 TGLPolyLine.cxx:14
 TGLPolyLine.cxx:15
 TGLPolyLine.cxx:16
 TGLPolyLine.cxx:17
 TGLPolyLine.cxx:18
 TGLPolyLine.cxx:19
 TGLPolyLine.cxx:20
 TGLPolyLine.cxx:21
 TGLPolyLine.cxx:22
 TGLPolyLine.cxx:23
 TGLPolyLine.cxx:24
 TGLPolyLine.cxx:25
 TGLPolyLine.cxx:26
 TGLPolyLine.cxx:27
 TGLPolyLine.cxx:28
 TGLPolyLine.cxx:29
 TGLPolyLine.cxx:30
 TGLPolyLine.cxx:31
 TGLPolyLine.cxx:32
 TGLPolyLine.cxx:33
 TGLPolyLine.cxx:34
 TGLPolyLine.cxx:35
 TGLPolyLine.cxx:36
 TGLPolyLine.cxx:37
 TGLPolyLine.cxx:38
 TGLPolyLine.cxx:39
 TGLPolyLine.cxx:40
 TGLPolyLine.cxx:41
 TGLPolyLine.cxx:42
 TGLPolyLine.cxx:43
 TGLPolyLine.cxx:44
 TGLPolyLine.cxx:45
 TGLPolyLine.cxx:46
 TGLPolyLine.cxx:47
 TGLPolyLine.cxx:48
 TGLPolyLine.cxx:49
 TGLPolyLine.cxx:50
 TGLPolyLine.cxx:51
 TGLPolyLine.cxx:52
 TGLPolyLine.cxx:53
 TGLPolyLine.cxx:54
 TGLPolyLine.cxx:55
 TGLPolyLine.cxx:56
 TGLPolyLine.cxx:57
 TGLPolyLine.cxx:58
 TGLPolyLine.cxx:59
 TGLPolyLine.cxx:60
 TGLPolyLine.cxx:61
 TGLPolyLine.cxx:62
 TGLPolyLine.cxx:63
 TGLPolyLine.cxx:64
 TGLPolyLine.cxx:65
 TGLPolyLine.cxx:66
 TGLPolyLine.cxx:67
 TGLPolyLine.cxx:68
 TGLPolyLine.cxx:69
 TGLPolyLine.cxx:70
 TGLPolyLine.cxx:71