Logo ROOT   6.30.04
Reference Guide
 All Namespaces Files Pages
TGOSXGL.h
Go to the documentation of this file.
1 #ifndef ROOT_TGOSXGL
2 #define ROOT_TGOSXGL
3 
4 #include <map>
5 
6 #include "TVirtualGL.h"
7 
8 //
9 //TGLManager is a legacy interface (gl-context/window management):
10 //at some point we had to use OpenGL in our TCanvas/TPad classes which do not
11 //have direct access to low-level APIs + on Windows we had quite tricky
12 //mt-problems to deal with.
13 //
14 
15 class TGOSXGLManager : public TGLManager {
16 public:
17  TGOSXGLManager();
18  ~TGOSXGLManager();
19 
20  //TGLManager's final-overriders (window + context management):
21  Int_t InitGLWindow(Window_t winID);
22  Int_t CreateGLContext(Int_t winInd);
23  void DeleteGLContext(Int_t devInd);
24  Bool_t MakeCurrent(Int_t devInd);
25  void Flush(Int_t ctxInd);
26 
27  //In case of Cocoa 'VirtulXInd' == devInd (again, legacy).
28  Int_t GetVirtualXInd(Int_t devInd);
29 
30  //These are empty overriders, we do not have/use off-screen renreding in TCanvas/TPad anymore
31  //(before we had 1) non-hardware glpixmaps/DIB sections and later 2) a hack with double buffer).
32  Bool_t AttachOffScreenDevice(Int_t ctxInd, Int_t x, Int_t y, UInt_t w, UInt_t h);
33  Bool_t ResizeOffScreenDevice(Int_t devInd, Int_t x, Int_t y, UInt_t w, UInt_t h);
34  void SelectOffScreenDevice(Int_t devInd);
35  void MarkForDirectCopy(Int_t devInd, Bool_t);
36  void ExtractViewport(Int_t devInd, Int_t *vp);
37  void ReadGLBuffer(Int_t devInd);
38 
39  //Used by our OpenGL viewer.
40  //In the past we had to implement this functions to deal with mt-issues on Windows.
41  Bool_t SelectManip(TVirtualGLManip *manip, const TGLCamera *camera, const TGLRect *rect, const TGLBoundingBox *sceneBox);
42  Bool_t PlotSelected(TVirtualGLPainter *plot, Int_t px, Int_t py);
43  char *GetPlotInfo(TVirtualGLPainter *plot, Int_t px, Int_t py);
44  void PaintSingleObject(TVirtualGLPainter *);
45  void PanObject(TVirtualGLPainter *o, Int_t x, Int_t y);
46  void PrintViewer(TVirtualViewer3D *vv);
47 
48  Bool_t HighColorFormat(Int_t /*ctxInd*/){return kFALSE;}
49 
50 private:
51  typedef std::map<Handle_t, Window_t> CtxToWindowMap_t;
52  CtxToWindowMap_t fCtxToWin;
53 
54  TGOSXGLManager(const TGOSXGLManager &);
55  TGOSXGLManager &operator = (const TGOSXGLManager &);
56 
57  ClassDef(TGOSXGLManager, 0) //Cocoa specific version of TGLManager.
58 };
59 
60 #endif