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
25Direct OpenGL renderer for TPointSet3D.
26*/
27
29
30////////////////////////////////////////////////////////////////////////////////
31/// Set model.
32
34{
36}
37
38////////////////////////////////////////////////////////////////////////////////
39/// Set bounding-box.
40
42{
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
61void 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}
void Class()
Definition: Class.C:29
const Bool_t kFALSE
Definition: RtypesCore.h:88
bool Bool_t
Definition: RtypesCore.h:59
const char Option_t
Definition: RtypesCore.h:62
#define ClassImp(name)
Definition: Rtypes.h:365
float * q
Definition: THbookFile.cxx:87
virtual void Draw(TGLRnrCtx &rnrCtx) const
Draw the GL drawable, using draw flags.
TObject * fExternalObj
first replica
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
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
Bool_t SetModelCheckClass(TObject *obj, TClass *cls)
Checks if obj is of proper class and sets the model.
Definition: TGLObject.cxx:71
The TGLRnrCtx class aggregates data for a given redering context as needed by various parts of the RO...
Definition: TGLRnrCtx.h:41
Int_t GetPickRadius()
Return pick radius. If selection is not active it returns 0.
Definition: TGLRnrCtx.cxx:257
Bool_t SecSelection() const
Definition: TGLRnrCtx.h:224
Bool_t IsDrawPassOutlineLine() const
Definition: TGLRnrCtx.h:207
Bool_t Selection() const
Definition: TGLRnrCtx.h:222
UInt_t GetItem(Int_t i) const
Int_t GetN() const
Standard selection record including information about containing scene and details ob out selected ob...
static UInt_t LockColor()
Prevent further color changes.
Definition: TGLUtil.cxx:1664
static UInt_t UnlockColor()
Allow color changes.
Definition: TGLUtil.cxx:1672
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:1975
Mother of all ROOT objects.
Definition: TObject.h:37
Direct OpenGL renderer for TPointSet3D.
Definition: TPointSet3DGL.h:21
virtual Bool_t SetModel(TObject *obj, const Option_t *opt=0)
Set model.
virtual Bool_t ShouldDLCache(const TGLRnrCtx &rnrCtx) const
Override from TGLLogicalShape.
virtual void SetBBox()
Set bounding-box.
virtual void ProcessSelection(TGLRnrCtx &rnrCtx, TGLSelectRecord &rec)
Processes secondary selection from TGLViewer.
virtual void DirectDraw(TGLRnrCtx &rnrCtx) const
Direct GL rendering for TPointSet3D.
virtual void Draw(TGLRnrCtx &rnrCtx) const
Draw function for TPointSet3D. Skips line-pass of outline mode.
TPolyMarker3D using TPointSet3DGL for direct OpenGL rendering.
Definition: TPointSet3D.h:22