Logo ROOT   6.18/05
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{
27protected:
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
37
39
40public:
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
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 Int_t
Definition: RtypesCore.h:41
unsigned int UInt_t
Definition: RtypesCore.h:42
bool Bool_t
Definition: RtypesCore.h:59
#define ClassDef(name, id)
Definition: Rtypes.h:326
Encapsulates OpenGL select buffer.
UInt_t * RawRecord(Int_t i)
void ProcessResult(Int_t glResult)
Process result of GL-selection: sort the hits by their minimum z-coordinate.
virtual ~TGLSelectBuffer()
Destructor.
Int_t GetNRecords() const
void Grow()
Increase size of the select buffer.
vRawRecord_t fSortedRecords
std::vector< RawRecord_t > vRawRecord_t
static Int_t fgMaxBufSize
std::pair< UInt_t, UInt_t * > RawRecord_t
Bool_t CanGrow()
static: return true if current buffer is smaller than the max buffer size
TGLSelectBuffer()
Constructor.
Int_t GetBufSize() const
Int_t SelectRecord(TGLSelectRecordBase &rec, Int_t i)
Fill select record rec with data on (sorted) position i.
UInt_t * GetBuf() const
Base class for select records.