Logo ROOT  
Reference Guide
TPointSet3DGL.cxx
Go to the documentation of this file.
1 // @(#)root/gl:$Id$
2 // Author: Matevz Tadel 7/4/2006
3 
4 /*************************************************************************
5  * Copyright (C) 1995-2006, Rene Brun and Fons Rademakers. *
6  * All rights reserved. *
7  * *
8  * For the licensing terms see $ROOTSYS/LICENSE. *
9  * For the list of contributors see $ROOTSYS/README/CREDITS. *
10  *************************************************************************/
11 
12 #ifdef WIN32
13 #include "Windows4root.h"
14 #endif
15 
16 #include "TPointSet3DGL.h"
17 #include "TPointSet3D.h"
18 
19 #include <TGLRnrCtx.h>
20 #include <TGLSelectRecord.h>
21 #include <TGLIncludes.h>
22 
23 /** \class TPointSet3DGL
24 \ingroup opengl
25 Direct OpenGL renderer for TPointSet3D.
26 */
27 
29 
30 ////////////////////////////////////////////////////////////////////////////////
31 /// Set model.
32 
34 {
36 }
37 
38 ////////////////////////////////////////////////////////////////////////////////
39 /// Set bounding-box.
40 
42 {
43  SetAxisAlignedBBox(((TPointSet3D*)fExternalObj)->AssertBBox());
44 }
45 
46 ////////////////////////////////////////////////////////////////////////////////
47 /// Override from TGLLogicalShape.
48 /// To account for large point-sizes we modify the projection matrix
49 /// during selection and thus we need a direct draw.
50 
52 {
53  if (rnrCtx.Selection())
54  return kFALSE;
55  return TGLObject::ShouldDLCache(rnrCtx);
56 }
57 
58 ////////////////////////////////////////////////////////////////////////////////
59 /// Draw function for TPointSet3D. Skips line-pass of outline mode.
60 
61 void TPointSet3DGL::Draw(TGLRnrCtx& rnrCtx) const
62 {
63  if (rnrCtx.IsDrawPassOutlineLine())
64  return;
65 
66  TGLObject::Draw(rnrCtx);
67 }
68 
69 ////////////////////////////////////////////////////////////////////////////////
70 /// Direct GL rendering for TPointSet3D.
71 
73 {
74  //printf("TPointSet3DGL::DirectDraw Style %d, LOD %d\n", rnrCtx.Style(), rnrCtx.LOD());
75  //printf(" sel=%d, secsel=%d\n", rnrCtx.Selection(), rnrCtx.SecSelection());
76 
78 
79  TGLUtil::LockColor(); // Keep color from TGLPhysicalShape.
80  TGLUtil::RenderPolyMarkers(q, 0, q.GetP(), q.Size(),
81  rnrCtx.GetPickRadius(),
82  rnrCtx.Selection(),
83  rnrCtx.SecSelection());
85 }
86 
87 ////////////////////////////////////////////////////////////////////////////////
88 /// Processes secondary selection from TGLViewer.
89 /// Calls TPointSet3D::PointSelected(Int_t) with index of selected
90 /// point as an argument.
91 
93 {
94  if (rec.GetN() < 2) return;
96  q.PointSelected(rec.GetItem(1));
97 }
TPointSet3DGL::SetModel
virtual Bool_t SetModel(TObject *obj, const Option_t *opt=0)
Set model.
Definition: TPointSet3DGL.cxx:33
Option_t
const char Option_t
Definition: RtypesCore.h:66
TPointSet3DGL
Direct OpenGL renderer for TPointSet3D.
Definition: TPointSet3DGL.h:21
TGLObject::SetModelCheckClass
Bool_t SetModelCheckClass(TObject *obj, TClass *cls)
Checks if obj is of proper class and sets the model.
Definition: TGLObject.cxx:71
ClassImp
#define ClassImp(name)
Definition: Rtypes.h:364
TGLObject::ShouldDLCache
virtual Bool_t ShouldDLCache(const TGLRnrCtx &rnrCtx) const
Decide if display-list should be used for this pass rendering, as determined by rnrCtx.
Definition: TGLObject.cxx:41
TGLLogicalShape::fExternalObj
TObject * fExternalObj
first replica
Definition: TGLLogicalShape.h:49
TGLRnrCtx::IsDrawPassOutlineLine
Bool_t IsDrawPassOutlineLine() const
Definition: TGLRnrCtx.h:207
TPointSet3DGL::Draw
virtual void Draw(TGLRnrCtx &rnrCtx) const
Draw function for TPointSet3D. Skips line-pass of outline mode.
Definition: TPointSet3DGL.cxx:61
bool
q
float * q
Definition: THbookFile.cxx:89
TPointSet3D
TPolyMarker3D using TPointSet3DGL for direct OpenGL rendering.
Definition: TPointSet3D.h:22
TGLSelectRecordBase::GetItem
UInt_t GetItem(Int_t i) const
Definition: TGLSelectRecord.h:56
TGLUtil::RenderPolyMarkers
static void RenderPolyMarkers(const TAttMarker &marker, Char_t transp, Float_t *p, Int_t n, Int_t pick_radius=0, Bool_t selection=kFALSE, Bool_t sec_selection=kFALSE)
Render polymarkers at points specified by p-array.
Definition: TGLUtil.cxx:1974
TPointSet3DGL::DirectDraw
virtual void DirectDraw(TGLRnrCtx &rnrCtx) const
Direct GL rendering for TPointSet3D.
Definition: TPointSet3DGL.cxx:72
TGLRnrCtx.h
TPointSet3DGL::ShouldDLCache
virtual Bool_t ShouldDLCache(const TGLRnrCtx &rnrCtx) const
Override from TGLLogicalShape.
Definition: TPointSet3DGL.cxx:51
TGLLogicalShape::Draw
virtual void Draw(TGLRnrCtx &rnrCtx) const
Draw the GL drawable, using draw flags.
Definition: TGLLogicalShape.cxx:374
TGLSelectRecord
Standard selection record including information about containing scene and details ob out selected ob...
Definition: TGLSelectRecord.h:75
TGLSelectRecordBase::GetN
Int_t GetN() const
Definition: TGLSelectRecord.h:54
kFALSE
const Bool_t kFALSE
Definition: RtypesCore.h:92
TPointSet3DGL::SetBBox
virtual void SetBBox()
Set bounding-box.
Definition: TPointSet3DGL.cxx:41
TGLRnrCtx::Selection
Bool_t Selection() const
Definition: TGLRnrCtx.h:222
TPointSet3D.h
TGLObject::SetAxisAlignedBBox
void SetAxisAlignedBBox(Float_t xmin, Float_t xmax, Float_t ymin, Float_t ymax, Float_t zmin, Float_t zmax)
Set axis-aligned bounding-box.
Definition: TGLObject.cxx:86
TGLRnrCtx::SecSelection
Bool_t SecSelection() const
Definition: TGLRnrCtx.h:224
TGLUtil::LockColor
static UInt_t LockColor()
Prevent further color changes.
Definition: TGLUtil.cxx:1663
TObject
Mother of all ROOT objects.
Definition: TObject.h:37
TGLSelectRecord.h
TPointSet3DGL.h
TPointSet3DGL::ProcessSelection
virtual void ProcessSelection(TGLRnrCtx &rnrCtx, TGLSelectRecord &rec)
Processes secondary selection from TGLViewer.
Definition: TPointSet3DGL.cxx:92
Class
void Class()
Definition: Class.C:29
TGLRnrCtx
The TGLRnrCtx class aggregates data for a given redering context as needed by various parts of the RO...
Definition: TGLRnrCtx.h:41
TGLUtil::UnlockColor
static UInt_t UnlockColor()
Allow color changes.
Definition: TGLUtil.cxx:1671
TGLRnrCtx::GetPickRadius
Int_t GetPickRadius()
Return pick radius. If selection is not active it returns 0.
Definition: TGLRnrCtx.cxx:255