ROOT logo
// @(#)root/gl:$Id$
// Author: Timur Pocheptsov 09/08/2004

/*************************************************************************
 * Copyright (C) 1995-2004, Rene Brun and Fons Rademakers.               *
 * All rights reserved.                                                  *
 *                                                                       *
 * For the licensing terms see $ROOTSYS/LICENSE.                         *
 * For the list of contributors see $ROOTSYS/README/CREDITS.             *
 *************************************************************************/

#ifndef ROOT_TX11GL
#define ROOT_TX11GL


//////////////////////////////////////////////////////////////////////////
//                                                                      //
// TX11GL                                                               //
//                                                                      //
// The TX11GL is X11 implementation of TVirtualGLImp class.             //
//                                                                      //
//////////////////////////////////////////////////////////////////////////

#ifndef ROOT_TVirtualGL
#include "TVirtualGL.h"
#endif

#if !defined(__CINT__)
#include <GL/glx.h>
#else
struct Display;
struct XVisualInfo;
#endif


class TX11GLManager : public TGLManager {
private:
   class TX11GLImpl;
   TX11GLImpl *fPimpl;

public:
   TX11GLManager();
   ~TX11GLManager();

   //All public functions are TGLManager's final-overriders

   //index returned can be used as a result of gVirtualX->InitWindow
   Int_t    InitGLWindow(Window_t winID);
   //winInd is the index, returned by InitGLWindow
   Int_t    CreateGLContext(Int_t winInd);

   //[            Off-screen rendering part
   //create pixmap to read GL buffer into it,
   //ctxInd is the index, returned by CreateGLContext
   Bool_t   AttachOffScreenDevice(Int_t ctxInd, Int_t x, Int_t y, UInt_t w, UInt_t h);
   Bool_t   ResizeOffScreenDevice(Int_t devInd, Int_t x, Int_t y, UInt_t w, UInt_t h);
   //analog of gVirtualX->SelectWindow(fPixmapID) => gVirtualGL->SelectOffScreenDevice(fPixmapID)
   void     SelectOffScreenDevice(Int_t devInd);
   //Index of pixmap, valid for gVirtualX
   Int_t    GetVirtualXInd(Int_t devInd);
   //copy pixmap into window directly/by pad
   void     MarkForDirectCopy(Int_t devInd, Bool_t);
   //Off-screen device holds sizes for glViewport
   void     ExtractViewport(Int_t devInd, Int_t *vp);
   //Read GL buffer into pixmap
   void     ReadGLBuffer(Int_t devInd);
   //]

   //Make the gl context current
   Bool_t   MakeCurrent(Int_t devInd);
   //Sswap buffers or copies pixmap (XCopyArea)
   void     Flush(Int_t ctxInd);
   //Generic function for gl context and off-screen device deletion
   void     DeleteGLContext(Int_t devInd);

   //used by viewer
   Bool_t   SelectManip(TVirtualGLManip *manip, const TGLCamera *camera, const TGLRect *rect, const TGLBoundingBox *sceneBox);
   //
   Bool_t   PlotSelected(TVirtualGLPainter *plot, Int_t px, Int_t py);
   char    *GetPlotInfo(TVirtualGLPainter *plot, Int_t px, Int_t py);
   //
   void     PaintSingleObject(TVirtualGLPainter *);
   void     PanObject(TVirtualGLPainter *o, Int_t x, Int_t y);
   void     PrintViewer(TVirtualViewer3D *vv);

   Bool_t   HighColorFormat(Int_t /*ctxInd*/){return kFALSE;}

   struct TGLContext_t;

private:
   Bool_t CreateGLPixmap(TGLContext_t &);

   //implicit copy-ctor/assignment generation
   // was already disabled by base class, but to be explicit ...
   TX11GLManager(const TX11GLManager &);
   TX11GLManager &operator = (const TX11GLManager &);

   ClassDef(TX11GLManager, 0) //X11-specific version of TGLManager
};



#endif
 TX11GL.h:1
 TX11GL.h:2
 TX11GL.h:3
 TX11GL.h:4
 TX11GL.h:5
 TX11GL.h:6
 TX11GL.h:7
 TX11GL.h:8
 TX11GL.h:9
 TX11GL.h:10
 TX11GL.h:11
 TX11GL.h:12
 TX11GL.h:13
 TX11GL.h:14
 TX11GL.h:15
 TX11GL.h:16
 TX11GL.h:17
 TX11GL.h:18
 TX11GL.h:19
 TX11GL.h:20
 TX11GL.h:21
 TX11GL.h:22
 TX11GL.h:23
 TX11GL.h:24
 TX11GL.h:25
 TX11GL.h:26
 TX11GL.h:27
 TX11GL.h:28
 TX11GL.h:29
 TX11GL.h:30
 TX11GL.h:31
 TX11GL.h:32
 TX11GL.h:33
 TX11GL.h:34
 TX11GL.h:35
 TX11GL.h:36
 TX11GL.h:37
 TX11GL.h:38
 TX11GL.h:39
 TX11GL.h:40
 TX11GL.h:41
 TX11GL.h:42
 TX11GL.h:43
 TX11GL.h:44
 TX11GL.h:45
 TX11GL.h:46
 TX11GL.h:47
 TX11GL.h:48
 TX11GL.h:49
 TX11GL.h:50
 TX11GL.h:51
 TX11GL.h:52
 TX11GL.h:53
 TX11GL.h:54
 TX11GL.h:55
 TX11GL.h:56
 TX11GL.h:57
 TX11GL.h:58
 TX11GL.h:59
 TX11GL.h:60
 TX11GL.h:61
 TX11GL.h:62
 TX11GL.h:63
 TX11GL.h:64
 TX11GL.h:65
 TX11GL.h:66
 TX11GL.h:67
 TX11GL.h:68
 TX11GL.h:69
 TX11GL.h:70
 TX11GL.h:71
 TX11GL.h:72
 TX11GL.h:73
 TX11GL.h:74
 TX11GL.h:75
 TX11GL.h:76
 TX11GL.h:77
 TX11GL.h:78
 TX11GL.h:79
 TX11GL.h:80
 TX11GL.h:81
 TX11GL.h:82
 TX11GL.h:83
 TX11GL.h:84
 TX11GL.h:85
 TX11GL.h:86
 TX11GL.h:87
 TX11GL.h:88
 TX11GL.h:89
 TX11GL.h:90
 TX11GL.h:91
 TX11GL.h:92
 TX11GL.h:93
 TX11GL.h:94
 TX11GL.h:95
 TX11GL.h:96
 TX11GL.h:97
 TX11GL.h:98
 TX11GL.h:99
 TX11GL.h:100
 TX11GL.h:101
 TX11GL.h:102
 TX11GL.h:103