PDA

View Full Version : Windowless 3D Content - Metaballs



sysrpl
04-12-2007, 09:40 AM
Hey all, here is another demo (http://www.codebot.org/articles/?doc=9499) I coded up more along the lines of windowless 3D content.

http://www.codebot.org/content/9499/metaball.png

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. :)

Vaticanfox
04-12-2007, 10:30 AM
Hey, I tried the demo, but all I got was a black square, am I missing something?

sysrpl
04-12-2007, 11:04 AM
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.

knackered
04-12-2007, 12:20 PM
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.

sysrpl
04-12-2007, 03:42 PM
Okay, I installed my code on another machine (with an Nvidia card), and here is what I found:


DrawMetaballs;
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?

dpoon
04-12-2007, 04:53 PM
I wrote something similar - rendering windowless 3d content - a while back. Maybe it might contain something that will help you out? More details here. (http://www.dhpoware.com/demos/glLayeredWindows.html)

sysrpl
04-13-2007, 08:54 PM
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.

http://codebot.org/content/9499/tray.png

Feedback appreciated :)

Nighthawk
05-21-2007, 06:59 AM
Works on G8800GTS - nice demo:-)

Some random ideas:
- Move the light source with the mouse cursor
- Increase alpha for specular reflections

Ysaneya
05-21-2007, 09:00 AM
Tested on XP SP2 and Vista and runs flawlessly, at very good framerates.

Iņigo Quilez
05-22-2007, 04:19 AM
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.