Logo ROOT   6.10/09
Reference Guide
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();
42 
43  //All public functions are TGLManager's final-overriders
44 
45  //index returned can be used as a result of gVirtualX->InitWindow
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
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  //
78  char *GetPlotInfo(TVirtualGLPainter *plot, Int_t px, Int_t py);
79  //
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 ...
95 
96  ClassDef(TX11GLManager, 0) //X11-specific version of TGLManager
97 };
98 
99 
100 
101 #endif
void DeleteGLContext(Int_t devInd)
Deletes GLX context and frees pixmap and image (if any).
Definition: TX11GL.cxx:483
Abstract base camera class - concrete classes for orthographic and perspective cameras derive from it...
Definition: TGLCamera.h:43
Bool_t CreateGLPixmap(TGLContext_t &)
Create GL pixmap.
Definition: TX11GL.cxx:321
char * GetPlotInfo(TVirtualGLPainter *plot, Int_t px, Int_t py)
Analog of TObject::GetObjectInfo.
Definition: TX11GL.cxx:582
void MarkForDirectCopy(Int_t devInd, Bool_t)
Selection-rotation support for TPad/TCanvas.
Definition: TX11GL.cxx:440
TH1 * h
Definition: legend2.C:5
Int_t InitGLWindow(Window_t winID)
Try to find correct visual.
Definition: TX11GL.cxx:203
void PrintViewer(TVirtualViewer3D *vv)
Print viewer.
Definition: TX11GL.cxx:549
Bool_t AttachOffScreenDevice(Int_t ctxInd, Int_t x, Int_t y, UInt_t w, UInt_t h)
Attach off screen device.
Definition: TX11GL.cxx:367
int Int_t
Definition: RtypesCore.h:41
bool Bool_t
Definition: RtypesCore.h:59
~TX11GLManager()
Destructor.
Definition: TX11GL.cxx:194
Double_t x[n]
Definition: legend1.C:17
#define ClassDef(name, id)
Definition: Rtypes.h:297
void ReadGLBuffer(Int_t devInd)
GL buffer is read info buffer, after that lines are reordered into XImage, XImage copied into pixmap...
Definition: TX11GL.cxx:451
Viewport (pixel base) 2D rectangle class.
Definition: TGLUtil.h:422
Abstract 3D shapes viewer.
void PaintSingleObject(TVirtualGLPainter *)
Paint a single object.
Definition: TX11GL.cxx:540
Int_t CreateGLContext(Int_t winInd)
Context creation requires Display * and XVisualInfo (was saved for such winInd).
Definition: TX11GL.cxx:253
TX11GLManager()
Constructor.
Definition: TX11GL.cxx:184
void SelectOffScreenDevice(Int_t devInd)
Selects off-screen device to make it accessible by gVirtualX.
Definition: TX11GL.cxx:431
unsigned int UInt_t
Definition: RtypesCore.h:42
Bool_t HighColorFormat(Int_t)
Definition: TX11GL.h:84
The TX11GLManager is X11 implementation of TGLManager.
Definition: TX11GL.h:34
void Flush(Int_t ctxInd)
Swaps buffers or copy pixmap.
Definition: TX11GL.cxx:296
Bool_t PlotSelected(TVirtualGLPainter *plot, Int_t px, Int_t py)
Analog of TObject::DistancetoPrimitive.
Definition: TX11GL.cxx:574
const Bool_t kFALSE
Definition: RtypesCore.h:92
Double_t y[n]
Definition: legend1.C:17
Bool_t ResizeOffScreenDevice(Int_t devInd, Int_t x, Int_t y, UInt_t w, UInt_t h)
Resize off screen device.
Definition: TX11GL.cxx:393
Concrete class describing an orientated (free) or axis aligned box of 8 vertices. ...
void PanObject(TVirtualGLPainter *o, Int_t x, Int_t y)
Pan objects.
Definition: TX11GL.cxx:566
Handle_t Window_t
Definition: GuiTypes.h:28
Bool_t SelectManip(TVirtualGLManip *manip, const TGLCamera *camera, const TGLRect *rect, const TGLBoundingBox *sceneBox)
Select manipulator.
Definition: TX11GL.cxx:557
TX11GLImpl * fPimpl
Definition: TX11GL.h:36
TX11GLManager & operator=(const TX11GLManager &)
Int_t GetVirtualXInd(Int_t devInd)
Returns an index suitable for gVirtualX.
Definition: TX11GL.cxx:515
Bool_t MakeCurrent(Int_t devInd)
Make GL context current.
Definition: TX11GL.cxx:286
void ExtractViewport(Int_t devInd, Int_t *vp)
Returns the current dimensions of a GL pixmap.
Definition: TX11GL.cxx:524