Set up opengl on GetDesktopWindow() or GetDC(0)

I want access directly to the desktop window. Is that possible? If so, how?

SetPixelFormat always fails when I try to set up opengl on any window other than my own.

This is not allowed.
If you don’t own the window, it might not be setup with the required flags to support OpenGL (clip children, clip siblings) and even if that worked once, you cannot destroy the window bcause you don’t own it, which means you will never be able to run your program twice on the desktop window, because SetPixelFormat can only be called successfully once per window.
This has been discussed before, search the forum.

It looks like the concensus is that the desktop is read only. Does VNC Viewer use OpenGL? That is specifically what I’m trying to use using glReadPixels.

Is this valid? How do I do it?

I guess VNC does something like windows does when you press the [Print Screen/Hardcopy/System Request]-key. I don’t thing you could get pixels from desktop using OpenGL’s ReadPixels.

Try BitBlt (Win32API) to copy from screen DC to a bitmap DC.

This topic was automatically closed 183 days after the last reply. New replies are no longer allowed.