Maximise GLViewer window

Can anyone tell me how to set the size of the GLViewer window/pad?

I draw geometries a lot, so I create a canvas, draw the geometry with option “ogl”, get a hold of the TGLViewer, and then manipulate the camera position to where I want it. However it always bugs me having to manually drag the GLViewer window to be bigger on the screen.

Can I set the TGLViewer window size similarly to how I can set the TCanvas window size?

   TCanvas* canvas = new TCanvas("Canvas","Canvas",60,40,1200,800);
   TGLViewer * glViewer = dynamic_cast<TGLViewer*>(gPad->GetViewer3D());
   ... Customize viewer properties ...
   ... Ideally set the size of the GLViewer canvas too! ...
1 Like


Try this way:

((TGMainFrame *)((TGLSAViewer *)glViewer)->GetFrame())->Resize(1200, 800);

Cheers, Bertrand.

1 Like

Fantastic, thanks!