OpenGL Desktop Texture

How can i get the desktop(screenshot) image as a texture in my openGL program ? I’m using VC++ / MFC


I suspect you might need to create a full-screen (single-buffer) window, but don’t clear it. Then just do a glReadPixels. That should grab everything for you.

I thought i could use GetDesktop(or something like that)
to get the handle and the get a HBITMAP… i saw this on

i tried it, but it crashed P when i called the texture creation routines…

Try looking at and looking up knowledge article Q97193 entitled WINCAP Captures Screens Using DIB API. It has a sample, not gl specific. And, if that doesn’t help you, search their docs.

thx a lot to you Adrian !

Happy to help. Did it work okay?

i don’t have time to work on it right now… but i’ll give it a try real soon