Transparent Window Demo

The crashes on NV cards are from a line of code I forgot to remove while fixing the earlier ATI problem. This has been fixed. My apologies for any frustration this has caused.

@kehziah: Yes, the executable was a little large. I made some changes and reduced it to around 268K. As for the dlls, I haven’t figured out how to statically link to the Cg runtime. I know it was possible with the beta version of the Cg libraries, but I haven’t had much time to learn how to do it now. Does any one else know?

Also, the demo uses ARB FP1 and VP1 for per-pixel lighting. IIRC the 8500 supports only the ATI fragment shader extension. I may add support for PPL on a broader range of hardware in the future, but using ARB FP/VP was a time vs. necessity choice–this is a demonstration of transparent windows, after all.

I’ve only had a few complaints since I broke the demo for NV hardware. The implications of that are interesting.

Thanks again for the responses,

Dude

I tried running a normal OpenGL demo along with your demo, and
everything slowed down horribly to a snail’s pace. And the windows area
where the two demos intersected was not drawn.

Found some info on a Google search. It seems using layered windows
and OpenGL/DirectX is not recommended by Microsoft:


From: Greg Binkerd [MS] (GregB@online.microsoft.com)
Subject: RE: WS_EX_LAYERED and OpenGL together?
View: Complete Thread (3 articles)
Original Format
Newsgroups: microsoft.public.win32.programmer.gdi
Date: 2002-06-05 10:18:55 PST

Hi, Craig.

Unfortunately, OpenGL (and DirectX) can not be used in a layered window.
The hardware performs all rendering and will not incorporate the
semitransparency effect displayed by a layered window. In fact, if you
create a layered window and you move it over an OpenGL application or
windowed DirectX application, you will see “flashing” of the layered
window, since the hardware will draw the 3D primitives directly on the
primary surface, drawing over the layered window and the layered window
will immediately redraw itself in a semitransparent state. Note, this will
only occur with hardware accelerated OpenGL and DirectX applications.

Thanks,
-Greg
Microsoft Developer Support

I know it may be slow, but couldn’t this
problem be solved by rendering into a texture,
then using glGetTexImage to get the result of
the rendering and then blit this result on
the surface of the window as a GDI bitmap ?

@gator: I’ve noticed this slowdown too. This appears to be related to using pbuffers, but the frequency of updates to the layered window probably contributes. Try any of the ATI or nVidia pbuffer demos along with the demo you mentioned and you will see a similar, although possibly less pronounced, effect. I’ve noticed that most consumer level cards are not very good with multiple OpenGL contexts, especially ones using extended functionality. Hopefully this will change in the near future.

It seems using layered windows
and OpenGL/DirectX is not recommended by Microsoft
Yes, in fact trying to create a context on a layered window will bring your system down in XP. However, this demo does not mix the two, it simply uses OpenGL to generate the image information for the layered window–the layered window does not have an associated context. As for the flickering, that is the situation with all layered windows. Try animating another layered window app, such as WMP, over an OpenGL app and you will see similar effects.

There’s nothing like reviving an old thread! @Dude, we are still waiting for the Cube’s code.

Meanwhile, you guys can check this thread on StackOverflow:

http://stackoverflow.com/q/4052940/176769

Even though it’s probably not the technique used by the Cube demo, it has a working source code that achieves the same effect.

This thread is 7 years old. The stuff it’s talking about is oudated, and the people who posted here haven’t posted for years.

You’re talking to nobody.