21 #include "TGLIncludes.h" 23 #include "TGLWidget.h" 39 : TGLEmbeddedViewer(
parent, nullptr, nullptr, 0), m_fbo(nullptr), m_fbo_w(-1), m_fbo_h(-1) {}
72 if ((!fGLWidget && fGLDevice == -1) || (fGLWidget && !fGLWidget->IsMapped())) {
77 if (!TakeLock(kDrawLock)) {
80 Error(
"FWTGLViewer::DrawHiLodNoSwap",
"viewer locked - skipping this draw.");
81 fRedrawTimer->RequestDraw(100, TGLRnrCtx::kLODHigh);
85 fLOD = TGLRnrCtx::kLODHigh;
100 return GenerateFbo(fViewport.Width(), fViewport.Height(), kFALSE);
109 Float_t
scale = Float_t(
width) / fViewport.Width();
110 Int_t height = TMath::Nint(
scale * fViewport.Height());
121 Float_t
scale = Float_t(height) / fViewport.Height();
122 Int_t
width = TMath::Nint(
scale * fViewport.Width());
133 Int_t
w = TMath::Nint(
scale * fViewport.Width());
134 Int_t
h = TMath::Nint(
scale * fViewport.Height());
143 static const TString eh(
"FWTGLViewer::SavePictureUsingFBO");
145 if (!GLEW_EXT_framebuffer_object) {
146 ::Warning(eh,
"Missing FBO support.");
149 if (!TakeLock(kDrawLock)) {
150 ::Error(eh,
"viewer locked - try later.");
154 TUnlocker ulck(
this);
158 if (
m_fbo ==
nullptr) {
159 m_fbo =
new TGLFBO();
163 m_fbo->Init(
w,
h, fGLWidget->GetPixelFormat()->GetSamples());
164 }
catch (std::runtime_error& exc) {
175 TGLRect old_vp(fViewport);
176 SetViewport(0, 0,
w,
h);
178 Float_t old_scale = 1;
179 if (pixel_object_scale != 0) {
180 old_scale = fRnrCtx->GetRenderScale();
181 fRnrCtx->SetRenderScale(old_scale * pixel_object_scale);
186 fLOD = TGLRnrCtx::kLODHigh;
187 fRnrCtx->SetGrabImage(kTRUE);
191 fRnrCtx->SetGrabImage(kFALSE);
195 if (pixel_object_scale != 0) {
196 fRnrCtx->SetRenderScale(old_scale);
edm::ErrorSummaryEntry Error
TGLFBO * MakeFboScale(Float_t scale, Bool_t pixel_object_scale=kTRUE)
TGLFBO * MakeFboWidth(Int_t width, Bool_t pixel_object_scale=kTRUE)
TGLFBO * MakeFboHeight(Int_t height, Bool_t pixel_object_scale=kTRUE)
TGLFBO * GenerateFbo(Int_t w, Int_t h, Float_t pixel_object_scale)
FWTGLViewer(const TGWindow *parent)
void DrawHiLod(Bool_t swap_buffers)
The Signals That Services Can Subscribe To This is based on ActivityRegistry h
Helper function to determine trigger accepts.