21 #include "TGLIncludes.h"
23 #include "TGLWidget.h"
40 TGLEmbeddedViewer(parent, 0, 0, 0)
78 if ((!fGLWidget && fGLDevice == -1) || (fGLWidget && !fGLWidget->IsMapped()))
84 if ( ! TakeLock(kDrawLock))
88 Error(
"FWTGLViewer::DrawHiLodNoSwap",
"viewer locked - skipping this draw.");
89 fRedrawTimer->RequestDraw(100, TGLRnrCtx::kLODHigh);
93 fLOD = TGLRnrCtx::kLODHigh;
100 fGLWidget->SwapBuffers();
112 return GenerateFbo(fViewport.Width(), fViewport.Height(), kFALSE);
122 Float_t
scale = Float_t(width) / fViewport.Width();
123 Int_t height = TMath::Nint(scale*fViewport.Height());
125 return GenerateFbo(width, height, pixel_object_scale ? scale : 0);
135 Float_t
scale = Float_t(height) / fViewport.Height();
136 Int_t
width = TMath::Nint(scale*fViewport.Width());
138 return GenerateFbo(width, height, pixel_object_scale ? scale : 0);
148 Int_t
w = TMath::Nint(scale*fViewport.Width());
149 Int_t
h = TMath::Nint(scale*fViewport.Height());
151 return GenerateFbo(w, h, pixel_object_scale ? scale : 0);
159 static const TString eh(
"FWTGLViewer::SavePictureUsingFBO");
161 if ( ! GLEW_EXT_framebuffer_object)
163 ::Warning(eh,
"Missing FBO support.");
166 if ( ! TakeLock(kDrawLock)) {
167 ::Error(eh,
"viewer locked - try later.");
171 TUnlocker ulck(
this);
175 TGLFBO *fbo =
new TGLFBO();
178 fbo->Init(w, h, fGLWidget->GetPixelFormat()->GetSamples());
180 catch (std::runtime_error& exc)
182 ::Error(eh,
"%s",exc.what());
186 TGLRect old_vp(fViewport);
187 SetViewport(0, 0, w, h);
189 Float_t old_scale = 1;
190 if (pixel_object_scale != 0)
192 old_scale = fRnrCtx->GetRenderScale();
193 fRnrCtx->SetRenderScale(old_scale * pixel_object_scale);
198 fLOD = TGLRnrCtx::kLODHigh;
199 fRnrCtx->SetGrabImage(kTRUE);
203 fRnrCtx->SetGrabImage(kFALSE);
207 if (pixel_object_scale != 0)
209 fRnrCtx->SetRenderScale(old_scale);
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)
The Signals That Services Can Subscribe To This is based on ActivityRegistry h
Helper function to determine trigger accepts.
FWTGLViewer(const TGWindow *parent)
void DrawHiLod(Bool_t swap_buffers)