64 #define GL_BGRA GL_BGRA_EXT
113 fCurrentCamera(&fPerspectiveCameraXOZ),
118 fStereoZeroParallax (0.03
f),
119 fStereoEyeOffsetFac (1.0
f),
120 fStereoFrustumAsymFac (1.0
f),
124 fSelectedPShapeRef (0),
130 fPushAction(kPushStd), fDragAction(
kDragNone),
132 fMaxSceneDrawTimeHQ(5000),
133 fMaxSceneDrawTimeLQ(100),
134 fPointScale (1), fLineScale(1), fSmoothPoints(
kFALSE), fSmoothLines(
kFALSE),
136 fAxesDepthTest(
kTRUE),
138 fReferencePos(0.0, 0.0, 0.0),
139 fDrawCameraCenter(
kFALSE),
144 fPictureFileName(
"viewer.jpg"),
149 fIgnoreSizesOnUpdate(
kFALSE),
150 fResetCamerasOnUpdate(
kTRUE),
151 fResetCamerasOnNextUpdate(
kFALSE)
177 fCurrentCamera(&fPerspectiveCameraXOZ),
182 fStereoZeroParallax (0.03
f),
183 fStereoEyeOffsetFac (1.0
f),
184 fStereoFrustumAsymFac (1.0
f),
188 fSelectedPShapeRef (0),
194 fPushAction(kPushStd), fDragAction(
kDragNone),
196 fMaxSceneDrawTimeHQ(5000),
197 fMaxSceneDrawTimeLQ(100),
198 fPointScale (1), fLineScale(1), fSmoothPoints(
kFALSE), fSmoothLines(
kFALSE),
200 fAxesDepthTest(
kTRUE),
202 fReferencePos(0.0, 0.0, 0.0),
203 fDrawCameraCenter(
kFALSE),
208 fPictureFileName(
"viewer.jpg"),
211 fGLDevice(fPad->GetGLDevice()),
213 fIgnoreSizesOnUpdate(
kFALSE),
214 fResetCamerasOnUpdate(
kTRUE),
215 fResetCamerasOnNextUpdate(
kFALSE)
229 Int_t viewport[4] = {0};
231 SetViewport(viewport[0], viewport[1], viewport[2], viewport[3]);
307 scenepad =
dynamic_cast<TGLScenePad*
>((*si)->GetScene());
308 if (scenepad && scenepad->
GetPad() == pad)
409 glEnable(GL_LIGHTING);
410 glEnable(GL_DEPTH_TEST);
411 glEnable(GL_CULL_FACE);
413 glClearColor(0.
f, 0.
f, 0.
f, 0.
f);
415 glColorMaterial(GL_FRONT_AND_BACK, GL_DIFFUSE);
416 glEnable(GL_COLOR_MATERIAL);
417 glMaterialf(GL_BACK, GL_SHININESS, 0.0);
418 glPolygonMode(GL_FRONT, GL_FILL);
421 glLightModeli(GL_LIGHT_MODEL_LOCAL_VIEWER, GL_TRUE);
422 Float_t lmodelAmb[] = {0.5f, 0.5f, 1.f, 1.f};
423 glLightModelfv(GL_LIGHT_MODEL_AMBIENT, lmodelAmb);
424 glLightModeli(GL_LIGHT_MODEL_TWO_SIDE, GL_FALSE);
426 glHint(GL_POINT_SMOOTH_HINT, GL_NICEST);
427 glHint(GL_LINE_SMOOTH_HINT, GL_NICEST);
450 Info(
"TGLViewer::RequestDraw",
"viewer locked - requesting another draw.");
458 gROOT->ProcessLineFast(
Form(
"((TGLViewer *)0x%lx)->DoDraw()", (
ULong_t)
this));
494 if (
fSmoothPoints) glEnable(GL_POINT_SMOOTH);
else glDisable(GL_POINT_SMOOTH);
495 if (
fSmoothLines) glEnable(GL_LINE_SMOOTH);
else glDisable(GL_LINE_SMOOTH);
498 glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
527 glClear(GL_DEPTH_BUFFER_BIT);
568 Info(
"TGLViewer::DoDraw()",
"zero surface area, draw skipped.");
574 Int_t viewport[4] = {};
576 SetViewport(viewport[0], viewport[1], viewport[2], viewport[3]);
602 Info(
"TGLViewer::DoDraw()",
"Took %f msec", timer.
End());
660 Float_t gl_near, gl_far, zero_p_dist;
662 Float_t x_len_at_zero_parallax;
671 glDrawBuffer(GL_BACK_LEFT);
676 glEnable(GL_SCISSOR_TEST);
688 x_len_at_zero_parallax = 2.0f * w_half * zero_p_dist / gl_near;
695 TGLVector3 left_vec = abs_trans.GetBaseVec(2);
697 glTranslatef(stereo_offset*left_vec[0], stereo_offset*left_vec[1], stereo_offset*left_vec[2]);
699 glMatrixMode(GL_PROJECTION);
701 glFrustum(-w_half + frustum_asym, w_half + frustum_asym,
702 -h_half, h_half, gl_near, gl_far);
703 glMatrixMode(GL_MODELVIEW);
723 glDrawBuffer(GL_BACK_RIGHT);
736 glTranslatef(-stereo_offset*left_vec[0], -stereo_offset*left_vec[1], -stereo_offset*left_vec[2]);
738 glMatrixMode(GL_PROJECTION);
740 glFrustum(-w_half - frustum_asym, w_half - frustum_asym,
741 -h_half, h_half, gl_near, gl_far);
742 glMatrixMode(GL_MODELVIEW);
767 glDrawBuffer(GL_BACK);
771 glDisable(GL_SCISSOR_TEST);
813 if (GLEW_EXT_framebuffer_object &&
gEnv->
GetValue(
"OpenGL.SavePicturesViaFBO", 1))
834 static const TString eh(
"TGLViewer::SavePictureUsingBB");
839 Warning(eh,
"file %s cannot be saved with this extension.", fileName.
Data());
844 Error(eh,
"viewer locked - try later.");
854 gROOT->ProcessLineFast(
Form(
"((TGLViewer *)0x%lx)->DoDraw(kFALSE)", (
ULong_t)
this));
860 glReadBuffer(GL_BACK);
863 glPixelStorei(GL_PACK_ALIGNMENT, 1);
865 GL_BGRA, GL_UNSIGNED_BYTE, xx);
869 image->WriteImage(fileName);
892 static const TString eh(
"TGLViewer::SavePictureUsingFBO");
897 Warning(eh,
"file %s cannot be saved with this extension.", fileName.
Data());
902 Error(eh,
"viewer locked - try later.");
915 catch (std::runtime_error& exc)
917 Error(eh,
"%s",exc.what());
918 if (
gEnv->
GetValue(
"OpenGL.SavePictureFallbackToBB", 1)) {
919 Info(eh,
"Falling back to saving image via back-buffer. Window must be fully visible.");
921 Warning(eh,
"Back-buffer does not support image scaling, window size will be used.");
932 if (pixel_object_scale != 0)
944 gROOT->ProcessLineFast(
Form(
"((TGLViewer *)0x%lx)->DoDraw(kFALSE)", (
ULong_t)
this));
955 glPixelStorei(GL_PACK_ALIGNMENT, 1);
957 GL_BGRA, GL_UNSIGNED_BYTE, xx);
961 image->WriteImage(fileName);
967 if (pixel_object_scale != 0)
985 static const TString eh(
"TGLViewer::GetPictureUsingBB");
988 Error(eh,
"viewer locked - try later.");
998 gROOT->ProcessLineFast(
Form(
"((TGLViewer *)0x%lx)->DoDraw(kFALSE)", (
ULong_t)
this));
1004 glReadBuffer(GL_BACK);
1007 glPixelStorei(GL_PACK_ALIGNMENT, 1);
1009 GL_BGRA, GL_UNSIGNED_BYTE, xx);
1032 static const TString eh(
"TGLViewer::GetPictureUsingFBO");
1035 Error(eh,
"viewer locked - try later.");
1048 catch (std::runtime_error& exc)
1050 Error(eh,
"%s",exc.what());
1051 if (
gEnv->
GetValue(
"OpenGL.GetPictureFallbackToBB", 1)) {
1052 Info(eh,
"Falling back to saving image via back-buffer. Window must be fully visible.");
1054 Warning(eh,
"Back-buffer does not support image scaling, window size will be used.");
1065 if (pixel_object_scale != 0)
1077 gROOT->ProcessLineFast(
Form(
"((TGLViewer *)0x%lx)->DoDraw(kFALSE)", (
ULong_t)
this));
1088 glPixelStorei(GL_PACK_ALIGNMENT, 1);
1090 GL_BGRA, GL_UNSIGNED_BYTE, xx);
1108 Bool_t pixel_object_scale)
1122 Bool_t pixel_object_scale)
1136 Bool_t pixel_object_scale)
1152 glDisable(GL_DEPTH_TEST);
1158 glDisable(GL_DEPTH_TEST);
1160 const UChar_t rgba[4] = { 0, 255, 255, 255 };
1166 glEnable(GL_DEPTH_TEST);
1171 glDisable(GL_DEPTH_TEST);
1176 glEnable(GL_DEPTH_TEST);
1186 glDisable(GL_LIGHTING);
1190 glColor3d(0.0, 1.0, 0.0);
1194 glDisable(GL_DEPTH_TEST);
1199 glEnable(GL_DEPTH_TEST);
1201 glEnable(GL_LIGHTING);
1218 color->
GetRGB(rgb[0], rgb[1], rgb[2]);
1220 rgb[0] = rgb[1] = rgb[2] = 0.0f;
1222 glClearColor(rgb[0], rgb[1], rgb[2], 0.0
f);
1225 glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT);
1245 static const Float_t z = -1.0f;
1247 glMatrixMode(GL_PROJECTION); glPushMatrix(); glLoadIdentity();
1248 glMatrixMode(GL_MODELVIEW); glPushMatrix(); glLoadIdentity();
1253 glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
1256 glVertex3f(-1, -1, z); glVertex3f( 1, -1, z);
1257 glVertex3f( 1, 1, z); glVertex3f(-1, 1, z);
1261 glMatrixMode(GL_PROJECTION); glPopMatrix();
1262 glMatrixMode(GL_MODELVIEW); glPopMatrix();
1307 return Bool_t(
gROOT->ProcessLineFast(
Form(
"((TGLViewer *)0x%lx)->DoSelect(%d, %d)", (
ULong_t)
this, x, y)));
1335 glRenderMode(GL_SELECT);
1341 Int_t nHits = glRenderMode(GL_RENDER);
1345 if (
gDebug > 0)
Info(
"TGLViewer::DoSelect",
"Primary select nHits=%d.", nHits);
1380 return Bool_t(
gROOT->ProcessLineFast(
Form(
"((TGLViewer *)0x%lx)->DoSecondarySelect(%d, %d)", (
ULong_t)
this, x, y)));
1405 Info(
"TGLViewer::SecondarySelect",
"Skipping secondary selection "
1406 "(sinfo=0x%lx, pshape=0x%lx).\n",
1419 foo.push_back(sinfo);
1423 glRenderMode(GL_SELECT);
1430 glPushName(pshp->
ID());
1438 Int_t nSecHits = glRenderMode(GL_RENDER);
1442 if (
gDebug > 0)
Info(
"TGLViewer::DoSelect",
"Secondary select nSecHits=%d.", nSecHits);
1490 return Bool_t(
gROOT->ProcessLineFast(
Form(
"((TGLViewer *)0x%lx)->DoOverlaySelect(%d, %d)", (
ULong_t)
this, x, y)));
1515 glRenderMode(GL_SELECT);
1521 Int_t nHits = glRenderMode(GL_RENDER);
1575 delete this;
return;
1590 "TGLFaderHelper",
this,
"MakeFadeStep()");
1628 Info(
"SwitchColorSet()",
"Global color-set is in use, switch not supported.");
1727 Info(
"TGLViewer::SetViewport",
"updated - corner %d,%d dimensions %d,%d", x, y, width, height);
1748 switch(cameraType) {
1768 Error(
"TGLViewer::SetCurrentCamera",
"invalid camera type");
1827 Error(
"TGLViewer::SetCurrentCamera",
"invalid camera type");
1900 Error(
"TGLViewer::SetOrthoCamera",
"invalid camera type");
1948 Error(
"TGLViewer::SetPerspectiveCamera",
"invalid camera type");
2069 Emit(
"MouseOver(TGLPhysicalShape*)", (
Long_t)shape);
2080 Emit(
"MouseOver(TGLPhysicalShape*,UInt_t)", args);
2091 Emit(
"MouseOver(TObject*,UInt_t)", args);
2102 Emit(
"ReMouseOver(TObject*,UInt_t)", args);
2114 Emit(
"UnMouseOver(TObject*,UInt_t)", args);
2134 Emit(
"Clicked(TObject*,UInt_t,UInt_t)", args);
2147 Emit(
"ReClicked(TObject*,UInt_t,UInt_t)", args);
2159 Emit(
"UnClicked(TObject*,UInt_t,UInt_t)", args);
2168 static UInt_t oldx = 0, oldy = 0;
2170 if (oldx != posx || oldy != posy) {
2174 Emit(
"MouseIdle(TGLPhysicalShape*,UInt_t,UInt_t)", args);
2191 gPad->SetSelected(
this);
TGEventHandler * fEventHandler
select record from last overlay select
void FadeView(Float_t alpha)
Draw a rectangle (background color and given alpha) across the whole viewport.
Int_t fAxesType
smooth line edge rendering
TGLCamera * fCurrentCamera
virtual Bool_t SupportsSecondarySelect() const
A GL overlay element which displays camera furstum.
TGLVertex3 fReferencePos
reference marker on?
void SetSecSelection(Bool_t secSel)
TVirtualPad * GetPad() const
virtual void ReMouseOver(TObject *obj, UInt_t state)
Emit MouseOver signal.
Class encapsulating a set of colors used throughout standard rendering.
void DrawDebugAids() const
Draw out some debugging aids for the camera:
TGLSelectRecord fSelRec
select record in use as selected
Bool_t GetGrabImage() const
Bool_t fStereoQuadBuf
use stereo rendering
TGLColorSet fLightColorSet
color-set with dark background
virtual void PadPaint(TVirtualPad *pad)
Entry point for updating viewer contents via VirtualViewer3D interface.
Abstract base camera class - concrete classes for orthographic and perspective cameras derive from it...
TGLPerspectiveCamera fPerspectiveCameraXOZ
virtual void PreRender()
Initialize objects that influence rendering.
void Start()
Start timing.
Wrapper class for various misc static functions - error checking, draw helpers etc.
void ReinitializeCurrentCamera(const TGLVector3 &hAxis, const TGLVector3 &vAxis, Bool_t redraw=kTRUE)
Change base-vectors defining the camera-base transformation of current camera.
void StdLightBackground()
Set defaults for light (white) background.
Float_t fLineScale
size scale for points
Wrap TGLPysicalShape into TObject so that it can be edited using GED.
void Unbind()
Unbind the frame-buffer object.
virtual void MouseOver(TGLPhysicalShape *)
Emit MouseOver signal.
void SwitchColorSet()
Switch between dark and light colorsets.
TGLAutoRotator * fAutoRotator
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'.
TGLVector3 GetTranslation() const
Return the translation component of matrix.
std::list< TGLSceneInfo * > SceneInfoList_t
16 component (4x4) transform matrix - column MAJOR as per GL.
ELock CurrentLock() const
virtual void Render()
Render all scenes.
TGLOrthoCamera fOrthoXnOZCamera
Identifier of a shared GL-context.
virtual void Info(const char *method, const char *msgfmt,...) const
Issue info message.
static void DrawSimpleAxes(const TGLCamera &camera, const TGLBoundingBox &bbox, Int_t axesType)
Draw simple xyz-axes for given bounding-box.
void Bind()
Bind the frame-buffer object.
void ResetCurrentCamera()
Resets position/rotation of current camera to default values.
void SetupCameras(Bool_t reset)
Setup cameras for current bounding box.
TGLOrthoCamera fOrthoXOZCamera
static TGLColorSet & GetDefaultColorSet()
Returns reference to the default color-set.
TGLOrthoCamera fOrthoXOYCamera
TGLCamera & RefCamera(ECameraType camera)
Return camera reference by type.
Bool_t RequestOverlaySelect(Int_t x, Int_t y)
Post request for secondary selection rendering of selected object around the window point (x...
virtual void SetEventHandler(TGEventHandler *handler)
Set the event-handler.
Stopwatch object for timing GL work.
virtual void SetPShape(TGLPhysicalShape *shape)
Set phys-shape, override of virtual from TGLPShapeRef.
Scene base-class – provides basic interface expected by the TGLViewer or its sub-classes: ...
Float_t fStereoEyeOffsetFac
position of zero-parallax plane: 0 - near clipping plane, 1 - far clipping plane
virtual void PreRender(TGLRnrCtx &rnrCtx)
Perform pre-render initialization - fill rnrCtx with values stored during PreDraw().
virtual void Reset()
Reinitialise all data to null values.
Bool_t FindClosestRecord(TGLSelectRecord &rec, Int_t &recIdx)
Find next select record that can be resolved, starting from position 'recIdx'.
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...
Short_t SelectTransparents() const
void SetGrabImage(Bool_t gi)
void MakeFadeStep()
Make one fading step and request redraw.
void DoDraw(Bool_t swap_buffers=kTRUE)
Draw out the viewer.
TGLVertex3 Center() const
virtual void RemoveOverlayElement(TGLOverlayElement *el)
Remove overlay element.
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.
Bool_t SavePictureScale(const TString &fileName, Float_t scale, Bool_t pixel_object_scale=kTRUE)
Save picture with given scale to current window size.
R__EXTERN TVirtualMutex * gROOTMutex
static void PointToViewport(Int_t &x, Int_t &y)
Convert from point/screen coordinates to GL viewport coordinates.
void SetRawOnly(UInt_t *data)
Setup the record from raw buffer.
void SetDrawCameraCenter(Bool_t x)
Draw camera look at and rotation point.
virtual void SetModel(TVirtualPad *pad, TObject *obj, Int_t event)
Activate object editors according to the selected object.
TGLClip * GetCurrentClip() const
An abstract interface to image processing library.
Bool_t SavePictureHeight(const TString &fileName, Int_t height, Bool_t pixel_object_scale=kTRUE)
Save picture with given height (width scaled proportionally).
Bool_t IsUsingDefaultColorSet() const
Check if the viewer is using the default color set.
Bool_t RequestSecondarySelect(Int_t x, Int_t y)
Request secondary select.
virtual void UnMouseOver(TObject *obj, UInt_t state)
Emit UnMouseOver signal.
void box(Int_t pat, Double_t x1, Double_t y1, Double_t x2, Double_t y2)
UInt_t * RawRecord(Int_t i)
virtual TObject * GetModel() const
Perspective projection camera - with characteristic foreshortening.
Double_t GetFarClip() const
virtual void PostRender()
Restore state set in PreRender().
void Set(Double_t x, Double_t y, Double_t z)
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...
Encapsulates a set of lights for OpenGL.
void StartStopwatch()
Start the stopwatch.
void UseLightColorSet()
Use the light color-set.
Combine all available manipulators in a collection.
void SetShapeLOD(Short_t LOD)
static void UseDefaultColorSetForNewViewers(Bool_t x)
Sets static flag that determines if new viewers should use the default color-set. ...
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 SetClearColor(Color_t col)
Set background method.
Concrete physical shape - a GL drawable.
virtual void Render()
Normal rendering, used by mono and stereo rendering.
const char * Data() const
TGLOverlayElement * GetOvlElement() const
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.
static TGLColorSet fgDefaultColorSet
fade the view (0 - no fade/default, 1 - full fade/no rendering done)
void Release(TGLContext *ctx)
Remove context ctx from the list of references.
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...
TGLSelectRecord fCurrentSelRec
virtual void PostRenderOverlaySelection()
Perform cleanup after overlay selection.
virtual void OverlayDragFinished()
An overlay operation can result in change to an object.
Bool_t fDebugMode
cache logicals during scene rebuilds
TGLRedrawTimer * fRedrawTimer
Double_t GetNearClip() const
virtual void Draw(TGLRnrCtx &rnrCtx) const
Draw physical shape, using LOD flags, potential from display list cache.
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'...
virtual void ReleaseViewer3D(Option_t *type="")=0
3 component (x/y/z) vertex class.
TGLContextIdentity * fGLCtxId
for embedded gl viewer
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'.
virtual void PostSceneBuildSetup(Bool_t resetCameras)
Perform post scene-build setup.
UChar_t mod R__LOCKGUARD2(gSrvAuthenticateMutex)
virtual void Setup(const TGLBoundingBox &box, Bool_t reset=kTRUE)=0
Float_t GetRenderScale() const
void StopStopwatch()
Stop the stopwatch.
virtual void ResetSceneInfos()
Force rebuild of view-dependent scene-info structures.
void PostDraw()
Perform GL work which must be done after each draw.
Bool_t GetTransparent() const
void SetupCurrentClip(const TGLBoundingBox &sceneBBox)
Setup current clipping object for given scene bounding box.
void SetSceneInfo(TGLSceneInfo *si)
virtual void RenderSelectedForHighlight()
Render selected objects from all scenes for highlight.
Bool_t IsColorSetDark() const
Returns true if current color set is dark.
Viewport (pixel base) 2D rectangle class.
Bool_t fResetCamerasOnUpdate
Bool_t DoSecondarySelect(Int_t x, Int_t y)
Secondary selection.
virtual Bool_t MouseStillInside(TGLOvlSelectRecord &selRec)
3 component (x/y/z) vector class.
virtual void Error(const char *method, const char *msgfmt,...) const
Issue error message.
virtual void RemoveOverlayElement(TGLOverlayElement *el)
Remove overlay element.
void Draw(Bool_t solid=kFALSE) const
Draw the bounding box as either wireframe (default) of solid using current GL color.
void DrawGuides()
Draw reference marker and coordinate axes.
TVirtualPad is an abstract base class for the Pad and Canvas classes.
void ApplySelection()
Process result from last selection (in fSelRec) and extract a new current selection from it...
virtual void Reset()
Reinitialise all data to null values.
Bool_t fAxesDepthTest
axes type
void Emit(const char *signal)
Acitvate signal without args.
virtual void PadPaintFromViewer(TGLViewer *viewer)
Entry point for requesting update of scene's contents from gl-viewer.
TGLSelectBuffer * GetSelectBuffer() const
TGLManipSet * fSelectedPShapeRef
select record from last secondary select (should go to context)
Float_t fMaxSceneDrawTimeLQ
max time for scene rendering at high LOD (in ms)
TGLVector3 Extents() const
void UpdateScene(Bool_t redraw=kTRUE)
Force update of pad-scenes.
void InitGL()
Initialise GL state.
static void SetPointSizeScale(Float_t scale)
Set global point-size scale.
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...
Double_t * GetCenterVec()
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...
virtual void MouseLeave()
Mouse has left the element.
Float_t fFader
default file-name for SavePicture()
TGLMatrix & RefCamTrans()
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...
TGLPhysicalShape * fPShape
Automatically rotates GL camera.
TGLAutoRotator * GetAutoRotator()
Get the auto-rotator for this viewer.
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...
virtual void PrintObjects()
Pass viewer for print capture by TGLOutput.
Bool_t RequestSelect(Int_t x, Int_t y)
Post request for selection render pass viewer, picking objects around the window point (x...
static void SetLineWidthScale(Float_t scale)
Set global line-width scale.
TGLBoundingBox fOverallBoundingBox
static Bool_t IsUsingDefaultColorSetForNewViewers()
Returns the value of the static flag that determines if new viewers should use the default color-set...
Bool_t EndsWith(const char *pat, ECaseCompare cmp=kExact) const
Return true if string ends with the specified string.
virtual void PreRender()
Initialize render-context, setup camera, GL, render-area.
void RequestDraw(Int_t milliSec, Short_t redrawLOD)
Bool_t fIsPrinting
debug mode (forced rebuild + draw scene/frustum/interest boxes)
TGLCamera * GetCamera() const
static const UChar_t fgWhite[4]
TGLSceneInfo * GetSceneInfo() const
virtual Int_t GetValue(const char *name, Int_t dflt)
Returns the integer value for a resource.
Standard selection record including information about containing scene and details ob out selected ob...
virtual Color_t GetFillColor() const
virtual void GetRGB(Float_t &r, Float_t &g, Float_t &b) const
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).
void Init(int w, int h, int ms_samples=0)
Acquire GL resources for given width, height and number of multi-sampling samples.
TGLCamera & CurrentCamera() const
virtual void Clicked(TObject *obj)
Emit Clicked signal.
void SwapBuffers() const
Swap GL buffers.
TGLRect fViewport
max time for scene rendering at high LOD (in ms)
char * Form(const char *fmt,...)
Bool_t DoOverlaySelect(Int_t x, Int_t y)
Perform GL selection, picking overlay objects only.
Implements VirtualViewer3D interface and fills the base-class visualization structures from pad conte...
void DoDrawStereo(Bool_t swap_buffers)
Draw out in stereoscopic mode.
A collection of concrete TGLClip objects to be selected from.
void DeleteGLResources()
Delete GL resources registered for destruction.
TGLOvlSelectRecord fOvlSelRec
current overlay element
void UseDarkColorSet()
Use the dark color-set.
virtual void PostRender()
Function called after rendering is finished.
Bool_t ReleaseLock(ELock lock) const
Release current lock, make sure it the same as the 'lock' argument.
Base GL viewer object - used by both standalone and embedded (in pad) GL.
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.
Bool_t fSmoothPoints
width scale for lines
TGLPhysicalShape * GetPShape() const
virtual Color_t GetLineColor() const
void SetStereo(Bool_t stereo, Bool_t quad_buf=kTRUE)
Enable stereo rendering.
void SetDrawBBox(Bool_t bb)
Bool_t DoSelect(Int_t x, Int_t y)
Perform GL selection, picking objects overlapping WINDOW area described by 'rect'.
TGLColorSet * ChangeBaseColorSet(TGLColorSet *set)
Change the default/bottom color-set.
friend class TGLAutoRotator
static const UChar_t fgGreen[4]
virtual Bool_t IsPerspective() const
void Print()
Print contents of the select record to stdout.
virtual void PreRenderOverlaySelection()
Perform minimal initialization for overlay selection.
virtual void RenderOverlay(Int_t state, Bool_t selection)
Render overlay objects.
virtual void AddOverlayElement(TGLOverlayElement *el)
Add overlay element.
TImage * GetPictureUsingBB()
Returns current image.
void Stop()
Stop the auto-rotator.
virtual void Configure(Double_t fov, Double_t dolly, Double_t center[3], Double_t hRotate, Double_t vRotate)
Configure the camera state.
Bool_t fSmoothLines
smooth point edge rendering
static const char * LockName(ELock lock)
Return name-string for given lock-type.
void EndSelection(Int_t glResult)
End selection.
virtual void ExecuteEvent(Int_t event, Int_t px, Int_t py)
Execute action corresponding to an event at (px,py).
Bool_t SavePictureWidth(const TString &fileName, Int_t width, Bool_t pixel_object_scale=kTRUE)
Save picture with given width (height scaled proportionally).
void MakeCurrent() const
Make GL context current.
TGLSceneBase * GetScene() const
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'.
TGLSceneInfo * AddScene(TGLSceneBase *scene)
Add new scene, appropriate scene-info is created.
TGLOrthoCamera fOrthoXnOYCamera
void BeginSelection(Int_t x, Int_t y, Int_t r=3)
Setup context for running selection.
Bool_t GetClipAutoUpdate() const
TGLOrthoCamera fOrthoZOYCamera
static Bool_t fgUseDefaultColorSetForNewViewers
a shared, default color-set
Float_t fMaxSceneDrawTimeHQ
timer for triggering redraws
TGLOrthoCamera fOrthoZnOYCamera
Float_t fStereoZeroParallax
draw quad buffer or left/right stereo in left/right half of window
virtual Bool_t IsMapped()
Returns kTRUE if window is mapped on screen, kFALSE otherwise.
virtual void SelectionChanged()
Update GUI components for embedded viewer selection change.
virtual void ReClicked(TObject *obj, UInt_t button, UInt_t state)
Emit ReClicked signal with button id and modifier state.
Bool_t fReferenceOn
remove guides hidden-lines
Bool_t UpdateInterest(Bool_t force)
Update the internal interest box (fInterestBox) of the camera.
The color creation and management class.
Bool_t IsDrawOrSelectLock() const
Bool_t FindClosestOverlayRecord(TGLOvlSelectRecord &rec, Int_t &recIdx)
Find next overlay-select record that can be resolved, starting from position 'recIdx'.
void SetCurrentCamera(ECameraType camera)
Set current active camera - 'cameraType' one of: kCameraPerspX, kCameraPerspY, kCameraPerspZ, kCameraOrthoXOY, kCameraOrthoXOZ, kCameraOrthoZOY, kCameraOrthoXnOY, kCameraOrthoXnOZ, kCameraOrthoZnOY.
TGLCameraOverlay * fCameraOverlay
reference marker on?
virtual void MergeSceneBBoxes(TGLBoundingBox &bbox)
Merge bounding-boxes of all active registered scenes.
Bool_t TakeLock(ELock lock) const
Lock the object in mode 'lock'.
void AddRef(TGLContext *ctx)
Add context ctx to the list of references.
TContextMenu * fContextMenu
external pad - remove replace with signal
TImage * GetPictureUsingFBO(Int_t w, Int_t h, Float_t pixel_object_scale=0)
Returns current image.
static Bool_t Capture(TGLViewer &viewer, EFormat format, const char *filePath=0)
virtual void Configure(Double_t zoom, Double_t dolly, Double_t center[3], Double_t hRotate, Double_t vRotate)
Configure the camera state.
void SetDrawPass(Short_t dpass)
TGLOverlayElement * fCurrentOvlElm
void DoDrawMono(Bool_t swap_buffers)
Draw out in monoscopic mode.
Orthographic projection camera.
Mother of all ROOT objects.
static Int_t CheckError(const char *loc)
Check current GL error state, outputting details via ROOT Error method if one.
Concrete class describing an orientated (free) or axis aligned box of 8 vertices. ...
void SetupCurrentClipIfInvalid(const TGLBoundingBox &sceneBBox)
Setup current clipping object for given scene bounding box.
TGLViewer(const TGLViewer &)
Float_t fStereoFrustumAsymFac
virtual void RefreshPadEditor(TObject *obj=0)
Update GED editor if it is set.
void ClearCurrentOvlElm()
Reset current overlay-element to zero, eventually notifying the old one that the mouse has left...
Bool_t SavePictureUsingBB(const TString &fileName)
Save current image in various formats (gif, gif+, jpg, png).
Color_t GetColorIndex() const
Returns color-index representing the color.
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 InitSecondaryObjects()
Common initialization.
virtual void MouseIdle(TGLPhysicalShape *, UInt_t, UInt_t)
Emit MouseIdle signal.
Bool_t Contains(const char *pat, ECaseCompare cmp=kExact) const
virtual ~TGLViewer()
Destroy viewer object.
virtual void SetupClipObject()
name says it all
TGLPerspectiveCamera fPerspectiveCameraXOY
virtual Int_t DistancetoPrimitive(Int_t px, Int_t py)
Calculate and return pixel distance to nearest viewer object from window location px...
Base class for extended scene context.
TGLColorSet * GetBaseColorSet()
Returns the current base color-set.
static Int_t GetPickingRadius()
Returns picking radius.
ClassImp(TSlaveInfo) Int_t TSlaveInfo const TSlaveInfo * si
Used to sort slaveinfos by ordinal.
void SetRenderTimeOut(Double_t tout)
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...
TGLPhysicalShape * GetPhysShape() const
SceneInfoList_t::iterator SceneInfoList_i
virtual void UnClicked(TObject *obj, UInt_t button, UInt_t state)
Emit UnClicked signal with button id and modifier state.
void PreDraw()
Perform GL work which must be done before each draw.
void Start()
Start the auto-rotator.
void UseDefaultColorSet(Bool_t x)
Set usage of the default color set.
void SetAutoRotator(TGLAutoRotator *ar)
Set the auto-rotator for this viewer. The old rotator is deleted.
TGLColorSet fDarkColorSet
viewport - drawn area
TGLLogicalShape * GetLogShape() const
TGLColorSet & ColorSet()
Return reference to current color-set (top of the stack).
void SetViewport(const TGLRect &viewport)
Set viewport extents from passed 'viewport' rect.
void SetColor(Int_t r, Int_t g, Int_t b, Int_t a=255)
Set color with Int_t values.
TGedEditor * fGedEditor
event handler
static void ColorAlpha(const TGLColor &color, UChar_t alpha)
Set color from TGLColor and alpha value.
virtual Bool_t MouseEnter(TGLOvlSelectRecord &selRec)
Mouse has entered this element.
Float_t fPointScale
color-set with light background
virtual void PostRender(TGLRnrCtx &rnrCtx)
Perform post-render clean-up.
Int_t CeilNint(Double_t x)
TGLPerspectiveCamera fPerspectiveCameraYOZ
Bool_t fDrawCameraCenter
reference position
void StdSetupLights(const TGLBoundingBox &bbox, const TGLCamera &camera, Bool_t debug=kFALSE)
Setup lights for current given bounding box and camera.
Double_t End()
End timing, return total time since Start(), in milliseconds.
Bool_t SavePicture()
Save current image using the default file name which can be set via SetPictureFileName() and defaults...
void Set(Int_t x, Int_t y, Int_t width, Int_t height)
const TGLPhysicalShape * GetSelected() const
Return selected physical shape.
TGLPShapeObj * fPShapeWrap
GED editor.
const char Int_t const char * image
TGLSelectRecord fSecSelRec
select record from last select (should go to context)
void DrawDebugInfo()
If in debug mode draw camera aids and overall bounding box.
Bool_t fResetCamerasOnNextUpdate
void SetGLCtxIdentity(TGLContextIdentity *cid)
void SetRenderScale(Float_t s)
virtual void Warning(const char *method, const char *msgfmt,...) const
Issue warning message.