ROOT's GL viewer embedded in TCanvas


When we draw the TGeoVolume object with ogl option the ROOT’s GL viewer is created as an external window. Is it possible to embed this viewer within the explicit instance of the TCanvas("glc1",...) ? Below is as simple example what I mean.


#include "TGeoManager.h"
#include "TCanvas.h"

void MyFirstGeo()
  TGeoManager *geom = new TGeoManager("geom","My first 3D geometry");
  TGeoMaterial *vacuum = new TGeoMaterial("vacuum",0,0,0);
  TGeoVolume *top = geom->MakeBox("top",vacuum,10,10,10);
  TCanvas *c1 = new TCanvas("glc1","My super box canvas",700,700);
  top->Draw("ogl"); // why it's not drawn within c1 ???


AFAIK, the “ogl” option opens a GL Viewer by default. There is no way to embed a GL Viewer inside a regular TCanvas

Cheers, Bertrand.

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

When I run you macro I get:

Processing MyFirstGeo.C...
In file included from input_line_12:1:
/Users/couet/roottest/MyFirstGeo.C:5:41: error: cannot initialize a parameter of type 'TGeoMedium *' with an lvalue of type 'TGeoMaterial *'
  TGeoVolume *top = geom->MakeBox("top",vacuum,10,10,10);
/Users/couet/git/roottrunk-bin/include/TGeoManager.h:307:65: note: passing argument to parameter 'medium' here
   TGeoVolume            *MakeBox(const char *name, TGeoMedium *medium,

May be @agheata can help …