00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013 #include "TGLPolyLine.h"
00014 #include "TGLRnrCtx.h"
00015 #include "TGLIncludes.h"
00016 #include "TGLUtil.h"
00017
00018 #include "TBuffer3D.h"
00019 #include "TBuffer3DTypes.h"
00020 #include "TAttLine.h"
00021
00022
00023 #include "TClass.h"
00024 #include "TError.h"
00025
00026
00027
00028
00029
00030
00031
00032 ClassImp(TGLPolyLine)
00033
00034
00035 TGLPolyLine::TGLPolyLine(const TBuffer3D & buffer) :
00036 TGLLogicalShape(buffer),
00037 fVertices(buffer.fPnts, buffer.fPnts + 3 * buffer.NbPnts()),
00038 fLineWidth(1.)
00039 {
00040
00041
00042 if (TAttLine *lineAtt = dynamic_cast<TAttLine *>(buffer.fID))
00043 fLineWidth = lineAtt->GetLineWidth();
00044 }
00045
00046
00047
00048 void TGLPolyLine::DirectDraw(TGLRnrCtx & rnrCtx) const
00049 {
00050
00051 if (gDebug > 4) {
00052 Info("TGLPolyLine::DirectDraw", "this %ld (class %s) LOD %d", (Long_t)this, IsA()->GetName(), rnrCtx.ShapeLOD());
00053 }
00054
00055 if (rnrCtx.DrawPass() == TGLRnrCtx::kPassOutlineLine)
00056 return;
00057
00058 Double_t oldWidth = 1.;
00059 glGetDoublev(GL_LINE_WIDTH, &oldWidth);
00060
00061 TGLUtil::LineWidth(fLineWidth);
00062
00063 glBegin(GL_LINE_STRIP);
00064
00065 for (UInt_t i = 0; i < fVertices.size(); i += 3)
00066 glVertex3d(fVertices[i], fVertices[i + 1], fVertices[i + 2]);
00067
00068 glEnd();
00069
00070 glLineWidth(oldWidth);
00071 }