Print of gl canvas

[quote]It took me a while to find out when it happens. I attach the script.
It seems, that the frame is drawed, when I modify axis titles after the function is drawed.
This is important, when I do something like TF2 tf = (TF2)f->DrawCopy(“glsurf2”);
and than operate on tf to get title etc. Important when drawing the same function, but slightly modified, in two pads.[/quote]

Yes, I can confirm the frame appears :slight_smile: It’s not from GL however (though it’s done by TGLPadPainter).

[quote=“LeWhoo”]It took me a while to find out when it happens. I attach the script.

It seems, that the frame is drawed, when I modify axis titles after the function is drawed.

This is important, when I do something like TF2 tf = (TF2)f->DrawCopy(“glsurf2”);
and than operate on tf to get title etc. Important when drawing the same function, but slightly modified, in two pads.[/quote]

Ok, now try to call SetTitle before Draw(“glsurf”), this can help.

Yes, I found out this works, but… not with DrawCopy()…

Timur meant probably DrawClone and not DrawCopy

Rene

With DrawClone I do not get axis title at all. I can ofcourse do TF2 tf = (TF2)f->DrawClone(“glsurf2”) and than work on tf, but it makes the frame appear…

Ah, yes, But why DrawCopy and not Draw?
I agree that’s a bug anyway.

That’s the only way I know to draw the function into one pad, modify it and draw modified into the second pad, preserving the first version of the function in the first pad… Is there any better way?

Yes, sure, having two TF2. I do confirm strange behavior, but let’s try to find temporary solution, since it will be faster.

As you can see on my shot, something similar exists in non-gl (though, it’ll disappear, if you try to rotate the plot).


With second TF2 it is another topic I think :slight_smile: I know I can make a second TF2 from a scratch, but I decided to go a simpler way - copy constructor. However, the things I perform on the new object apply to the first object. Is it how it is supposed to be? I attach a sample.
1_test_frame.C (754 Bytes)

Can you, please, explain what do you really want and I’ll write a sample macro for you.

I want to draw a TF2 with a title1 and parameter_1=0 in gpad1. Than I want to draw same TF2 with a title2 and parameter_1=-1 in gpad2. Than print to file and get everything ok :slight_smile:

:laughing:

To say the truth, this does not work even without GL :slight_smile:


use this example

Rene

[code]{
gStyle->SetCanvasPreferGL(kTRUE);
TCanvas *c = new TCanvas(“c”, “c”, 1000, 500);
c->Divide(2,1);

TF2 *f1 = new TF2("f1", "(x-[0])^2+y^2");
f1->SetParameter(0,0.1);
    c->cd(1);
f1->Draw("surf2");
f1->GetHistogram()->GetXaxis()->SetTitle("X [pixels]");
f1->GetHistogram()->GetXaxis()->SetTitleOffset(1.4);
TPaveLabel *label1 = new TPaveLabel(0.22,0.75,0.45,0.85,"with par=0.1","brNDC");
label1->Draw();
    c->cd(2);
TF1 * f2 = (TF1*)f1->Clone("f2");
f2->SetParameter(0,0.2);
f2->Draw("surf2");
f2->GetHistogram()->GetXaxis()->SetTitle("X [pixels]");
f2->GetHistogram()->GetXaxis()->SetTitleOffset(1.4);
TPaveLabel *label2 = new TPaveLabel(0.22,0.75,0.45,0.85,"with par=0.2","brNDC");
label2->Draw();

}
[/code]

Thanks, I will. However, I understand that the behaviour reported by me is not correct, I mean, it is a bug?

No, it is not a bug. You must undesrtand that each object drawn in a pad has attributes.
If you modify the attributes and the same object is drawn into several pads, you can expect side-effects. This is the raeson why, in general, you should make a copy of the object
with its current attributes if you want to draw the object again with different attributes.

Rene