ROOT  6.06/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 #ifndef ROOT_TVirtualGL
25 #include "TVirtualGL.h"
26 #endif
27 
28 #if !defined(__CLING__)
29 #include <GL/glx.h>
30 #else
31 typedef struct _XDisplay Display;
32 struct XVisualInfo;
33 #endif
34 
35 
36 class TX11GLManager : public TGLManager {
37 private:
38  class TX11GLImpl;
39  TX11GLImpl *fPimpl;
40 
41 public:
42  TX11GLManager();
44 
45  //All public functions are TGLManager's final-overriders
46 
47  //index returned can be used as a result of gVirtualX->InitWindow
49  //winInd is the index, returned by InitGLWindow
50  Int_t CreateGLContext(Int_t winInd);
51 
52  //[ Off-screen rendering part
53  //create pixmap to read GL buffer into it,
54  //ctxInd is the index, returned by CreateGLContext
57  //analog of gVirtualX->SelectWindow(fPixmapID) => gVirtualGL->SelectOffScreenDevice(fPixmapID)
58  void SelectOffScreenDevice(Int_t devInd);
59  //Index of pixmap, valid for gVirtualX
60  Int_t GetVirtualXInd(Int_t devInd);
61  //copy pixmap into window directly/by pad
62  void MarkForDirectCopy(Int_t devInd, Bool_t);
63  //Off-screen device holds sizes for glViewport
64  void ExtractViewport(Int_t devInd, Int_t *vp);
65  //Read GL buffer into pixmap
66  void ReadGLBuffer(Int_t devInd);
67  //]
68 
69  //Make the gl context current
70  Bool_t MakeCurrent(Int_t devInd);
71  //Sswap buffers or copies pixmap (XCopyArea)
72  void Flush(Int_t ctxInd);
73  //Generic function for gl context and off-screen device deletion
74  void DeleteGLContext(Int_t devInd);
75 
76  //used by viewer
77  Bool_t SelectManip(TVirtualGLManip *manip, const TGLCamera *camera, const TGLRect *rect, const TGLBoundingBox *sceneBox);
78  //
80  char *GetPlotInfo(TVirtualGLPainter *plot, Int_t px, Int_t py);
81  //
84  void PrintViewer(TVirtualViewer3D *vv);
85 
86  Bool_t HighColorFormat(Int_t /*ctxInd*/){return kFALSE;}
87 
88  struct TGLContext_t;
89 
90 private:
91  Bool_t CreateGLPixmap(TGLContext_t &);
92 
93  //implicit copy-ctor/assignment generation
94  // was already disabled by base class, but to be explicit ...
97 
98  ClassDef(TX11GLManager, 0) //X11-specific version of TGLManager
99 };
100 
101 
102 
103 #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
const Bool_t kFALSE
Definition: Rtypes.h:92
~TX11GLManager()
Destructor.
Definition: TX11GL.cxx:194
Double_t x[n]
Definition: legend1.C:17
#define ClassDef(name, id)
Definition: Rtypes.h:254
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:426
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:86
The TX11GLManager is X11 implementation of TGLManager.
Definition: TX11GL.h:36
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
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:30
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:38
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