Root window

Hi guys, i would like to know how to display a cube in the root window in OpenGL.

Basically its to get me started on experimenting with picking matrices, as i wanna know how someone could replace 2d icons with 3d objects on the desktop.

i have done nehe tutorials and the like but none show how to display in the root window, hopefully i can get a nice desktop app running.


As far as I know, you can’t do it directly, as you can’t perform OpenGL rendering to the desktop. One solution would be creating transparent windows on it’s top, but I am not shure if OpenGL rendering is supported to such windows. Never did it myself, hovewer, so treat this post rather as guess then a real recommendation.

What OS are you on?

If it’s Linux, I’m pretty sure it’s possible. I don’t know how, but I know that xscreensaver can be put into the root window (I think with the “-root” option passed to the screensaver).

You can look at the source code of the GL screensavers to find out how they do it.

Presuming you’re using X… you can use OpenGL to render to the root window. When you create your rendering context you have to use the same GLX visual as the root window.

The big potential problem is the root window’s visual may not support Z/stencil/double-buffering, etc. You could work-around that by rendering to a framebuffer object and copying the image to the root window.

Maybe i should have a go at, borderless windows.

My main plan anyway is to create a “launchcube” it looks like a rubix cube, and theres tiles that rotate you view round the view to that you see another facet on the cube and also the tiles that launch apps.

basically its a way to ditch w95 style start menus.

sorry to bump this post, but what’s so special with the root window ???

why would it not support Z/stencil/double-buffering ???

Originally posted by Guardian:
sorry to bump this post, but what’s so special with the root window ???
This question has come up many times before.

Under the current Windows OS, you cannot set the pixel format of the desktop window, and you cannot in general set the pixel format of any window more than once. The reason for this restriction is to avoid undue implementation complexity and certain types of race conditions.