Logo ROOT  
Reference Guide
TVirtualGL.h
Go to the documentation of this file.
1// @(#)root/base:$Id$
2// Author: Valery Fine(fine@vxcern.cern.ch) 05/03/97
3
4/*************************************************************************
5 * Copyright (C) 1995-2000, 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_TVirtualGL
13#define ROOT_TVirtualGL
14
15
16//////////////////////////////////////////////////////////////////////////
17// //
18// TVirtualGL //
19// //
20// The TVirtualGL class is an abstract base class defining the //
21// OpenGL interface protocol. All interactions with OpenGL should be //
22// done via the global pointer gVirtualGL. If the OpenGL library is //
23// available this pointer is pointing to an instance of the TGLKernel //
24// class which provides the actual interface to OpenGL. Using this //
25// scheme of ABC we can use OpenGL in other parts of the framework //
26// without having to link with the OpenGL library in case we don't //
27// use the classes using OpenGL. //
28// //
29//////////////////////////////////////////////////////////////////////////
30
31#include "TNamed.h"
32#include "GuiTypes.h"
33#include "GLConstants.h"
34
36class TPoints3DABC;
37class TGLViewer;
38class TGLCamera;
39class TGLManip;
40class TGLBoundingBox;
41class TGLRect;
42
43//TVirtualGLPainter is the base for histogramm painters.
44
46public:
48
49 virtual void Paint() = 0;
50 virtual void Pan(Int_t px, Int_t py) = 0;
51 virtual Bool_t PlotSelected(Int_t px, Int_t py) = 0;
52 //Used by status bar in a canvas.
53 virtual char *GetPlotInfo(Int_t px, Int_t py) = 0;
54
55 ClassDef(TVirtualGLPainter, 0); // Interface for OpenGL painter
56};
57
58//We need this class to implement TGWin32GLManager's SelectManip
60public:
61 virtual ~TVirtualGLManip(){}
62 virtual Bool_t Select(const TGLCamera & camera, const TGLRect & rect, const TGLBoundingBox & sceneBox) = 0;
63
64 ClassDef(TVirtualGLManip, 0); //Interface for GL manipulator
65};
66
67//This class (and its descendants) in future will replace (?)
68//TVirtualGL/TGLKernel/TGWin32GL/TGX11GL
69
70class TGLManager : public TNamed {
71public:
72 TGLManager();
73
74 //index returned can be used as a result of gVirtualX->InitWindow
75 virtual Int_t InitGLWindow(Window_t winID) = 0;
76 //winInd is the index, returned by InitGLWindow
77 virtual Int_t CreateGLContext(Int_t winInd) = 0;
78
79 //[ Off-screen rendering part
80 //create DIB section/pixmap to read GL buffer into it,
81 //ctxInd is the index, returned by CreateGLContext
84 //analog of gVirtualX->SelectWindow(fPixmapID) => gVirtualGL->SelectOffScreenDevice(fPixmapID)
85 virtual void SelectOffScreenDevice(Int_t ctxInd) = 0;
86 //Index of DIB/pixmap, valid for gVirtualX
87 virtual Int_t GetVirtualXInd(Int_t ctxInd) = 0;
88 //copy pixmap into window directly
89 virtual void MarkForDirectCopy(Int_t ctxInd, Bool_t) = 0;
90 //Off-screen device holds sizes for glViewport
91 virtual void ExtractViewport(Int_t ctxInd, Int_t *vp) = 0;
92 //Read GL buffer into off-screen device
93 virtual void ReadGLBuffer(Int_t ctxInd) = 0;
94 //]
95
96 //Make the gl context current
97 virtual Bool_t MakeCurrent(Int_t ctxInd) = 0;
98 //Swap buffers or copies DIB/pixmap (via BitBlt/XCopyArea)
99 virtual void Flush(Int_t ctxInd) = 0;
100 //GL context and off-screen device deletion
101 virtual void DeleteGLContext(Int_t ctxInd) = 0;
102
103 //functions to switch between threads in win32
104 virtual Bool_t SelectManip(TVirtualGLManip *manip, const TGLCamera *camera, const TGLRect *rect, const TGLBoundingBox *sceneBox) = 0;
105 //
107 virtual void PanObject(TVirtualGLPainter *o, Int_t x, Int_t y) = 0;
108 //EPS/PDF output
109 virtual void PrintViewer(TVirtualViewer3D *vv) = 0;
110
111 virtual Bool_t PlotSelected(TVirtualGLPainter *plot, Int_t px, Int_t py) = 0;
112 virtual char *GetPlotInfo(TVirtualGLPainter *plot, Int_t px, Int_t py) = 0;
113
114 virtual Bool_t HighColorFormat(Int_t ctxInd) = 0;
115
116 static TGLManager *&Instance();
117
118private:
121
122 ClassDef(TGLManager, 0)// Interface for OpenGL manager
123};
124
125namespace Rgl {
126
127//I would prefer to use C++11's strong typed enums insted, but ...
129{
130 kNone = 0,
136 kMultiSample = 32
138
139}
140
141class TGLContext;
142class TGLFormat;
143
145 friend class TGLContext;
146public:
147 virtual ~TGLPaintDevice(){}
148 virtual Bool_t MakeCurrent() = 0;
149 virtual void SwapBuffers() = 0;
150 virtual const TGLFormat *GetPixelFormat()const = 0;
151 virtual const TGLContext *GetContext()const = 0;
152 virtual void ExtractViewport(Int_t *vp)const = 0;
153
154private:
155 virtual void AddContext(TGLContext *ctx) = 0;
156 virtual void RemoveContext(TGLContext *ctx) = 0;
157
158 ClassDef(TGLPaintDevice, 0) // Base class for GL widgets and GL off-screen rendering
159};
160
161#ifndef __CINT__
162#define gGLManager (TGLManager::Instance())
163R__EXTERN TGLManager *(*gPtr2GLManager)();
164#endif
165
166#endif
#define R__EXTERN
Definition: DllImport.h:27
Handle_t Window_t
Definition: GuiTypes.h:28
#define h(i)
Definition: RSha256.hxx:106
int Int_t
Definition: RtypesCore.h:43
unsigned int UInt_t
Definition: RtypesCore.h:44
bool Bool_t
Definition: RtypesCore.h:61
#define ClassDef(name, id)
Definition: Rtypes.h:322
Concrete class describing an orientated (free) or axis aligned box of 8 vertices.
Abstract base camera class - concrete classes for orthographic and perspective cameras derive from it...
Definition: TGLCamera.h:43
This class encapsulates window-system specific information about a GL-context and alows their proper ...
Definition: TGLContext.h:31
Encapsulation of format / contents of an OpenGL buffer.
Definition: TGLFormat.h:36
virtual Bool_t ResizeOffScreenDevice(Int_t ctxInd, Int_t x, Int_t y, UInt_t w, UInt_t h)=0
virtual Int_t GetVirtualXInd(Int_t ctxInd)=0
virtual void DeleteGLContext(Int_t ctxInd)=0
static TGLManager *& Instance()
Return the global GL Manager.
Definition: TVirtualGL.cxx:44
virtual Int_t InitGLWindow(Window_t winID)=0
virtual Bool_t SelectManip(TVirtualGLManip *manip, const TGLCamera *camera, const TGLRect *rect, const TGLBoundingBox *sceneBox)=0
virtual void MarkForDirectCopy(Int_t ctxInd, Bool_t)=0
TGLManager(const TGLManager &)
virtual void PaintSingleObject(TVirtualGLPainter *)=0
virtual void PanObject(TVirtualGLPainter *o, Int_t x, Int_t y)=0
virtual void SelectOffScreenDevice(Int_t ctxInd)=0
virtual Bool_t AttachOffScreenDevice(Int_t ctxInd, Int_t x, Int_t y, UInt_t w, UInt_t h)=0
TGLManager & operator=(const TGLManager &)
virtual void ReadGLBuffer(Int_t ctxInd)=0
virtual Bool_t HighColorFormat(Int_t ctxInd)=0
virtual Bool_t MakeCurrent(Int_t ctxInd)=0
virtual char * GetPlotInfo(TVirtualGLPainter *plot, Int_t px, Int_t py)=0
virtual void PrintViewer(TVirtualViewer3D *vv)=0
virtual Int_t CreateGLContext(Int_t winInd)=0
virtual Bool_t PlotSelected(TVirtualGLPainter *plot, Int_t px, Int_t py)=0
virtual void ExtractViewport(Int_t ctxInd, Int_t *vp)=0
virtual void Flush(Int_t ctxInd)=0
Abstract base class for viewer manipulators, which allow direct in viewer manipulation of a (TGlPhysi...
Definition: TGLManip.h:29
virtual const TGLContext * GetContext() const =0
virtual void SwapBuffers()=0
virtual Bool_t MakeCurrent()=0
virtual ~TGLPaintDevice()
Definition: TVirtualGL.h:147
virtual void ExtractViewport(Int_t *vp) const =0
virtual const TGLFormat * GetPixelFormat() const =0
virtual void AddContext(TGLContext *ctx)=0
virtual void RemoveContext(TGLContext *ctx)=0
Viewport (pixel base) 2D rectangle class.
Definition: TGLUtil.h:421
Base GL viewer object - used by both standalone and embedded (in pad) GL.
Definition: TGLViewer.h:57
The TNamed class is the base class for all named ROOT classes.
Definition: TNamed.h:29
Abstract class to define Arrays of 3D points.
Definition: TPoints3DABC.h:25
virtual Bool_t Select(const TGLCamera &camera, const TGLRect &rect, const TGLBoundingBox &sceneBox)=0
virtual ~TVirtualGLManip()
Definition: TVirtualGL.h:61
virtual ~TVirtualGLPainter()
Definition: TVirtualGL.h:47
virtual Bool_t PlotSelected(Int_t px, Int_t py)=0
virtual char * GetPlotInfo(Int_t px, Int_t py)=0
virtual void Pan(Int_t px, Int_t py)=0
virtual void Paint()=0
Abstract 3D shapes viewer.
Double_t y[n]
Definition: legend1.C:17
Double_t x[n]
Definition: legend1.C:17
EFormatOptions
Definition: TVirtualGL.h:129
@ kDepth
Definition: TVirtualGL.h:132
@ kMultiSample
Definition: TVirtualGL.h:136
@ kStencil
Definition: TVirtualGL.h:134
@ kStereo
Definition: TVirtualGL.h:135
@ kDoubleBuffer
Definition: TVirtualGL.h:131
@ kNone
Definition: TVirtualGL.h:130
@ kAccum
Definition: TVirtualGL.h:133