Window with borderless or decorations

Can any one explain how to open a glut window with out the window decorations (border less). I was reading the red book example double.c. Please help me

The window decorations are a function of the window manager you’re using. I don’t think GLUT provides any abstract interface for tweaking this, however if you do glutFullScreen(), I think it disables the borders (at least for UNIX/Linux platforms).

If you want the no-borders magic for UNIX/Linux, let me know.

"If you want the no-borders magic for UNIX/Linux, let me know. "

yes I would like to know how to do it on Linux

thanks,
nt

glut full screen is good, but has not control over the position or size of the winodw, I have used x-windows and that had the ability to control all’

This works:

What I don’t know is if glutGetWindow returns the X window ID or an internal GLUT window number. You can check the freeglut or openglut source (whichever you’re using) to see.

Yes, I agree and often do raw X/glX test progs. Once you whip one up, it’s just copy-paste-modify. GLUT is for very simple test programs and tutorials.

Sounds like you’ve got one, but if you want source for a short X/glX test prog that gives you position/size/no-window-decorations control w/o fullscreen, just PM me with your e-mail address.

But just to be clear, GLUT provides the ability to set the window size and position (glutInitWindowPosition, glutInitWindowSize, glutPositionWindow, glutReshapeWindow), just not with full screen mode – where it makes no sense. If you can get the X window ID from GLUT, you’ll probably be able to disable the borders.

That google hit is proving to be somewhat unreliable, so here’s the code:

MWMHints mwmhints;
Atom prop;
memset(&mwmhints, 0, sizeof(mwmhints));
prop = XInternAtom(display, "_MOTIF_WM_HINTS", False);
mwmhints.flags = MWM_HINTS_DECORATIONS;
mwmhints.decorations = 0;
XChangeProperty(display, window, prop, prop, 32, 
                PropModeReplace, (unsigned char *) &mwmhints, 
                PROP_MWM_HINTS_ELEMENTS);

You just need the display and window handles. Don’t know if you can get them from glut. If not, just use X/glX directly.

Thank you “Dark Photon”, I will try x/glx since it is much easier in there. just need to set the overrideredirect flag to 1 or 0.

thank you

True, but be aware you’ll lose the ability to move or close your window via the usual window manager methods (hotkeys, etc.), and allegedly this doesn’t play nice with Xinerama.