Logo ROOT   6.08/07
Reference Guide
TGLSelectBuffer.h
Go to the documentation of this file.
1 // @(#)root/gl:$Id$
2 // Author: Matevz Tadel, Feb 2007
3 
4 /*************************************************************************
5  * Copyright (C) 1995-2004, 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 #ifndef ROOT_TGLSelectBuffer
13 #define ROOT_TGLSelectBuffer
14 
15 #include <Rtypes.h>
16 
18 
19 #include <vector>
20 
21 /**************************************************************************/
22 // TGLSelectBuffer
23 /**************************************************************************/
24 
26 {
27 protected:
28  Int_t fBufSize; // Size of buffer.
29  UInt_t* fBuf; // Actual buffer.
30 
31  Int_t fNRecords; // Number of records as returned by glRenderMode.
32 
33  typedef std::pair<UInt_t, UInt_t*> RawRecord_t;
34  typedef std::vector<RawRecord_t> vRawRecord_t;
35 
36  vRawRecord_t fSortedRecords;
37 
39 
40 public:
42  virtual ~TGLSelectBuffer();
43 
44  Int_t GetBufSize() const { return fBufSize; }
45  UInt_t* GetBuf() const { return fBuf; }
46  Int_t GetNRecords() const { return fNRecords; }
47 
48  Bool_t CanGrow();
49  void Grow();
50 
51  void ProcessResult(Int_t glResult);
52 
53  UInt_t* RawRecord(Int_t i) { return fSortedRecords[i].second; }
54 
56 
57  ClassDef(TGLSelectBuffer, 0) // OpenGL select buffer with depth sorting.
58 };
59 
60 #endif
Int_t GetBufSize() const
void ProcessResult(Int_t glResult)
Process result of GL-selection: sort the hits by their minimum z-coordinate.
TGLSelectBuffer()
Constructor.
Int_t SelectRecord(TGLSelectRecordBase &rec, Int_t i)
Fill select record rec with data on (sorted) position i.
static Int_t fgMaxBufSize
int Int_t
Definition: RtypesCore.h:41
bool Bool_t
Definition: RtypesCore.h:59
UInt_t * RawRecord(Int_t i)
Encapsulates OpenGL select buffer.
Base class for select records.
#define ClassDef(name, id)
Definition: Rtypes.h:254
Bool_t CanGrow()
static: return true if current buffer is smaller than the max buffer size
Int_t GetNRecords() const
unsigned int UInt_t
Definition: RtypesCore.h:42
vRawRecord_t fSortedRecords
std::pair< UInt_t, UInt_t * > RawRecord_t
std::vector< RawRecord_t > vRawRecord_t
void Grow()
Increase size of the select buffer.
virtual ~TGLSelectBuffer()
Destructor.
UInt_t * GetBuf() const