Help NEED!!!

I am coding a 3D program by GLUT.

A simple question, but I still could not find the answer:
How can I remove the window frame when it was created by GLUT?

This is hardly an advanced question. I’ll move this thread to the toolkits forum. Meanwhile, I’d suggest that you look at the source code of some of the many Glut-based demos on the web.

– Tom

I’m sure you can’t do this via glut unless you go fullscreen, you may be able to do it using X or Win32 functions (SetWindowLong on win32).

You can make the current window fullscreen by calling glutFullScreen (). This will maximize your window and disable all frames etc. Or if you want to render in fullscreen mode and change resolution, bit depth, etc you can use GLUT “Game Mode”


Thanks for your replying.
In my case, I can not use fullscreen mode because I need another windows viewing in another area of the screen.

Are you using linux or windows?
In windows you could probably use the SetWindowLong function to change the style of the window after you’ve created it with glut. You probably could do it in X-windows as well but I know nothing about this.

I am using Linux. It is very simple in X window. Maybe combine X-window and GLUT is the closet way for fixing this issue.

Thanks again, and hoping more informations.


Got a soln for the issue… Given the name of the window, we can remove its decorations… Here is the sample code.
Compile with :
gcc -g -I/usr/include/GL -I/usr/X11R6/include -L/usr/lib/ -L/usr/X11R6/lib/ -o glutWindowWithoutDecorations glutWindowWithoutDecorations.c -lglut -lGLU -lGL -lXext -lX11 -lXm -lXi -lGLw

Code : glutWindowWithoutDecorations.c
#include <glut.h>
#include <Xm/MwmUtil.h>
#include <GL/gl.h>
#include <GL/glu.h>
#include <GL/glx.h>
#include <GL/GLwMDrawA.h> /
Motif OpenGL drawing area. */

float angle = 0.0;

static String fallbackResources[] = {
glxareawidth: 300”, “glxareaheight: 300”,
framex: 20”, “framey: 20”,
frametopOffset: 20”, “framebottomOffset: 20”,
framerightOffset: 20”, “frameleftOffset: 20”,
frameshadowType: SHADOW_IN”, NULL
static int snglBuf[] = {GLX_RGBA, GLX_DEPTH_SIZE, 12, GLX_RED_SIZE, 1, None};

static int dblBuf[] = {GLX_RGBA, GLX_DEPTH_SIZE, 12, GLX_DOUBLEBUFFER, GLX_RED_SIZE, 1, None};
Bool doubleBuffer = True;
Display *dpy;
int screen;
XVisualInfo *visinfo;
GLXContext glxcontext;
Colormap cmap;
XtAppContext app;

void OnIdle() {

void display(void)
glColor3f(0.0, 0.0, 1.0); /* blue /
glVertex2i(0, 0);
glColor3f(0.0, 1.0, 0.0); /
green /
glVertex2i(200, 200);
glColor3f(1.0, 0.0, 0.0); /
red /
glVertex2i(20, 200);
glFlush(); /
Single buffered, so needs a flush. */

Colormap getShareableColormap(XVisualInfo * vi)
Status status;
XStandardColormap *standardCmaps;
Colormap cmap;
int i, numCmaps;

/* Be lazy; using DirectColor too involved for this example. /
#if defined(CH) | | defined(__cplusplus)
if (vi->c_class != TrueColor)
if (vi->class != TrueColor)
XtAppError(app, “no support for non-TrueColor visual”);
If no standard colormap but TrueColor, just make an
unshared one. /
status = XmuLookupStandardColormap(dpy, vi->screen, vi->visualid,
vi->depth, XA_RGB_DEFAULT_MAP,
False, /
Replace. /
True); /
Retain. */
if (status == 1) {
status = XGetRGBColormaps(dpy, RootWindow(dpy, vi->screen),
&standardCmaps, &numCmaps, XA_RGB_DEFAULT_MAP);
if (status == 1)
for (i = 0; i < numCmaps; i++)
if (standardCmaps[i].visualid == vi->visualid) {
cmap = standardCmaps[i].colormap;
return cmap;
cmap = XCreateColormap(dpy, RootWindow(dpy, vi->screen), vi->visual, AllocNone);
return cmap;

Window getWindowIdFromName(Display *dpy, Window level, char *name)
Window *children;
Window dmy;
Window root;
Window id;
char *window_name;
int i;
int no_of_children;

if (0 == XQueryTree(dpy, level, &dmy, &dmy, &children, &no_of_children))
return 0;

for (i=0; i<no_of_children; i++)
if (XFetchName(dpy,children[i], &window_name))
if (strcmp (name, window_name)) XFree(window_name);
return children[i];
if (id = getWindowIdFromName(dpy, children[i], name))
return id;
return 0;

int main(int argc, char **argv)
Widget w;
Window window, root, id;
XSetWindowAttributes swattr;
PropMwmHints motf_prop;
Atom motf_atom;

/* Section to make a glut Window called “single traiangle”*/
glutInit(&argc, argv);
glutCreateWindow(“single triangle”);

/* Now that window is created, Get its window ID from the name “single triangle”*/
if (NULL == (dpy = XOpenDisplay(NULL)))
printf (“Could not open display”);

root = DefaultRootWindow(dpy);
/* we must get id from name string */
if (0 == (id = getWindowIdFromName(dpy, root, “single triangle”)))
printf (“Invalid window name”);

printf("ID = %d
", id);
// This is the window id of “single triangle” … can check with xwininfo -id <num>

/* Now we need to get permission to modify Window properties.
Check reasoning in*/

swattr.override_redirect = 1;
XChangeWindowAttributes( dpy, id, CWOverrideRedirect, &swattr);

/* Now set the flags for FUNCTIONS and DECORATIONS of the Window to null and apply*/
motf_atom = XInternAtom(dpy, “_MOTIF_WM_HINTS”, False);
motf_prop.flags = 0;

XChangeProperty(dpy, id, motf_atom, motf_atom,32,PropModeReplace,
(unsigned char *)&motf_prop, PROP_MWM_HINTS_ELEMENTS);

/* Now back to glut… start the MainLoop */
glutIdleFunc( OnIdle );


return 0;

/**** End of Code ****/



thanks a lot for your help, I will try this program.
Thanks again for your kindness!