TPad::fEmbeddedGL strange behavior

Hello,
This is somehow continuing the discussion from ROOT's GL viewer embedded in TCanvas:

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?

Thank you in advanced,
Bartek

Try:

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("ogl");
}

For me it works. I get:

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.

Note the “ogl” option in the macro I sent you. This is the trick.

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?

I don’t think so… at least I have nothing in mind to avoid it.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.