Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
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 TGLManager(const TGLManager &) = delete;
74 TGLManager &operator = (const TGLManager &) = delete;
75
76 //index returned can be used as a result of gVirtualX->InitWindow
77 virtual Int_t InitGLWindow(Window_t winID) = 0;
78 //winInd is the index, returned by InitGLWindow
80
81 //[ Off-screen rendering part
82 //create DIB section/pixmap to read GL buffer into it,
83 //ctxInd is the index, returned by CreateGLContext
86 //analog of gVirtualX->SelectWindow(fPixmapID) => gVirtualGL->SelectOffScreenDevice(fPixmapID)
87 virtual void SelectOffScreenDevice(Int_t ctxInd) = 0;
88 //Index of DIB/pixmap, valid for gVirtualX
89 virtual Int_t GetVirtualXInd(Int_t ctxInd) = 0;
90 //copy pixmap into window directly
91 virtual void MarkForDirectCopy(Int_t ctxInd, Bool_t) = 0;
92 //Off-screen device holds sizes for glViewport
93 virtual void ExtractViewport(Int_t ctxInd, Int_t *vp) = 0;
94 //Read GL buffer into off-screen device
95 virtual void ReadGLBuffer(Int_t ctxInd) = 0;
96 //]
97
98 //Make the gl context current
99 virtual Bool_t MakeCurrent(Int_t ctxInd) = 0;
100 //Swap buffers or copies DIB/pixmap (via BitBlt/XCopyArea)
101 virtual void Flush(Int_t ctxInd) = 0;
102 //GL context and off-screen device deletion
103 virtual void DeleteGLContext(Int_t ctxInd) = 0;
104
105 //functions to switch between threads in win32
106 virtual Bool_t SelectManip(TVirtualGLManip *manip, const TGLCamera *camera, const TGLRect *rect, const TGLBoundingBox *sceneBox) = 0;
107 //
109 virtual void PanObject(TVirtualGLPainter *o, Int_t x, Int_t y) = 0;
110 //EPS/PDF output
111 virtual void PrintViewer(TVirtualViewer3D *vv) = 0;
112
114 virtual char *GetPlotInfo(TVirtualGLPainter *plot, Int_t px, Int_t py) = 0;
115
116 virtual Bool_t HighColorFormat(Int_t ctxInd) = 0;
117
118 static TGLManager *&Instance();
119
120 ClassDefOverride(TGLManager, 0)// Interface for OpenGL manager
121};
122
123namespace Rgl {
124
125//I would prefer to use C++11's strong typed enums insted, but ...
127{
128 kNone = 0,
134 kMultiSample = 32
136
137}
138
139class TGLContext;
140class TGLFormat;
141
143 friend class TGLContext;
144public:
145 virtual ~TGLPaintDevice(){}
146 virtual Bool_t MakeCurrent() = 0;
147 virtual void SwapBuffers() = 0;
148 virtual const TGLFormat *GetPixelFormat()const = 0;
149 virtual const TGLContext *GetContext()const = 0;
150 virtual void ExtractViewport(Int_t *vp)const = 0;
151
152private:
153 virtual void AddContext(TGLContext *ctx) = 0;
154 virtual void RemoveContext(TGLContext *ctx) = 0;
155
156 ClassDef(TGLPaintDevice, 0) // Base class for GL widgets and GL off-screen rendering
157};
158
159#define gGLManager (TGLManager::Instance())
160R__EXTERN TGLManager *(*gPtr2GLManager)();
161
162#endif
#define R__EXTERN
Definition DllImport.h:26
Handle_t Window_t
Window handle.
Definition GuiTypes.h:29
#define h(i)
Definition RSha256.hxx:106
#define ClassDef(name, id)
Definition Rtypes.h:337
#define ClassDefOverride(name, id)
Definition Rtypes.h:341
winID winInd
winID h TVirtualViewer3D vv
winID h TVirtualViewer3D TVirtualGLPainter char TVirtualGLPainter plot
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t Float_t Float_t Int_t Int_t UInt_t UInt_t Rectangle_t rect
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:44
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
TGLManager & operator=(const TGLManager &)=delete
virtual Int_t GetVirtualXInd(Int_t ctxInd)=0
virtual void DeleteGLContext(Int_t ctxInd)=0
static TGLManager *& Instance()
Return the global GL Manager.
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
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
virtual void ReadGLBuffer(Int_t ctxInd)=0
TGLManager(const TGLManager &)=delete
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:145
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:422
Base GL viewer object - used by both standalone and embedded (in pad) GL.
Definition TGLViewer.h:55
The TNamed class is the base class for all named ROOT classes.
Definition TNamed.h:29
Abstract class to define Arrays of 3D points.
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:127
@ kDepth
Definition TVirtualGL.h:130
@ kMultiSample
Definition TVirtualGL.h:134
@ kStencil
Definition TVirtualGL.h:132
@ kStereo
Definition TVirtualGL.h:133
@ kDoubleBuffer
Definition TVirtualGL.h:129
@ kNone
Definition TVirtualGL.h:128
@ kAccum
Definition TVirtualGL.h:131