21 #include "TGLIncludes.h" 23 #include "TGLWidget.h" 42 m_fbo_w(-1), m_fbo_h(-1)
81 if ((!fGLWidget && fGLDevice == -1) || (fGLWidget && !fGLWidget->IsMapped()))
87 if ( ! TakeLock(kDrawLock))
91 Error(
"FWTGLViewer::DrawHiLodNoSwap",
"viewer locked - skipping this draw.");
92 fRedrawTimer->RequestDraw(100, TGLRnrCtx::kLODHigh);
96 fLOD = TGLRnrCtx::kLODHigh;
103 fGLWidget->SwapBuffers();
115 return GenerateFbo(fViewport.Width(), fViewport.Height(), kFALSE);
125 Float_t
scale = Float_t(width) / fViewport.Width();
126 Int_t height = TMath::Nint(scale*fViewport.Height());
128 return GenerateFbo(width, height, pixel_object_scale ? scale : 0);
138 Float_t
scale = Float_t(height) / fViewport.Height();
139 Int_t
width = TMath::Nint(scale*fViewport.Width());
141 return GenerateFbo(width, height, pixel_object_scale ? scale : 0);
151 Int_t
w = TMath::Nint(scale*fViewport.Width());
152 Int_t
h = TMath::Nint(scale*fViewport.Height());
154 return GenerateFbo(w, h, pixel_object_scale ? scale : 0);
162 static const TString eh(
"FWTGLViewer::SavePictureUsingFBO");
164 if ( ! GLEW_EXT_framebuffer_object)
166 ::Warning(eh,
"Missing FBO support.");
169 if ( ! TakeLock(kDrawLock)) {
170 ::Error(eh,
"viewer locked - try later.");
174 TUnlocker ulck(
this);
178 if (
m_fbo ==
nullptr)
180 m_fbo =
new TGLFBO();
186 m_fbo->Init(w, h, fGLWidget->GetPixelFormat()->GetSamples());
188 catch (std::runtime_error& exc)
199 TGLRect old_vp(fViewport);
200 SetViewport(0, 0, w, h);
202 Float_t old_scale = 1;
203 if (pixel_object_scale != 0)
205 old_scale = fRnrCtx->GetRenderScale();
206 fRnrCtx->SetRenderScale(old_scale * pixel_object_scale);
211 fLOD = TGLRnrCtx::kLODHigh;
212 fRnrCtx->SetGrabImage(kTRUE);
216 fRnrCtx->SetGrabImage(kFALSE);
220 if (pixel_object_scale != 0)
222 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)
FWCore Framework interface EventSetupRecordImplementation h
Helper function to determine trigger accepts.
FWTGLViewer(const TGWindow *parent)
void DrawHiLod(Bool_t swap_buffers)