View Full Version : opengl programming without a window?

08-15-2005, 06:52 AM

is it possible to "disable" a windows border
i mean not really full screen programming, but just drawing on to the desktop
for example you start my prog and see some geometric objects, or even complex animations just on the desktop and not only in a rectangular box just without a windows frame border

i want no border just drawing on the desktop
is it possible? if yes, how?

08-15-2005, 11:28 AM
I don't know, and it is an interesting question, but i think you need an other windowing api ( not glut ), and check for it on http://www.free-soft.org/guitool/ :-)

08-15-2005, 01:00 PM
I know we can do that under Linux but that's almost all what I can say. Maybe the native WIN32 API provides similar things.

08-16-2005, 12:08 AM
hWnd = CreateWindow("cRenderer", "Renderer", WS_POPUPWINDOW | WS_VISIBLE, 0, 0, width, height, NULL, NULL, hInstance, NULL);

And you'll get popup window without border. Don't know how you can do that with GLUT though...

08-16-2005, 04:26 AM
With GLUT one can use such thing:

HWND hThisWnd = FindWindow( "GLUT", "your window name" );
if( hThisWnd )
LONG lStyle = GetWindowLong( hThisWnd, GWL_STYLE );
SetWindowLong( hThisWnd, GWL_STYLE, lStyle &
}...just can't see that author of post was interested in GLUT example... ;)

08-20-2005, 05:52 AM
well everything will help
i'll check it out

08-20-2005, 08:24 AM
i was using
this tutorial (http://www.lighthouse3d.com/opengl/glut/index.php?2)
for the rendering i get a simple window with border and caption
using your code disables just the border
the caption is still there
and i don't really know why the caption is visible because you disabled it too

anybody knows how i can hide the caption in a different way?

08-20-2005, 08:56 AM
The MSDN is great for this sort of thing. You just need to make sure you get all the bits. For glut, I'd say this is kinda ugly, but it works. Consider rolling your own opengl init at this point, there's not that much to it.

. . .

// After window is created and callbacks are set,
// but before main loop...
HWND hWnd = WindowFromDC(wglGetCurrentDC());
if( hWnd )
LONG style = GetWindowLong(hWnd, GWL_STYLE);
style |= WS_POPUP;
SetWindowLong(hWnd, GWL_STYLE, style);

}Edit: Slightly better solution.

08-21-2005, 09:53 PM
It's really nice! Does anyone also know how I'd make the clear color transparent? I mean render the objects opaque but see behind the rest of the window. I tried glClearColor(0.0, 0.0, 0.0, 0.0) but no luck.

08-21-2005, 11:08 PM
You want to create an overlayed surface ? in OpenGL on Windows ?

You need to create a GDI bitmap and render into it, it's the simpler way (the way I used years ago), then render the bitmap with colorkey.

Some renderers might disable hardware acceleration when doing that.

Some details here :


08-22-2005, 06:50 PM
Dvm, you could cheese it with a quick blit of the desktop to a bitmap, then clear your opengl frame buffer with a glDrawPixels (use GL_BGR) or texture created from it (nearest filtered). If your window is fullscreen on a static background, you're done. Otherwise, you'd need to handle updates when windows move or backgrounds change. I was just playing with this and it looks OK. The dirty background problem is tricky, and particularly ugly with glut. But for a quick popup, this aint bad (on second thought, it kinda sucks).

You may also want to look at the newer AlphaBlend API for a solution along the same lines. But instead render to an off-screen surface, create a bitmap from it, then blend with background. This would allow for a global constant alpha scale across the window.

It seems like this oughta be easy...