Reputation: 1075
Have you used or seen cairo dock in linux? I've read in wikipedia that's it was written in C. I'm just curious how did they make a windowless, widget-like app which use OpenGl. Is it possible to make an OpenGl application which is windowless and has no background(or transparent background). Did they made it with C from scratch? or Did they used any other tool?
Upvotes: 0
Views: 453
Reputation: 162367
What do you mean by "windowless". A window is the (rectangular) region on screen to which you can draw with drawing operations. From your question however I have the impression, that you're actually asking about creating a window without decorations (i.e. title bar, etc.).
In Linux, or more precisely X11, the appearance of a window is controlled by two things: The Extended Window Manager Hints (EMWH) for a window under control of the window manager; the window manager is the actual program responsible for drawing the decorations and borders. And the Redirection Override flag, which controls, if a window actually gets to be under the control of a window manager. If you're asking about "backgroundless", then I presume you mean, transparent. First have a look at this video I made: http://www.youtube.com/watch?v=iHZfH1Qhonk Is this what you're after? Then what you actually want is a window with an Alpha channel in its framebuffer config (X11 XRender FBConfig), together with a compositing manager (which can, but isn't required to be a part of the window manager). The sourcecode for this program can be found at https://github.com/datenwolf/codesamples/tree/master/samples/OpenGL/x11argb_opengl_glsl
Or are you actually asking about a OpenGL context to which you can render a picture, but without it appearing on screen? That would then be an off-screen context and there are two ways for implementing this with X11:
Using a windowless PBuffer X11 drawable for the context
Using a hidden window together with a OpenGL Framebuffer Object
Both methods have each their pros and cons.
Upvotes: 1