Once we draw TGeoVolume with ‘gl’ option the GLViewer should be embedded in the current pad (instead of being created externally with ‘ogl’ option). Anyway the embedded GLViewer seems to be appearing when I call for:
gStyle->SetCanvasPreferGL(kTRUE);
However, the final visualization is fixed to little size on the lower corner. The example code I play with:
void visualize(){
TGeoManager *gGeoManager = new TGeoManager("World", "My geometry");
TGeoMaterial *mat = new TGeoMaterial("Al", 26.98,13,2.7);
TGeoMedium *med = new TGeoMedium("MED",1,mat);
TGeoVolume *top = gGeoManager->MakeBox("TOP",med,100,100,100);
gGeoManager->SetTopVolume(top);
gGeoManager->CloseGeometry();
gStyle->SetCanvasPreferGL(kTRUE);
TCanvas* c = new TCanvas("c1","c1",500,500);
top->Draw("gl");
}
Can anybody help me with this issue? What the ‘gl’ option actually is supposed to do when I set CanvasPreferGL?
Hi, the combination gStyle->SetCanvasPreferGL(kTRUE) and top->Draw(“gl”) are supposed to use the GL viewer inside the TCanvas, but this option is buggy and not supported any more.
Yes, yes - got it! However, my original question was strictly related to the “gl” option, that Andrei answered. Thank you. The point is, when I call the
top->Draw("ogl")
the TCanvas::MakeDefCanvas creates default TCanvas being open apart of the GL window. Can I get rid of this?