Logo ROOT  
Reference Guide
Go to the documentation of this file.
1// @(#)root/gl:$Id$
2// Author: Timur Pocheptsov, Jun 2007
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 *************************************************************************/
12#ifndef ROOT_TGLWidget
13#define ROOT_TGLWidget
15#include <utility>
16#include <memory>
17#include <set>
19#include "TGLContext.h"
20#include "TVirtualGL.h"
21#include "TGLFormat.h"
22#include "TGFrame.h"
24class TGLWidget;
25class TGEventHandler;
27class TGLWidget : public TGFrame, public TGLPaintDevice
29 friend class TGLContext;
33 //fInnerData is for X11 - <dpy, visualInfo> pair.
34 std::pair<void *, void *> fInnerData;
38 //fFromCtor checks that SetFormat was called only from ctor.
41 std::set<TGLContext *> fValidContexts;
46 static TGLWidget* CreateDummy();
48 static TGLWidget* Create(const TGWindow* parent, Bool_t selectInput,
49 Bool_t shareDefault, const TGLPaintDevice *shareDevice,
52 static TGLWidget* Create(const TGLFormat &format,
53 const TGWindow* parent, Bool_t selectInput,
54 Bool_t shareDefault, const TGLPaintDevice *shareDevice,
57 ~TGLWidget();
59 virtual void InitGL();
60 virtual void PaintGL();
64 void SwapBuffers();
65 const TGLContext *GetContext()const;
67 const TGLFormat *GetPixelFormat()const;
69 //This function is public _ONLY_ for calls
70 //via gInterpreter. Do not call it directly.
71 void SetFormat();
72 //To repaint gl-widget without GUI events.
73 void ExtractViewport(Int_t *vp)const;
86 void DoRedraw();
89 TGLWidget(const TGLWidget &); // Not implemented.
90 TGLWidget &operator = (const TGLWidget &); // Not implemented.
93 TGLWidget(Window_t glw, const TGWindow* parent, Bool_t selectInput);
95 static Window_t CreateWindow(const TGWindow* parent, const TGLFormat &format,
97 std::pair<void *, void *>& innerData);
99 void AddContext(TGLContext *ctx);
100 void RemoveContext(TGLContext *ctx);
102 std::pair<void *, void *> GetInnerData()const;
104 ClassDef(TGLWidget, 0); //Window (widget) version of TGLPaintDevice
Handle_t Window_t
Window handle.
Definition: GuiTypes.h:29
bool Bool_t
Definition: RtypesCore.h:63
#define ClassDef(name, id)
Definition: Rtypes.h:335
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 Int_t Int_t Window_t TString Int_t GCValues_t GetPrimarySelectionOwner GetDisplay GetScreen GetColormap GetNativeEvent const char const char dpyName wid window const char font_name cursor keysym reg const char only_if_exist regb h Point_t winding char text const char depth char const char Int_t count const char ColorStruct_t color const char Pixmap_t Pixmap_t PictureAttributes_t attr const char char ret_data h unsigned char height h Atom_t Int_t ULong_t ULong_t unsigned char prop_list Atom_t Atom_t Atom_t Time_t format
Option_t Option_t width
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t height
A subclasses of TGWindow, and is used as base class for some simple widgets (buttons,...
Definition: TGFrame.h:80
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
GL window with context.
Definition: TGLWidget.h:28
Bool_t fFromInit
Definition: TGLWidget.h:39
Bool_t MakeCurrent()
Make the gl-context current.
Definition: TGLWidget.cxx:201
const TGLContext * GetContext() const
Get gl context.
Definition: TGLWidget.cxx:225
Bool_t HandleDoubleClick(Event_t *ev)
Delegate call to the owner.
Definition: TGLWidget.cxx:603
static TGLWidget * Create(const TGWindow *parent, Bool_t selectInput, Bool_t shareDefault, const TGLPaintDevice *shareDevice, UInt_t width, UInt_t height)
Static constructor for creating widget with default pixel format.
Definition: TGLWidget.cxx:83
Bool_t HandleKey(Event_t *ev)
Delegate call to the owner.
Definition: TGLWidget.cxx:654
void AddContext(TGLContext *ctx)
Register gl-context created for this window.
Definition: TGLWidget.cxx:249
TGEventHandler * fEventHandler
Definition: TGLWidget.h:43
virtual void InitGL()
Call glEnable(... in overrider of InitGL.
Definition: TGLWidget.cxx:187
std::set< TGLContext * > fValidContexts
Definition: TGLWidget.h:41
TGLFormat fGLFormat
Definition: TGLWidget.h:37
Bool_t HandleConfigureNotify(Event_t *ev)
Delegate call to the owner.
Definition: TGLWidget.cxx:619
static TGLWidget * CreateDummy()
Static constructor for creating widget with default pixel format.
Definition: TGLWidget.cxx:73
void RemoveContext(TGLContext *ctx)
Remove context (no real deletion, done by TGLContex dtor).
Definition: TGLWidget.cxx:257
Bool_t HandleButton(Event_t *ev)
Delegate call to the owner.
Definition: TGLWidget.cxx:587
virtual void PaintGL()
Do actual drawing in overrider of PaintGL.
Definition: TGLWidget.cxx:194
TGEventHandler * GetEventHandler() const
Definition: TGLWidget.h:75
Bool_t HandleFocusChange(Event_t *)
Delegate call to the owner.
Definition: TGLWidget.cxx:638
Destructor. Deletes window ???? and XVisualInfo.
Definition: TGLWidget.cxx:162
TGLWidget & operator=(const TGLWidget &)
static Window_t CreateWindow(const TGWindow *parent, const TGLFormat &format, UInt_t width, UInt_t height, std::pair< void *, void * > &innerData)
CreateWidget - X11 version.
Definition: TGLWidget.cxx:499
void SwapBuffers()
Swap buffers.
Definition: TGLWidget.cxx:217
void SetFormat()
Set pixel format.
Definition: TGLWidget.cxx:542
std::pair< void *, void * > GetInnerData() const
Dpy*, XVisualInfo *.
Definition: TGLWidget.cxx:241
std::pair< void *, void * > fInnerData
Definition: TGLWidget.h:34
Bool_t HandleMotion(Event_t *ev)
Delegate call to the owner.
Definition: TGLWidget.cxx:670
Bool_t ClearCurrent()
Clear the current gl-context.
Definition: TGLWidget.cxx:209
void ExtractViewport(Int_t *vp) const
For camera.
Definition: TGLWidget.cxx:267
TGLWidget(const TGLWidget &)
void SetEventHandler(TGEventHandler *eh)
Set event-handler. All events are passed to this object.
Definition: TGLWidget.cxx:558
void DoRedraw()
Delegate call to the owner.
Definition: TGLWidget.cxx:686
const TGLFormat * GetPixelFormat() const
Pixel format.
Definition: TGLWidget.cxx:233
TGLContext * fGLContext
Definition: TGLWidget.h:32
Int_t fWindowIndex
Definition: TGLWidget.h:35
Bool_t HandleCrossing(Event_t *)
Handle mouse crossing event.
Definition: TGLWidget.cxx:566
ROOT GUI Window base class.
Definition: TGWindow.h:23
Event structure.
Definition: GuiTypes.h:174