I am trying to do some nice 3D plots in spherical coordinates with a TGraph2D. Using the “sph” option prevents the axis to be drawn directly, so I use the TAxis3D, which works fine. But as soon as I switch on the “gl” option the axis disappear, and root says “no TView in current pad”.
Do you have an idea what to do?
thanks,
Stefan
{
TGraph2D *dt2 = new TGraph2D();
TRandom2 rg;
for(int i =0; i < 500; i++){
double phi = rg.Uniform(0,2*TMath::Pi());
double theta = rg.Uniform(0,TMath::Pi());
double point = cos(phi)*cos(phi);
dt2->SetPoint(i,phi,theta,point);
}
TCanvas* c1 = new TCanvas("glc1","c1",640,480);
TAxis3D rulers;
dt2->Draw("glsurf1sph");
rulers->Draw("");
} spheres.cpp (433 Bytes)
Yes, TGLSurfacePainter doesn’t draw any axes with sph/pol/cyl options (what should I draw? angles?).
I’m not sure, where is your TAxis3D object with gl option But even if it’s draw on top of GL scene, it will be incorrect, because in openGL we have our own coordinate system, in a pad we have TView to convert 3d to 2d, they works differently.
I do not know, why I cannot see such a picture inside gl-viewer (may be, because this is TGraph2D object inside a pad, not a TH2X).
I guess, I can add such axes, they will show x/y/z ranges for triangle mesh we have. But is it really good?