#include "TGLPolyLine.h"
#include "TGLRnrCtx.h"
#include "TGLIncludes.h"
#include "TGLUtil.h"
#include "TBuffer3D.h"
#include "TBuffer3DTypes.h"
#include "TAttLine.h"
#include "TClass.h"
#include "TError.h"
ClassImp(TGLPolyLine)
TGLPolyLine::TGLPolyLine(const TBuffer3D & buffer) :
TGLLogicalShape(buffer),
fVertices(buffer.fPnts, buffer.fPnts + 3 * buffer.NbPnts()),
fLineWidth(1.)
{
if (TAttLine *lineAtt = dynamic_cast<TAttLine *>(buffer.fID))
fLineWidth = lineAtt->GetLineWidth();
}
void TGLPolyLine::DirectDraw(TGLRnrCtx & rnrCtx) const
{
if (gDebug > 4) {
Info("TGLPolyLine::DirectDraw", "this %ld (class %s) LOD %d", (Long_t)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);
}