64#define GL_BGRA GL_BGRA_EXT
115 fCurrentCamera(&fPerspectiveCameraXOZ),
120 fStereoZeroParallax (0.03f),
121 fStereoEyeOffsetFac (1.0f),
122 fStereoFrustumAsymFac (1.0f),
126 fSelectedPShapeRef (0),
132 fPushAction(kPushStd), fDragAction(
kDragNone),
134 fMaxSceneDrawTimeHQ(5000),
135 fMaxSceneDrawTimeLQ(100),
136 fPointScale (1), fLineScale(1), fSmoothPoints(
kFALSE), fSmoothLines(
kFALSE),
138 fAxesDepthTest(
kTRUE),
140 fReferencePos(0.0, 0.0, 0.0),
141 fDrawCameraCenter(
kFALSE),
146 fPictureFileName(
"viewer.jpg"),
151 fIgnoreSizesOnUpdate(
kFALSE),
152 fResetCamerasOnUpdate(
kTRUE),
153 fResetCamerasOnNextUpdate(
kFALSE)
181 fCurrentCamera(&fPerspectiveCameraXOZ),
186 fStereoZeroParallax (0.03f),
187 fStereoEyeOffsetFac (1.0f),
188 fStereoFrustumAsymFac (1.0f),
192 fSelectedPShapeRef (0),
198 fPushAction(kPushStd), fDragAction(
kDragNone),
200 fMaxSceneDrawTimeHQ(5000),
201 fMaxSceneDrawTimeLQ(100),
202 fPointScale (1), fLineScale(1), fSmoothPoints(
kFALSE), fSmoothLines(
kFALSE),
204 fAxesDepthTest(
kTRUE),
206 fReferencePos(0.0, 0.0, 0.0),
207 fDrawCameraCenter(
kFALSE),
212 fPictureFileName(
"viewer.jpg"),
215 fGLDevice(fPad->GetGLDevice()),
217 fIgnoreSizesOnUpdate(
kFALSE),
218 fResetCamerasOnUpdate(
kTRUE),
219 fResetCamerasOnNextUpdate(
kFALSE)
233 Int_t viewport[4] = {0};
235 SetViewport(viewport[0], viewport[1], viewport[2], viewport[3]);
311 scenepad =
dynamic_cast<TGLScenePad*
>((*si)->GetScene());
312 if (scenepad && scenepad->
GetPad() == pad)
378 if (!
box.IsEmpty()) {
413 glEnable(GL_LIGHTING);
414 glEnable(GL_DEPTH_TEST);
415 glEnable(GL_CULL_FACE);
417 glClearColor(0.f, 0.f, 0.f, 0.f);
419 glColorMaterial(GL_FRONT_AND_BACK, GL_DIFFUSE);
420 glEnable(GL_COLOR_MATERIAL);
421 glMaterialf(GL_BACK, GL_SHININESS, 0.0);
422 glPolygonMode(GL_FRONT, GL_FILL);
425 glLightModeli(GL_LIGHT_MODEL_LOCAL_VIEWER,
GL_TRUE);
426 Float_t lmodelAmb[] = {0.5f, 0.5f, 1.f, 1.f};
427 glLightModelfv(GL_LIGHT_MODEL_AMBIENT, lmodelAmb);
428 glLightModeli(GL_LIGHT_MODEL_TWO_SIDE,
GL_FALSE);
430 glHint(GL_POINT_SMOOTH_HINT, GL_NICEST);
431 glHint(GL_LINE_SMOOTH_HINT, GL_NICEST);
454 Info(
"TGLViewer::RequestDraw",
"viewer locked - requesting another draw.");
462 gROOT->ProcessLineFast(
Form(
"((TGLViewer *)0x%lx)->DoDraw()", (
ULong_t)
this));
498 if (
fSmoothPoints) glEnable(GL_POINT_SMOOTH);
else glDisable(GL_POINT_SMOOTH);
499 if (
fSmoothLines) glEnable(GL_LINE_SMOOTH);
else glDisable(GL_LINE_SMOOTH);
502 glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
531 glClear(GL_DEPTH_BUFFER_BIT);
572 Info(
"TGLViewer::DoDraw()",
"zero surface area, draw skipped.");
578 Int_t viewport[4] = {};
580 SetViewport(viewport[0], viewport[1], viewport[2], viewport[3]);
606 Info(
"TGLViewer::DoDraw()",
"Took %f msec", timer.
End());
664 Float_t gl_near, gl_far, zero_p_dist;
666 Float_t x_len_at_zero_parallax;
675 glDrawBuffer(GL_BACK_LEFT);
680 glEnable(GL_SCISSOR_TEST);
685 gl_near =
c.GetNearClip();
686 gl_far =
c.GetFarClip();
692 x_len_at_zero_parallax = 2.0f * w_half * zero_p_dist / gl_near;
698 abs_trans *=
c.RefCamTrans();
701 glTranslatef(stereo_offset*left_vec[0], stereo_offset*left_vec[1], stereo_offset*left_vec[2]);
703 glMatrixMode(GL_PROJECTION);
705 glFrustum(-w_half + frustum_asym, w_half + frustum_asym,
706 -h_half, h_half, gl_near, gl_far);
707 glMatrixMode(GL_MODELVIEW);
727 glDrawBuffer(GL_BACK_RIGHT);
740 glTranslatef(-stereo_offset*left_vec[0], -stereo_offset*left_vec[1], -stereo_offset*left_vec[2]);
742 glMatrixMode(GL_PROJECTION);
744 glFrustum(-w_half - frustum_asym, w_half - frustum_asym,
745 -h_half, h_half, gl_near, gl_far);
746 glMatrixMode(GL_MODELVIEW);
771 glDrawBuffer(GL_BACK);
775 glDisable(GL_SCISSOR_TEST);
817 if (GLEW_EXT_framebuffer_object &&
gEnv->
GetValue(
"OpenGL.SavePicturesViaFBO", 1))
838 static const TString eh(
"TGLViewer::SavePictureUsingBB");
843 Warning(eh,
"file %s cannot be saved with this extension.", fileName.
Data());
848 Error(eh,
"viewer locked - try later.");
858 gROOT->ProcessLineFast(
Form(
"((TGLViewer *)0x%lx)->DoDraw(kFALSE)", (
ULong_t)
this));
864 glReadBuffer(GL_BACK);
867 glPixelStorei(GL_PACK_ALIGNMENT, 1);
869 GL_BGRA, GL_UNSIGNED_BYTE, xx);
873 image->WriteImage(fileName);
896 static const TString eh(
"TGLViewer::SavePictureUsingFBO");
901 Warning(eh,
"file %s cannot be saved with this extension.", fileName.
Data());
906 Error(eh,
"viewer locked - try later.");
919 catch (std::runtime_error& exc)
921 Error(eh,
"%s",exc.what());
922 if (
gEnv->
GetValue(
"OpenGL.SavePictureFallbackToBB", 1)) {
923 Info(eh,
"Falling back to saving image via back-buffer. Window must be fully visible.");
925 Warning(eh,
"Back-buffer does not support image scaling, window size will be used.");
936 if (pixel_object_scale != 0)
948 gROOT->ProcessLineFast(
Form(
"((TGLViewer *)0x%lx)->DoDraw(kFALSE)", (
ULong_t)
this));
959 glPixelStorei(GL_PACK_ALIGNMENT, 1);
961 GL_BGRA, GL_UNSIGNED_BYTE, xx);
965 image->WriteImage(fileName);
971 if (pixel_object_scale != 0)
989 static const TString eh(
"TGLViewer::GetPictureUsingBB");
992 Error(eh,
"viewer locked - try later.");
1002 gROOT->ProcessLineFast(
Form(
"((TGLViewer *)0x%lx)->DoDraw(kFALSE)", (
ULong_t)
this));
1008 glReadBuffer(GL_BACK);
1011 glPixelStorei(GL_PACK_ALIGNMENT, 1);
1013 GL_BGRA, GL_UNSIGNED_BYTE, xx);
1036 static const TString eh(
"TGLViewer::GetPictureUsingFBO");
1039 Error(eh,
"viewer locked - try later.");
1052 catch (std::runtime_error& exc)
1054 Error(eh,
"%s",exc.what());
1055 if (
gEnv->
GetValue(
"OpenGL.GetPictureFallbackToBB", 1)) {
1056 Info(eh,
"Falling back to saving image via back-buffer. Window must be fully visible.");
1058 Warning(eh,
"Back-buffer does not support image scaling, window size will be used.");
1069 if (pixel_object_scale != 0)
1081 gROOT->ProcessLineFast(
Form(
"((TGLViewer *)0x%lx)->DoDraw(kFALSE)", (
ULong_t)
this));
1092 glPixelStorei(GL_PACK_ALIGNMENT, 1);
1094 GL_BGRA, GL_UNSIGNED_BYTE, xx);
1102 if (pixel_object_scale != 0)
1119 Bool_t pixel_object_scale)
1133 Bool_t pixel_object_scale)
1147 Bool_t pixel_object_scale)
1163 glDisable(GL_DEPTH_TEST);
1169 glDisable(GL_DEPTH_TEST);
1171 const UChar_t rgba[4] = { 0, 255, 255, 255 };
1177 glEnable(GL_DEPTH_TEST);
1182 glDisable(GL_DEPTH_TEST);
1187 glEnable(GL_DEPTH_TEST);
1197 glDisable(GL_LIGHTING);
1201 glColor3d(0.0, 1.0, 0.0);
1205 glDisable(GL_DEPTH_TEST);
1210 glEnable(GL_DEPTH_TEST);
1212 glEnable(GL_LIGHTING);
1229 color->
GetRGB(rgb[0], rgb[1], rgb[2]);
1231 rgb[0] = rgb[1] = rgb[2] = 0.0f;
1233 glClearColor(rgb[0], rgb[1], rgb[2], 0.0f);
1236 glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT);
1256 static const Float_t z = -1.0f;
1258 glMatrixMode(GL_PROJECTION); glPushMatrix(); glLoadIdentity();
1259 glMatrixMode(GL_MODELVIEW); glPushMatrix(); glLoadIdentity();
1264 glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
1267 glVertex3f(-1, -1, z); glVertex3f( 1, -1, z);
1268 glVertex3f( 1, 1, z); glVertex3f(-1, 1, z);
1272 glMatrixMode(GL_PROJECTION); glPopMatrix();
1273 glMatrixMode(GL_MODELVIEW); glPopMatrix();
1346 glRenderMode(GL_SELECT);
1352 Int_t nHits = glRenderMode(GL_RENDER);
1356 if (
gDebug > 0)
Info(
"TGLViewer::DoSelect",
"Primary select nHits=%d.", nHits);
1391 return Bool_t(
gROOT->ProcessLineFast(
Form(
"((TGLViewer *)0x%lx)->DoSecondarySelect(%d, %d)", (
ULong_t)
this,
x,
y)));
1416 Info(
"TGLViewer::SecondarySelect",
"Skipping secondary selection "
1417 "(sinfo=0x%lx, pshape=0x%lx).\n",
1430 foo.push_back(sinfo);
1434 glRenderMode(GL_SELECT);
1441 glPushName(pshp->
ID());
1449 Int_t nSecHits = glRenderMode(GL_RENDER);
1453 if (
gDebug > 0)
Info(
"TGLViewer::DoSelect",
"Secondary select nSecHits=%d.", nSecHits);
1526 glRenderMode(GL_SELECT);
1532 Int_t nHits = glRenderMode(GL_RENDER);
1586 delete this;
return;
1601 "TGLFaderHelper",
this,
"MakeFadeStep()");
1639 Info(
"SwitchColorSet()",
"Global color-set is in use, switch not supported.");
1738 Info(
"TGLViewer::SetViewport",
"updated - corner %d,%d dimensions %d,%d",
x,
y,
width, height);
1759 switch(cameraType) {
1783 Error(
"TGLViewer::SetCurrentCamera",
"invalid camera type");
1850 Error(
"TGLViewer::SetCurrentCamera",
"invalid camera type");
1930 Error(
"TGLViewer::SetOrthoCamera",
"invalid camera type");
1978 Error(
"TGLViewer::SetPerspectiveCamera",
"invalid camera type");
2099 Emit(
"MouseOver(TGLPhysicalShape*)", (
Long_t)shape);
2110 Emit(
"MouseOver(TGLPhysicalShape*,UInt_t)", args);
2121 Emit(
"MouseOver(TObject*,UInt_t)", args);
2132 Emit(
"ReMouseOver(TObject*,UInt_t)", args);
2144 Emit(
"UnMouseOver(TObject*,UInt_t)", args);
2164 Emit(
"Clicked(TObject*,UInt_t,UInt_t)", args);
2177 Emit(
"ReClicked(TObject*,UInt_t,UInt_t)", args);
2189 Emit(
"UnClicked(TObject*,UInt_t,UInt_t)", args);
2198 static UInt_t oldx = 0, oldy = 0;
2200 if (oldx != posx || oldy != posy) {
2204 Emit(
"MouseIdle(TGLPhysicalShape*,UInt_t,UInt_t)", args);
2221 gPad->SetSelected(
this);
include TDocParser_001 C image html pict1_TDocParser_001 png width
R__EXTERN TVirtualMutex * gROOTMutex
char * Form(const char *fmt,...)
#define R__LOCKGUARD(mutex)
virtual Color_t GetFillColor() const
Return the fill area color.
virtual Color_t GetLineColor() const
Return the line color.
The color creation and management class.
virtual void GetRGB(Float_t &r, Float_t &g, Float_t &b) const
virtual Int_t GetValue(const char *name, Int_t dflt) const
Returns the integer value for a resource.
Automatically rotates GL camera.
void Start()
Start the auto-rotator.
TGLCamera * GetCamera() const
void Stop()
Stop the auto-rotator.
Concrete class describing an orientated (free) or axis aligned box of 8 vertices.
TGLVector3 Extents() const
TGLVertex3 Center() const
void Draw(Bool_t solid=kFALSE) const
Draw the bounding box as either wireframe (default) of solid using current GL color.
A GL overlay element which displays camera furstum.
Abstract base camera class - concrete classes for orthographic and perspective cameras derive from it...
virtual Bool_t IsPerspective() const
Double_t * GetCenterVec()
void DrawDebugAids() const
Draw out some debugging aids for the camera:
virtual void Setup(const TGLBoundingBox &box, Bool_t reset=kTRUE)=0
void SetViewport(const TGLRect &viewport)
Set viewport extents from passed 'viewport' rect.
TGLVector3 ViewportDeltaToWorld(const TGLVertex3 &worldRef, Double_t viewportXDelta, Double_t viewportYDelta, TGLMatrix *modviewMat=0) const
Apply a 2D viewport delta (shift) to the projection of worldRef onto viewport, returning the resultan...
A collection of concrete TGLClip objects to be selected from.
TGLClip * GetCurrentClip() const
void SetupCurrentClip(const TGLBoundingBox &sceneBBox)
Setup current clipping object for given scene bounding box.
void SetupCurrentClipIfInvalid(const TGLBoundingBox &sceneBBox)
Setup current clipping object for given scene bounding box.
Class encapsulating a set of colors used throughout standard rendering.
void StdLightBackground()
Set defaults for light (white) background.
void SetColor(Int_t r, Int_t g, Int_t b, Int_t a=255)
Set color with Int_t values.
Color_t GetColorIndex() const
Returns color-index representing the color.
Identifier of a shared GL-context.
void DeleteGLResources()
Delete GL resources registered for destruction.
void Release(TGLContext *ctx)
Remove context ctx from the list of references.
void AddRef(TGLContext *ctx)
Add context ctx to the list of references.
void Unbind()
Unbind the frame-buffer object.
void Init(int w, int h, int ms_samples=0)
Acquire GL resources for given width, height and number of multi-sampling samples.
void Bind()
Bind the frame-buffer object.
void MakeFadeStep()
Make one fading step and request redraw.
Encapsulates a set of lights for OpenGL.
void StdSetupLights(const TGLBoundingBox &bbox, const TGLCamera &camera, Bool_t debug=kFALSE)
Setup lights for current given bounding box and camera.
Bool_t TakeLock(ELock lock) const
Lock the object in mode 'lock'.
ELock CurrentLock() const
Bool_t ReleaseLock(ELock lock) const
Release current lock, make sure it the same as the 'lock' argument.
static const char * LockName(ELock lock)
Return name-string for given lock-type.
Bool_t IsDrawOrSelectLock() const
virtual Bool_t SupportsSecondarySelect() const
Combine all available manipulators in a collection.
void SetDrawBBox(Bool_t bb)
virtual void SetPShape(TGLPhysicalShape *shape)
Set phys-shape, override of virtual from TGLPShapeRef.
16 component (4x4) transform matrix - column MAJOR as per GL.
void Set(const TGLVertex3 &origin, const TGLVector3 &zAxis, const TGLVector3 &xAxis=0)
Set matrix which when applied puts local origin at 'origin' and the local Z axis in direction 'z'.
TGLVector3 GetBaseVec(Int_t b) const
TGLVector3 GetTranslation() const
Return the translation component of matrix.
Orthographic projection camera.
virtual void Setup(const TGLBoundingBox &box, Bool_t reset=kTRUE)
Setup camera limits suitable to view the world volume defined by 'box' and call Reset() to initialise...
virtual void Configure(Double_t zoom, Double_t dolly, Double_t center[3], Double_t hRotate, Double_t vRotate)
Configure the camera state.
static Bool_t Capture(TGLViewer &viewer, EFormat format, const char *filePath=0)
Capture viewer to file.
virtual Bool_t MouseEnter(TGLOvlSelectRecord &selRec)
Mouse has entered this element.
virtual Bool_t MouseStillInside(TGLOvlSelectRecord &selRec)
virtual void MouseLeave()
Mouse has left the element.
TGLOverlayElement * GetOvlElement() const
virtual void Reset()
Reinitialise all data to null values.
Wrap TGLPysicalShape into TObject so that it can be edited using GED.
TGLPhysicalShape * fPShape
TGLPhysicalShape * GetPShape() const
Perspective projection camera - with characteristic foreshortening.
virtual void Configure(Double_t fov, Double_t dolly, Double_t center[3], Double_t hRotate, Double_t vRotate)
Configure the camera state.
virtual void Setup(const TGLBoundingBox &box, Bool_t reset=kTRUE)
Setup camera limits suitable to view the world volume defined by 'box' and call Reset() to initialise...
Concrete physical shape - a GL drawable.
virtual void Draw(TGLRnrCtx &rnrCtx) const
Draw physical shape, using LOD flags, potential from display list cache.
Viewport (pixel base) 2D rectangle class.
void Set(Int_t x, Int_t y, Int_t width, Int_t height)
void RequestDraw(Int_t milliSec, Short_t redrawLOD)
void SetRenderScale(Float_t s)
void SetSceneInfo(TGLSceneInfo *si)
TGLColorSet * ChangeBaseColorSet(TGLColorSet *set)
Change the default/bottom color-set.
void SetRenderTimeOut(Double_t tout)
void SetShapeLOD(Short_t LOD)
void BeginSelection(Int_t x, Int_t y, Int_t r=3)
Setup context for running selection.
Short_t SelectTransparents() const
Float_t GetRenderScale() const
void SetSecSelection(Bool_t secSel)
TGLColorSet * GetBaseColorSet()
Returns the current base color-set.
TGLSelectBuffer * GetSelectBuffer() const
void SetGLCtxIdentity(TGLContextIdentity *cid)
void SetGrabImage(Bool_t gi)
TGLColorSet & ColorSet()
Return reference to current color-set (top of the stack).
Bool_t GetGrabImage() const
void StartStopwatch()
Start the stopwatch.
void StopStopwatch()
Stop the stopwatch.
void EndSelection(Int_t glResult)
End selection.
void SetDrawPass(Short_t dpass)
Scene base-class – provides basic interface expected by the TGLViewer or its sub-classes:
virtual void PostRender(TGLRnrCtx &rnrCtx)
Perform post-render clean-up.
virtual void PreRender(TGLRnrCtx &rnrCtx)
Perform pre-render initialization - fill rnrCtx with values stored during PreDraw().
Base class for extended scene context.
TGLSceneBase * GetScene() const
Implements VirtualViewer3D interface and fills the base-class visualization structures from pad conte...
virtual void PadPaintFromViewer(TGLViewer *viewer)
Entry point for requesting update of scene's contents from gl-viewer.
TVirtualPad * GetPad() const
UInt_t * RawRecord(Int_t i)
void SetRawOnly(UInt_t *data)
Setup the record from raw buffer.
Standard selection record including information about containing scene and details ob out selected ob...
static Bool_t AreSameSelectionWise(const TGLSelectRecord &r1, const TGLSelectRecord &r2)
Check if the records imply the same selection result, that is, their secondary members are all equal.
Bool_t GetTransparent() const
TGLLogicalShape * GetLogShape() const
TGLPhysicalShape * GetPhysShape() const
virtual void Reset()
Reinitialise all data to null values.
void Print()
Print contents of the select record to stdout.
TGLSceneInfo * GetSceneInfo() const
Stopwatch object for timing GL work.
void Start()
Start timing.
Double_t End()
End timing, return total time since Start(), in milliseconds.
Wrapper class for various misc static functions - error checking, draw helpers etc.
static void DrawSphere(const TGLVertex3 &position, Double_t radius, const UChar_t rgba[4])
Draw sphere, centered on vertex 'position', with radius 'radius', color 'rgba'.
static const UChar_t fgWhite[4]
static void SetLineWidthScale(Float_t scale)
Set global line-width scale.
static Int_t CheckError(const char *loc)
Check current GL error state, outputting details via ROOT Error method if one.
static void ColorAlpha(const TGLColor &color, UChar_t alpha)
Set color from TGLColor and alpha value.
static Int_t GetPickingRadius()
Returns picking radius.
static void SetPointSizeScale(Float_t scale)
Set global point-size scale.
static const UChar_t fgGreen[4]
static void PointToViewport(Int_t &x, Int_t &y)
Convert from point/screen coordinates to GL viewport coordinates.
static void DrawReferenceMarker(const TGLCamera &camera, const TGLVertex3 &pos, Float_t radius=3, const UChar_t *rgba=0)
Draw a sphere- marker on world-coordinate 'pos' with pixel radius 'radius'.
static void DrawSimpleAxes(const TGLCamera &camera, const TGLBoundingBox &bbox, Int_t axesType)
Draw simple xyz-axes for given bounding-box.
3 component (x/y/z) vector class.
3 component (x/y/z) vertex class.
void Set(Double_t x, Double_t y, Double_t z)
virtual void PreRenderOverlaySelection()
Perform minimal initialization for overlay selection.
Bool_t FindClosestOpaqueRecord(TGLSelectRecord &rec, Int_t &recIdx)
Find next select record that can be resolved and whose result is not transparent, starting from posit...
virtual void ResetSceneInfos()
Force rebuild of view-dependent scene-info structures.
TGLSceneInfo * AddScene(TGLSceneBase *scene)
Add new scene, appropriate scene-info is created.
virtual void RemoveOverlayElement(TGLOverlayElement *el)
Remove overlay element.
virtual void RenderOverlay(Int_t state, Bool_t selection)
Render overlay objects.
virtual void Render()
Render all scenes.
virtual void PostRenderOverlaySelection()
Perform cleanup after overlay selection.
virtual void PreRender()
Initialize render-context, setup camera, GL, render-area.
virtual void PostRender()
Function called after rendering is finished.
Bool_t FindClosestOverlayRecord(TGLOvlSelectRecord &rec, Int_t &recIdx)
Find next overlay-select record that can be resolved, starting from position 'recIdx'.
virtual void MergeSceneBBoxes(TGLBoundingBox &bbox)
Merge bounding-boxes of all active registered scenes.
TGLBoundingBox fOverallBoundingBox
std::list< TGLSceneInfo * > SceneInfoList_t
virtual void RenderSelectedForHighlight()
Render selected objects from all scenes for highlight.
SceneInfoList_t::iterator SceneInfoList_i
virtual void AddOverlayElement(TGLOverlayElement *el)
Add overlay element.
Bool_t FindClosestRecord(TGLSelectRecord &rec, Int_t &recIdx)
Find next select record that can be resolved, starting from position 'recIdx'.
Base GL viewer object - used by both standalone and embedded (in pad) GL.
TGLRedrawTimer * fRedrawTimer
virtual void MouseOver(TGLPhysicalShape *)
Emit MouseOver signal.
void SetDrawCameraCenter(Bool_t x)
Draw camera look at and rotation point.
TGLAutoRotator * fAutoRotator
Float_t fLineScale
size scale for points
void FadeView(Float_t alpha)
Draw a rectangle (background color and given alpha) across the whole viewport.
Bool_t SavePictureScale(const TString &fileName, Float_t scale, Bool_t pixel_object_scale=kTRUE)
Save picture with given scale to current window size.
TGLCamera * fCurrentCamera
TGLCameraOverlay * fCameraOverlay
reference marker on?
virtual void RefreshPadEditor(TObject *obj=0)
Update GED editor if it is set.
Bool_t fAxesDepthTest
axes type
virtual void SetEventHandler(TGEventHandler *handler)
Set the event-handler.
TGLPerspectiveCamera fPerspectiveCameraYOZ
TGLOrthoCamera fOrthoXOYCamera
TGLSelectRecord fSelRec
select record in use as selected
virtual void ReMouseOver(TObject *obj, UInt_t state)
Emit MouseOver signal.
TImage * GetPictureUsingFBO(Int_t w, Int_t h, Float_t pixel_object_scale=0)
Returns current image.
TGLOrthoCamera fOrthoXnOZCamera
static TGLColorSet & GetDefaultColorSet()
Returns reference to the default color-set.
virtual void RemoveOverlayElement(TGLOverlayElement *el)
Remove overlay element.
void InitGL()
Initialise GL state.
virtual void SetupClipObject()
name says it all
void SetAutoRotator(TGLAutoRotator *ar)
Set the auto-rotator for this viewer. The old rotator is deleted.
virtual void Clicked(TObject *obj)
Emit Clicked signal.
void MakeCurrent() const
Make GL context current.
Bool_t fIsPrinting
debug mode (forced rebuild + draw scene/frustum/interest boxes)
static TGLColorSet fgDefaultColorSet
fade the view (0 - no fade/default, 1 - full fade/no rendering done)
TGEventHandler * fEventHandler
select record from last overlay select
TGLPerspectiveCamera fPerspectiveCameraXOY
TGLOrthoCamera fOrthoZnOYCamera
TGLRect fViewport
max time for scene rendering at high LOD (in ms)
virtual void SelectionChanged()
Update GUI components for embedded viewer selection change.
virtual void UnClicked(TObject *obj, UInt_t button, UInt_t state)
Emit UnClicked signal with button id and modifier state.
void SetPerspectiveCamera(ECameraType camera, Double_t fov, Double_t dolly, Double_t center[3], Double_t hRotate, Double_t vRotate)
Set a perspective camera to supplied configuration - note this does not need to be the current camera...
TGLVertex3 fReferencePos
reference marker on?
Bool_t RequestOverlaySelect(Int_t x, Int_t y)
Post request for secondary selection rendering of selected object around the window point (x,...
static Bool_t IsUsingDefaultColorSetForNewViewers()
Returns the value of the static flag that determines if new viewers should use the default color-set.
virtual void MouseIdle(TGLPhysicalShape *, UInt_t, UInt_t)
Emit MouseIdle signal.
Bool_t SavePictureWidth(const TString &fileName, Int_t width, Bool_t pixel_object_scale=kTRUE)
Save picture with given width (height scaled proportionally).
void DoDrawStereo(Bool_t swap_buffers)
Draw out in stereoscopic mode.
void RequestDraw(Short_t LOD=TGLRnrCtx::kLODMed)
Post request for redraw of viewer at level of detail 'LOD' Request is directed via cross thread gVirt...
void SetGuideState(Int_t axesType, Bool_t axesDepthTest, Bool_t referenceOn, const Double_t *referencePos)
Set the state of guides (axes & reference markers) from arguments.
void DoDraw(Bool_t swap_buffers=kTRUE)
Draw out the viewer.
TGLOrthoCamera fOrthoZOYCamera
void SwitchColorSet()
Switch between dark and light colorsets.
virtual void PadPaint(TVirtualPad *pad)
Entry point for updating viewer contents via VirtualViewer3D interface.
TGLPShapeObj * fPShapeWrap
GED editor.
TGLSelectRecord fSecSelRec
select record from last select (should go to context)
void DrawDebugInfo()
If in debug mode draw camera aids and overall bounding box.
void AutoFade(Float_t fade, Float_t time=1, Int_t steps=10)
Animate fading from current value to fade over given time (sec) and number of steps.
Bool_t fReferenceOn
remove guides hidden-lines
TGLCamera & CurrentCamera() const
void SetCurrentCamera(ECameraType camera)
Set current active camera - 'cameraType' one of: kCameraPerspX, kCameraPerspY, kCameraPerspZ,...
void SetupCameras(Bool_t reset)
Setup cameras for current bounding box.
Bool_t fResetCamerasOnUpdate
virtual void PrintObjects()
Pass viewer for print capture by TGLOutput.
Int_t fAxesType
smooth line edge rendering
void SetStereo(Bool_t stereo, Bool_t quad_buf=kTRUE)
Enable stereo rendering.
virtual void ExecuteEvent(Int_t event, Int_t px, Int_t py)
Process event of type 'event' - one of EEventType types, occurring at window location px,...
TImage * GetPictureUsingBB()
Returns current image.
TGLCamera & RefCamera(ECameraType camera)
Return camera reference by type.
TContextMenu * fContextMenu
external pad - remove replace with signal
void UseLightColorSet()
Use the light color-set.
Bool_t IsUsingDefaultColorSet() const
Check if the viewer is using the default color set.
Bool_t DoSelect(Int_t x, Int_t y)
Perform GL selection, picking objects overlapping WINDOW area described by 'rect'.
void PreDraw()
Perform GL work which must be done before each draw.
Float_t fStereoZeroParallax
draw quad buffer or left/right stereo in left/right half of window
virtual Int_t DistancetoPrimitive(Int_t px, Int_t py)
Calculate and return pixel distance to nearest viewer object from window location px,...
virtual void Render()
Normal rendering, used by mono and stereo rendering.
virtual void PostSceneBuildSetup(Bool_t resetCameras)
Perform post scene-build setup.
Float_t fStereoEyeOffsetFac
position of zero-parallax plane: 0 - near clipping plane, 1 - far clipping plane
virtual ~TGLViewer()
Destroy viewer object.
Bool_t SavePictureUsingBB(const TString &fileName)
Save current image in various formats (gif, gif+, jpg, png).
Bool_t SavePicture()
Save current image using the default file name which can be set via SetPictureFileName() and defaults...
Float_t fFader
default file-name for SavePicture()
virtual void PostRender()
Restore state set in PreRender().
void UpdateScene(Bool_t redraw=kTRUE)
Force update of pad-scenes.
TGLOrthoCamera fOrthoZOXCamera
Bool_t SavePictureUsingFBO(const TString &fileName, Int_t w, Int_t h, Float_t pixel_object_scale=0)
Save current image in various formats (gif, gif+, jpg, png).
friend class TGLAutoRotator
TGLOrthoCamera fOrthoXOZCamera
Bool_t GetClipAutoUpdate() const
virtual void OverlayDragFinished()
An overlay operation can result in change to an object.
Bool_t SavePictureHeight(const TString &fileName, Int_t height, Bool_t pixel_object_scale=kTRUE)
Save picture with given height (width scaled proportionally).
void SetOrthoCamera(ECameraType camera, Double_t zoom, Double_t dolly, Double_t center[3], Double_t hRotate, Double_t vRotate)
Set an orthographic camera to supplied configuration - note this does not need to be the current came...
void DrawGuides()
Draw reference marker and coordinate axes.
void UseDefaultColorSet(Bool_t x)
Set usage of the default color set.
Float_t fMaxSceneDrawTimeHQ
timer for triggering redraws
Bool_t RequestSecondarySelect(Int_t x, Int_t y)
Request secondary select.
TGedEditor * fGedEditor
event handler
void SetViewport(Int_t x, Int_t y, Int_t width, Int_t height)
Set viewer viewport (window area) with bottom/left at (x,y), with dimensions 'width'/'height'.
Float_t fPointScale
color-set with light background
TGLColorSet fLightColorSet
color-set with dark background
virtual void PreRender()
Initialize objects that influence rendering.
virtual void UnMouseOver(TObject *obj, UInt_t state)
Emit UnMouseOver signal.
virtual void ReClicked(TObject *obj, UInt_t button, UInt_t state)
Emit ReClicked signal with button id and modifier state.
Bool_t fResetCamerasOnNextUpdate
Bool_t fSmoothPoints
width scale for lines
TGLOrthoCamera fOrthoZnOXCamera
Float_t fMaxSceneDrawTimeLQ
max time for scene rendering at high LOD (in ms)
Bool_t fSmoothLines
smooth point edge rendering
TGLManipSet * fSelectedPShapeRef
select record from last secondary select (should go to context)
void ClearCurrentOvlElm()
Reset current overlay-element to zero, eventually notifying the old one that the mouse has left.
void ApplySelection()
Process result from last selection (in fSelRec) and extract a new current selection from it.
TGLColorSet fDarkColorSet
viewport - drawn area
void InitSecondaryObjects()
Common initialization.
Bool_t DoSecondarySelect(Int_t x, Int_t y)
Secondary selection.
void UseDarkColorSet()
Use the dark color-set.
Bool_t RequestSelect(Int_t x, Int_t y)
Post request for selection render pass viewer, picking objects around the window point (x,...
void SetClearColor(Color_t col)
Set background method.
Bool_t DoOverlaySelect(Int_t x, Int_t y)
Perform GL selection, picking overlay objects only.
Bool_t fDrawCameraCenter
reference position
void ReinitializeCurrentCamera(const TGLVector3 &hAxis, const TGLVector3 &vAxis, Bool_t redraw=kTRUE)
Change base-vectors defining the camera-base transformation of current camera.
Bool_t IsColorSetDark() const
Returns true if current color set is dark.
void PostDraw()
Perform GL work which must be done after each draw.
TGLAutoRotator * GetAutoRotator()
Get the auto-rotator for this viewer.
TGLPerspectiveCamera fPerspectiveCameraXOZ
const TGLPhysicalShape * GetSelected() const
Return selected physical shape.
TGLViewer(const TGLViewer &)
Float_t fStereoFrustumAsymFac
Bool_t fDebugMode
cache logicals during scene rebuilds
TGLOrthoCamera fOrthoXnOYCamera
static Bool_t fgUseDefaultColorSetForNewViewers
a shared, default color-set
void GetGuideState(Int_t &axesType, Bool_t &axesDepthTest, Bool_t &referenceOn, Double_t *referencePos) const
Fetch the state of guides (axes & reference markers) into arguments.
TGLSelectRecord fCurrentSelRec
void DoDrawMono(Bool_t swap_buffers)
Draw out in monoscopic mode.
Bool_t fStereoQuadBuf
use stereo rendering
TGLContextIdentity * fGLCtxId
for embedded gl viewer
static void UseDefaultColorSetForNewViewers(Bool_t x)
Sets static flag that determines if new viewers should use the default color-set.
TGLOvlSelectRecord fOvlSelRec
current overlay element
TGLOverlayElement * fCurrentOvlElm
void SwapBuffers() const
Swap GL buffers.
void ResetCurrentCamera()
Resets position/rotation of current camera to default values.
virtual Bool_t IsMapped()
Returns kTRUE if window is mapped on screen, kFALSE otherwise.
virtual void SetModel(TVirtualPad *pad, TObject *obj, Int_t event, Bool_t force=kFALSE)
Activate object editors according to the selected object.
virtual TObject * GetModel() const
An abstract interface to image processing library.
static TImage * Create()
Create an image.
virtual void FromGLBuffer(UChar_t *, UInt_t, UInt_t)
Mother of all ROOT objects.
virtual void Warning(const char *method, const char *msgfmt,...) const
Issue warning message.
virtual void ExecuteEvent(Int_t event, Int_t px, Int_t py)
Execute action corresponding to an event at (px,py).
virtual void Error(const char *method, const char *msgfmt,...) const
Issue error message.
virtual void Info(const char *method, const char *msgfmt,...) const
Issue info message.
void Emit(const char *signal, const T &arg)
Activate signal with single parameter.
Bool_t EndsWith(const char *pat, ECaseCompare cmp=kExact) const
Return true if string ends with the specified string.
const char * Data() const
Bool_t Contains(const char *pat, ECaseCompare cmp=kExact) const
static void SingleShot(Int_t milliSec, const char *receiver_class, void *receiver, const char *method)
This static function calls a slot after a given time interval.
TVirtualPad is an abstract base class for the Pad and Canvas classes.
virtual void ReleaseViewer3D(Option_t *type="")=0
void box(Int_t pat, Double_t x1, Double_t y1, Double_t x2, Double_t y2)
Int_t Nint(T x)
Round to nearest integer. Rounds half integers to the nearest even integer.
constexpr Double_t DegToRad()
Conversion from degree to radian:
Int_t CeilNint(Double_t x)