00001 // @(#)root/eve:$Id: TEveLineGL.cxx 36384 2010-10-20 14:26:41Z matevz $ 00002 // Authors: Matevz Tadel & Alja Mrak-Tadel: 2006, 2007 00003 00004 /************************************************************************* 00005 * Copyright (C) 1995-2007, Rene Brun and Fons Rademakers. * 00006 * All rights reserved. * 00007 * * 00008 * For the licensing terms see $ROOTSYS/LICENSE. * 00009 * For the list of contributors see $ROOTSYS/README/CREDITS. * 00010 *************************************************************************/ 00011 00012 #include "TEveLineGL.h" 00013 #include "TEveLine.h" 00014 00015 #include "TGLRnrCtx.h" 00016 #include "TGLIncludes.h" 00017 00018 //============================================================================== 00019 //============================================================================== 00020 // TEveLineGL 00021 //============================================================================== 00022 00023 //______________________________________________________________________________ 00024 // 00025 // GL-renderer for TEveLine class. 00026 00027 ClassImp(TEveLineGL); 00028 00029 //______________________________________________________________________________ 00030 TEveLineGL::TEveLineGL() : TPointSet3DGL(), fM(0) 00031 { 00032 // Constructor. 00033 00034 // fDLCache = false; // Disable display list. 00035 fMultiColor = kTRUE; 00036 } 00037 00038 /******************************************************************************/ 00039 00040 //______________________________________________________________________________ 00041 Bool_t TEveLineGL::SetModel(TObject* obj, const Option_t* /*opt*/) 00042 { 00043 // Set model object. 00044 00045 fM = SetModelDynCast<TEveLine>(obj); 00046 return kTRUE; 00047 } 00048 00049 /******************************************************************************/ 00050 00051 //______________________________________________________________________________ 00052 void TEveLineGL::DirectDraw(TGLRnrCtx & rnrCtx) const 00053 { 00054 // Direct GL rendering for TEveLine. 00055 00056 // printf("TEveLineGL::DirectDraw Style %d, LOD %d\n", rnrCtx.Style(), rnrCtx.LOD()); 00057 00058 TEveLine& q = *fM; 00059 if (q.Size() <= 0) return; 00060 00061 TGLUtil::LockColor(); // Keep color from TGLPhysicalShape. 00062 if (q.fRnrLine) { 00063 TGLCapabilityEnabler sw_smooth(GL_LINE_SMOOTH, q.fSmooth); 00064 TGLCapabilityEnabler sw_blend(GL_BLEND, q.fSmooth); 00065 TGLUtil::RenderPolyLine(q, q.GetMainTransparency(), q.GetP(), q.Size()); 00066 } 00067 TGLUtil::UnlockColor(); 00068 if (q.fRnrPoints) { 00069 TGLUtil::RenderPolyMarkers(q, 0,q.GetP(), q.Size(), 00070 rnrCtx.GetPickRadius(), 00071 rnrCtx.Selection()); 00072 } 00073 }