00001 // @(#)root/gl:$Id: TGLSelectBuffer.h 21565 2007-12-28 12:28:46Z brun $ 00002 // Author: Matevz Tadel, Feb 2007 00003 00004 /************************************************************************* 00005 * Copyright (C) 1995-2004, Rene Brun and Fons Rademakers. * 00006 * All rights reserved. * 00007 * * 00008 * For the licensing terms see $ROOTSYS/LICENSE. * 00009 * For the list of contributors see $ROOTSYS/README/CREDITS. * 00010 *************************************************************************/ 00011 00012 #ifndef ROOT_TGLSelectBuffer 00013 #define ROOT_TGLSelectBuffer 00014 00015 #include <Rtypes.h> 00016 00017 class TGLSelectRecordBase; 00018 00019 #include <vector> 00020 00021 /**************************************************************************/ 00022 // TGLSelectBuffer 00023 /**************************************************************************/ 00024 00025 class TGLSelectBuffer 00026 { 00027 protected: 00028 Int_t fBufSize; // Size of buffer. 00029 UInt_t* fBuf; // Actual buffer. 00030 00031 Int_t fNRecords; // Number of records as returned by glRenderMode. 00032 00033 typedef std::pair<UInt_t, UInt_t*> RawRecord_t; 00034 typedef std::vector<RawRecord_t> vRawRecord_t; 00035 00036 vRawRecord_t fSortedRecords; 00037 00038 static Int_t fgMaxBufSize; 00039 00040 public: 00041 TGLSelectBuffer(); 00042 virtual ~TGLSelectBuffer(); 00043 00044 Int_t GetBufSize() const { return fBufSize; } 00045 UInt_t* GetBuf() const { return fBuf; } 00046 Int_t GetNRecords() const { return fNRecords; } 00047 00048 Bool_t CanGrow(); 00049 void Grow(); 00050 00051 void ProcessResult(Int_t glResult); 00052 00053 UInt_t* RawRecord(Int_t i) { return fSortedRecords[i].second; } 00054 00055 void SelectRecord(TGLSelectRecordBase& rec, Int_t i); 00056 00057 ClassDef(TGLSelectBuffer, 0) // OpenGL select buffer with depth sorting. 00058 }; 00059 00060 #endif