Windowless 3D Content - Metaballs

Hey all, here is another demo I coded up more along the lines of windowless 3D content.

The purpose of the demo is to show that it is possible to render windowless 3D content directly to the desktop with per pixel transparency.

Your feedback would be appreciated. :slight_smile:

Hey, I tried the demo, but all I got was a black square, am I missing something?

Your setup is probably fine.

I have a few computers the demo won’t run properly on. Currently I don’t have a development environment setup on them to track down the problem, but I will soon.

Originally posted by Vaticanfox:
Hey, I tried the demo, but all I got was a black square, am I missing something?
yep, same here.
My hardware setup is state of the art too.

Okay, I installed my code on another machine (with an Nvidia card), and here is what I found:

  glReadPixels(0, 0, FImage.Width, FImage.Height, GL_BGRA, GL_UNSIGNED_BYTE, FImage.Bits);
  UpdateBlendWindow(Self, FImage);

FImage is a record/struct that holds a DC, Bits, and Dimesions. When glReadPixels is called on Nvidia hardware (as far as I can tell), it is not returning BGRA bits as expected. The color components (BGR) are transferring correctly, but the A is not.

So glReadPixels is not writing correct alpha levels on Nvidia hardware. Does anyone have any idea why?

I wrote something similar - rendering windowless 3d content - a while back. Maybe it might contain something that will help you out? More details here.

Okay, thanks everyone for your help. I fixed the demo so that it should now work as expected on Nvidia hardware. Part of the fix requires the GL_EXT_FRAMEBUFFER_OBJECT extension, so if you try to launch it without the right hardware or drivers you’ll see an gracefully exiting error message.

Also, I added a systray icon and dialog to set a few parameters.

Feedback appreciated :slight_smile:

Works on G8800GTS - nice demo:-)

Some random ideas:

  • Move the light source with the mouse cursor
  • Increase alpha for specular reflections

Tested on XP SP2 and Vista and runs flawlessly, at very good framerates.

It would be nice if you first read the desktops framebuffer, and use it as env map, or add some alpha gradient on the borders of the metaballs (kind of Fresnel effect) so that they more naturally blend with the background…

Very cool.