view desktop instead of a black background

hello,

I have coded a simple triangle that i display.
But there is a black background that I want to erase to get my desktop instead.
So I would like to get the pixels that I have drawn to test them (triangle’s pixel or not). How do I get the “picture” and test its colors?

With this help I would be able to construct a mask and apply it to the triangle (and then to an animated triangle) to get a beautiful triangle on my desktop.

Thanks

(i’m using visual c++6)

Hi !

I am not sure that I understand what you want to do, do you want to put an image as a background to your rendering ?, in that case you just use gluOrtho to setup an ortograhpic view and draw the image, the setup a perspective view and draw the triangle.

If you want to put the image on the triangle, then you create a texture and map it to the triangle.

But as I said, I am not sure what it is you want to do.

Mikael

my english doesn’t seem to be as good as i thought…
No.

I have a triangle.
When i launch the program i have the triangle (multicolored, no black) but over a rectangle that is the background (color=black).
I want to erase the background to show the windows desktop instead. i can do it with SetRgn(hWnd,mask1,RGN_XOR).
But the problem is to get the pixels of my picture and to test them. I donnot know how to do it???

for information i have found a example that shows a 3D figures directly on your desktop but it was .asm files…

thanks


bonjour

j’ai un triangle multicolor.
quand je l’affiche il s’affiche sur un fond noir que je veux faire dispaître.
En fait, je veux avoir mon triangle avec comme unique fond le bureau windows.
Le probleme est qu’il faut tester la couleur des pixels de l’image et je ne sais pas comment recupérer ces pixels et les tester.

Merci

in a other way , i would like to create a dynamic mask to apply to my scene so it looks like i have no window handle.
It’s like virtual pets on desktops or in games with sprites.

To get the pixels of your OpenGL scene you can use glReadPixels. Then just look for all the black pixel’s and you can put them together for your region. Or if you have black in your object that you don’t want to mask out, you could use a different background color that you know isn’t used, then check for that.

ok, Thanks, i’ll try.

And if i’m using “double buffer”, i have to choose the buffer to read from with glReadBuffer(GL_BACK), isn’t it?

Hi !

I havn’t tried, but wouldn’t it be possible to use the stencil buffer for this, it should be much faster if it would work.

Mikael

From what I understand, the poster wants to change the shape of the window to match a drawn object by use of Win32 functions like SetWindowRgn. You couldn’t do this with the stencil buffer alone.

yes that’s it!
i want to reshape my window to the geometry i draw.

i use the SetWindowRgn function to do this.
I’m trying to fill a initialized HBITMAP (something like getCompatibleBitmap(hDC)) with getpixels(…,GL_RGB,GL_BITMAP,hBM).
then hImage=CreateCompatibleDC(hDC);
and SelectObject(hImage,hBM);

but it’s a little hard to get the colors. when i try i only get 0xOOOOOO as a color… with the getPixel function
and after 20 second my computer screen flashes: black/desktop. The start button goes to the right of the window, etc…