Logo ROOT   6.30.04
Reference Guide
 All Namespaces Files Pages
TX11GL.h
Go to the documentation of this file.
1 // @(#)root/gl:$Id$
2 // Author: Timur Pocheptsov 09/08/2004
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_TX11GL
13 #define ROOT_TX11GL
14 
15 
16 //////////////////////////////////////////////////////////////////////////
17 // //
18 // TX11GL //
19 // //
20 // The TX11GL is X11 implementation of TVirtualGLImp class. //
21 // //
22 //////////////////////////////////////////////////////////////////////////
23 
24 #include "TVirtualGL.h"
25 
26 #if !defined(__CLING__)
27 #include <GL/glx.h>
28 #else
29 typedef struct _XDisplay Display;
30 struct XVisualInfo;
31 #endif
32 
33 
34 class TX11GLManager : public TGLManager {
35 private:
36  class TX11GLImpl;
37  TX11GLImpl *fPimpl;
38 
39 public:
40  TX11GLManager();
41  ~TX11GLManager();
42 
43  //All public functions are TGLManager's final-overriders
44 
45  //index returned can be used as a result of gVirtualX->InitWindow
46  Int_t InitGLWindow(Window_t winID);
47  //winInd is the index, returned by InitGLWindow
48  Int_t CreateGLContext(Int_t winInd);
49 
50  //[ Off-screen rendering part
51  //create pixmap to read GL buffer into it,
52  //ctxInd is the index, returned by CreateGLContext
53  Bool_t AttachOffScreenDevice(Int_t ctxInd, Int_t x, Int_t y, UInt_t w, UInt_t h);
54  Bool_t ResizeOffScreenDevice(Int_t devInd, Int_t x, Int_t y, UInt_t w, UInt_t h);
55  //analog of gVirtualX->SelectWindow(fPixmapID) => gVirtualGL->SelectOffScreenDevice(fPixmapID)
56  void SelectOffScreenDevice(Int_t devInd);
57  //Index of pixmap, valid for gVirtualX
58  Int_t GetVirtualXInd(Int_t devInd);
59  //copy pixmap into window directly/by pad
60  void MarkForDirectCopy(Int_t devInd, Bool_t);
61  //Off-screen device holds sizes for glViewport
62  void ExtractViewport(Int_t devInd, Int_t *vp);
63  //Read GL buffer into pixmap
64  void ReadGLBuffer(Int_t devInd);
65  //]
66 
67  //Make the gl context current
68  Bool_t MakeCurrent(Int_t devInd);
69  //Sswap buffers or copies pixmap (XCopyArea)
70  void Flush(Int_t ctxInd);
71  //Generic function for gl context and off-screen device deletion
72  void DeleteGLContext(Int_t devInd);
73 
74  //used by viewer
75  Bool_t SelectManip(TVirtualGLManip *manip, const TGLCamera *camera, const TGLRect *rect, const TGLBoundingBox *sceneBox);
76  //
77  Bool_t PlotSelected(TVirtualGLPainter *plot, Int_t px, Int_t py);
78  char *GetPlotInfo(TVirtualGLPainter *plot, Int_t px, Int_t py);
79  //
80  void PaintSingleObject(TVirtualGLPainter *);
81  void PanObject(TVirtualGLPainter *o, Int_t x, Int_t y);
82  void PrintViewer(TVirtualViewer3D *vv);
83 
84  Bool_t HighColorFormat(Int_t /*ctxInd*/){return kFALSE;}
85 
86  struct TGLContext_t;
87 
88 private:
89  Bool_t CreateGLPixmap(TGLContext_t &);
90 
91  //implicit copy-ctor/assignment generation
92  // was already disabled by base class, but to be explicit ...
93  TX11GLManager(const TX11GLManager &);
94  TX11GLManager &operator = (const TX11GLManager &);
95 
96  ClassDef(TX11GLManager, 0) //X11-specific version of TGLManager
97 };
98 
99 
100 
101 #endif