forked from root-project/root
-
Notifications
You must be signed in to change notification settings - Fork 0
/
TGLSelectBuffer.h
61 lines (42 loc) · 1.73 KB
/
TGLSelectBuffer.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
// @(#)root/gl:$Id$
// Author: Matevz Tadel, Feb 2007
/*************************************************************************
* Copyright (C) 1995-2004, Rene Brun and Fons Rademakers. *
* All rights reserved. *
* *
* For the licensing terms see $ROOTSYS/LICENSE. *
* For the list of contributors see $ROOTSYS/README/CREDITS. *
*************************************************************************/
#ifndef ROOT_TGLSelectBuffer
#define ROOT_TGLSelectBuffer
#include <Rtypes.h>
class TGLSelectRecordBase;
#include <vector>
#include <utility>
/**************************************************************************/
// TGLSelectBuffer
/**************************************************************************/
class TGLSelectBuffer
{
protected:
Int_t fBufSize; // Size of buffer.
UInt_t* fBuf; // Actual buffer.
Int_t fNRecords; // Number of records as returned by glRenderMode.
typedef std::pair<UInt_t, UInt_t*> RawRecord_t;
typedef std::vector<RawRecord_t> vRawRecord_t;
vRawRecord_t fSortedRecords;
static Int_t fgMaxBufSize;
public:
TGLSelectBuffer();
virtual ~TGLSelectBuffer();
Int_t GetBufSize() const { return fBufSize; }
UInt_t* GetBuf() const { return fBuf; }
Int_t GetNRecords() const { return fNRecords; }
Bool_t CanGrow();
void Grow();
void ProcessResult(Int_t glResult);
UInt_t* RawRecord(Int_t i) { return fSortedRecords[i].second; }
Int_t SelectRecord(TGLSelectRecordBase& rec, Int_t i);
ClassDef(TGLSelectBuffer, 0) // OpenGL select buffer with depth sorting.
};
#endif