FLTK logo

Re: [fltk/fltk] Wayland use of alpha in glClearColor/glClear() -- bug or misfeature? (Issue #957)

FLTK matrix user chat room
(using Element browser app)   FLTK gitter user chat room   GitHub FLTK Project   FLTK News RSS Feed  
  FLTK Apps      FLTK Library      Forums      Links     Login 
 All Forums  |  Back to fltk.issues  ]
 
Previous Message ]New Message | Reply ]Next Message ]

Re: [fltk/fltk] Wayland use of alpha in glClearColor/glClear() -- bug or misfeature? (Issue #957) Gonzalo Garramuño 19:27 Apr 21  
 

I asked Gemini who had this to say about Wayland:

Achieving a fully transparent background with no desktop peeking through in Wayland using OpenGL requires a two-pronged approach:

Clearing the Color Buffer with Alpha:

Within your OpenGL rendering code, use the glClearColor function to set the clear color to (0.0f, 0.0f, 0.0f, 0.0f). This sets the red, green, and blue components to black (0.0f) and the alpha component to fully transparent (0.0f).

Before drawing any objects, call glClear to clear the color buffer with the previously set color. This ensures newly drawn objects are rendered on a completely transparent background. *** WE HAVE THIS IN MY SAMPLE CODE ***

Disabling Window Background:

Unfortunately, Wayland doesn't offer a direct OpenGL function to control window background behavior. However, you can leverage compositor-specific extensions to achieve this:

Identify your compositor: Use libraries like wlr-client to query the running Wayland compositor. This will tell you which compositor you're using (e.g., GNOME Shell's Mutter, KDE Plasma's KWin).

Check for compositor extensions: Some compositors provide extensions to control window transparency. Consult the specific compositor's documentation to see if it offers an extension for disabling the window background. GNOME Shell, for example, offers the wlr-transparent-v1 extension. *** THIS IS WHAT WE NEED EXPOSED IN WAYLAND ***

Enable the extension (if available): If your compositor supports a relevant extension, use the appropriate library functions to enable it within your application. This allows you to control window transparency behavior.

Disable window background (extension specific): Once enabled, the extension will likely provide functions to set the window background behavior. Look for functions related to disabling the window background or setting opacity to 0. This prevents the desktop from showing through the transparent parts of your application window.

Important Note: Not all Wayland compositors offer extensions for controlling window transparency. If your compositor doesn't have such an extension, achieving a fully transparent background with a completely invisible desktop might not be possible.


Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.Message ID: <fltk/fltk/issues/957/2068372922@github.com>

Direct Link to Message ]
 
     
Previous Message ]New Message | Reply ]Next Message ]
 
 

Comments are owned by the poster. All other content is copyright 1998-2024 by Bill Spitzak and others. This project is hosted by The FLTK Team. Please report site problems to 'erco@seriss.com'.