Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Extra vertical space on a canvas when CanvasPreferGL is set to true, reproducible via SSH #13016

Closed
1 task done
YuryYury opened this issue Jun 14, 2023 · 7 comments
Closed
1 task done
Assignees
Labels

Comments

@YuryYury
Copy link
Contributor

Check duplicate issues.

  • Checked for duplicates

Describe the bug

When trying to draw a histogram with a transparent box on top of it, I noticed that whenever I set CanvasPreferGL to true, the canvas moves down, and the X-axis title is cut off.

What is the expected behaviour?

The only change I would expect is the transparency introduced to my box. Things are not supposed to be moved around only due to

        gStyle->SetCanvasPreferGL(true);

How to reproduce?

Consider this macro:

void transpar()
{
        gStyle->SetCanvasPreferGL(false);

        TH2F *h = new TH2F("h", "h;X;Y;Z", 10, 0., 10., 10, 0., 10.);
        h->Draw();

        TMarker *m = new TMarker(4., 7., 8);
        m->Draw();

        TBox *b = new TBox(1., 1., 8., 8.);
        printf("CanvasPreferGL is set to %s\n", gStyle->GetCanvasPreferGL() ? "true, the red box is expected to be transparent":"false, the red box is expected to be non-transparent");
        b->SetFillColorAlpha(kRed, 0.2);
        b->Draw();
}

Now if I run this as

root -l -n transpar.cxx

I get the following:
image

(no transparency is expected, so it is all good).
But when I change false to true at the third line

        gStyle->SetCanvasPreferGL(true);

and run again

root -l -n transpar.cxx

, I get
image

The box is now transparent, which is good, but there is too much empty space above the histogram name (“h”) and, as a consequence, the X-axis title is now cut off. Is there a way to make my box transparent and keep everything else where it was before?

Please note I’m using the -n option when running transpar.cxx, so it’s not due to something I have in my style file.

The original discussion at the ROOT forum revealed that:

  • this is irreproducible if ran on local computers with Windows or Mac OS. The issue is observed only via SSH (from e.g. lxplus7)
  • in principle, the issue can be mitigated by adding the following five lines at the very end of the macro (right after b->Draw();; the transparency remains; the +/- 0.1 offsets need a bit of a tuning of course):
        if (gStyle->GetCanvasPreferGL())
        {
                gPad->SetBottomMargin(gPad->GetBottomMargin() + 0.1);
                gPad->SetTopMargin(gPad->GetTopMargin() - 0.1);
        }

ROOT version

6.28/00

How did you install ROOT?

provided by ATLAS @ lxplus7

Which operating system are you using?

CentOS 7

Additional context

No response

@couet
Copy link
Member

couet commented Jun 20, 2023

GL does not seem to work on lxplus. I get:

-bash-4.2$ root transpar.C 
   ------------------------------------------------------------------
  | Welcome to ROOT 6.24/08                        https://root.cern |
  | (c) 1995-2021, The ROOT Team; conception: R. Brun, F. Rademakers |
  | Built for linuxx8664gcc on Sep 29 2022, 13:04:57                 |
  | From tags/v6-24-08@v6-24-08                                      |
  | With c++ (GCC) 4.8.5 20150623 (Red Hat 4.8.5-44)                 |
  | Try '.help', '.demo', '.license', '.credits', '.quit'/'.q'       |
   ------------------------------------------------------------------

root [0] 
Processing transpar.C...
Fontconfig warning: ignoring UTF-8: not a valid region tag
Error in <TX11GLManager::CreateContext>: glXCreateContext failed

Error in <TRootCanvas::CreateCanvas>: GL context creation failed.
Info in <TCanvas::MakeDefCanvas>:  created default TCanvas with name c1
CanvasPreferGL is set to true, the red box is expected to be transparent
root [1] 

I will investigate

@YuryYury
Copy link
Contributor Author

Hi Olivier,

GL does not seem to work on lxplus.

It works for me, both in ROOT 6.22/06 and 6.28/00 provided on lxplus by ATLAS.

@couet
Copy link
Member

couet commented Jun 20, 2023

This is weird. I tried to connect specifically on lxplus7. That does not help. Even the standard app glxgears fails:

-bash-4.2$ glxgears
X Error of failed request:  BadValue (integer parameter out of range for operation)
  Major opcode of failed request:  149 (GLX)
  Minor opcode of failed request:  3 (X_GLXCreateContext)
  Value in failed request:  0x0
  Serial number of failed request:  26
  Current serial number in output stream:  27
-bash-4.2$ 

Standard X11 ROOT display works though

@YuryYury
Copy link
Contributor Author

Even the standard app glxgears fails

Again, glxgears works fine for me on lxplus7, even before I set up my usual ATLAS environment. FWIW, one difference I could notice is that I use zsh while you are using bash...

2023-06-20 10_12_33-lxplus7 cern ch - PuTTY

@couet
Copy link
Member

couet commented Jun 20, 2023

I tried wich zsh . I still get the error with glxgears...

@dpiparo
Copy link
Member

dpiparo commented Oct 28, 2024

This has been fixed in the meanwhile, e.g. on lxplus for ROOT 6.32.06, the version currently installed there.
image

@dpiparo dpiparo closed this as completed Oct 28, 2024
@YuryYury
Copy link
Contributor Author

Agreed. It works fine even in ROOT 6.30/02.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Status: Issues
Development

No branches or pull requests

3 participants