Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 10:12:01

0001 // @(#)root/gl:$Id$
0002 // Author:  Matevz Tadel, Feb 2007
0003 
0004 /*************************************************************************
0005  * Copyright (C) 1995-2004, Rene Brun and Fons Rademakers.               *
0006  * All rights reserved.                                                  *
0007  *                                                                       *
0008  * For the licensing terms see $ROOTSYS/LICENSE.                         *
0009  * For the list of contributors see $ROOTSYS/README/CREDITS.             *
0010  *************************************************************************/
0011 
0012 #ifndef ROOT_TGLSelectBuffer
0013 #define ROOT_TGLSelectBuffer
0014 
0015 #include <Rtypes.h>
0016 
0017 class TGLSelectRecordBase;
0018 
0019 #include <vector>
0020 #include <utility>
0021 
0022 /**************************************************************************/
0023 // TGLSelectBuffer
0024 /**************************************************************************/
0025 
0026 class TGLSelectBuffer
0027 {
0028 protected:
0029    Int_t   fBufSize;  // Size of buffer.
0030    UInt_t* fBuf;      // Actual buffer.
0031 
0032    Int_t   fNRecords; // Number of records as returned by glRenderMode.
0033 
0034    typedef std::pair<UInt_t, UInt_t*>  RawRecord_t;
0035    typedef std::vector<RawRecord_t>   vRawRecord_t;
0036 
0037    vRawRecord_t fSortedRecords;
0038 
0039    static Int_t fgMaxBufSize;
0040 
0041 public:
0042    TGLSelectBuffer();
0043    virtual ~TGLSelectBuffer();
0044 
0045    Int_t   GetBufSize()  const { return fBufSize; }
0046    UInt_t* GetBuf()      const { return fBuf; }
0047    Int_t   GetNRecords() const { return fNRecords; }
0048 
0049    Bool_t CanGrow();
0050    void   Grow();
0051 
0052    void ProcessResult(Int_t glResult);
0053 
0054    UInt_t* RawRecord(Int_t i) { return fSortedRecords[i].second; }
0055 
0056    Int_t   SelectRecord(TGLSelectRecordBase& rec, Int_t i);
0057 
0058    ClassDef(TGLSelectBuffer, 0) // OpenGL select buffer with depth sorting.
0059 };
0060 
0061 #endif