Jump to content
  • Advertisement
Sign in to follow this  
bootstrap

OpenGL desktop_hrc = wglCreateContext(desktop_hdc)

This topic is 3631 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Is it impossible to make wglCreateContext() return a valid rendering context for the desktop window? So far, everything I try fails. I try getting the desktop_hdc argument with GetDesktopWindow() followed by GetDC(), and also by calling GetDC with a null/zero argument (which some sources claim returns the HDC for the desktop). I understand that it is possible to create a borderless "popup" type window that covers the entire desktop, but I would prefer to make OpenGL draw directly on the desktop window - unless it simply cannot be done. Anyone know? Thanks.

Share this post


Link to post
Share on other sites
Advertisement
It is not recommended because you can only set the pixel format once (SetPixelFormat). As to whether it is possible or not, or if you have to choose some specific type of pixel format, single buffer or double buffer, I have no idea.

Share this post


Link to post
Share on other sites
Windows may or may not let you draw onto the desktop directly. I don't remember ever trying. GetDC(0) definetely returns the device context of the desktop. You can use that device context for getting information with GetDeviceCaps(). Personally, I like to use GetSystemMetrics() more.

The whole point of making a borerless window(WS_POPUP) that covers the screen is to keep the user from clicking on desktop items and worse. I also recommend throwing in WS_EX_TOPMOST to CreateWindowEx() so junk that shouldn't be covering your window doesn't. Example: Windows 98 taskbar :)

Share this post


Link to post
Share on other sites
Though I have never drawn directly onto the desktop before, other programmers have told me they did. OTOH, that was not with OpenGL, but probably just Windows API functions.

I guess this mean all screensavers must-be/are windows created by those applications, appearances to the contrary notwithstanding. Either that, or they are all drawn with simple Windows API functions. This is certainly possible.

Yes, I agree WS_EX_TOPMOST is appropriate. Thanks for reminding me; I haven't seen (or tested-on) a Windows98 computer in nearly a decade! Somehow, I doubt any Windows98 computer will support OpenGL 2.1+ and GLSL 1.2+ anyway, but then again, that is just a guess.

Unless anyone knows how to do the "desktop" trick... I'll go ahead and create a fictional desktop window with CreateWindowEx(). Thanks for your replies.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!