We are currently migrating Bugzilla to GitHub issues.
Any changes made to the bug tracker now will be lost, so please do not post new bugs or make changes to them.
When we're done, all bug URLs will redirect to their equivalent location on the new bug tracker.

Bug 2668 - Provide a way to get current HDC along with HWND
Summary: Provide a way to get current HDC along with HWND
Status: RESOLVED FIXED
Alias: None
Product: SDL
Classification: Unclassified
Component: video (show other bugs)
Version: 2.0.3
Hardware: All Windows (All)
: P2 enhancement
Assignee: Ryan C. Gordon
QA Contact: Sam Lantinga
URL:
Keywords: triage-2.0.4
Depends on:
Blocks:
 
Reported: 2014-07-31 02:49 UTC by Katie Stafford
Modified: 2015-03-23 23:48 UTC (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Katie Stafford 2014-07-31 02:49:57 UTC
The Oculus Rift SDK requires you to pass in the HDC of the window along with the HWND so it can call SwapBuffers itself. This handle is present in the SDL_WindowData structure alongside the HWND, but is not available from SDL_GetWindowWMInfo.

I can copy the internal structures to my program and get this handle, but that is a major hack and I want to avoid that.
Comment 1 Sam Lantinga 2014-07-31 05:46:01 UTC
Can you just use GetDC()?
http://msdn.microsoft.com/en-us/library/windows/desktop/dd144871(v=vs.85).aspx
Comment 2 Katie Stafford 2014-07-31 12:24:55 UTC
The Rift SDK actually does call GetDC if you don't give it a device context, but for some reason it doesn't seem to work unless you give it the HDC that created the GL context. This may be a bug in the Oculus SDK, but it still wouldn't hurt to have the existing handle present in SDL_SysWMInfo.
Comment 3 Katie Stafford 2014-08-01 15:20:36 UTC
I just tried using GetDC on the window; that returns a different handle. The only thing that works is the actual handle that created the context.
Comment 4 Ryan C. Gordon 2015-02-19 06:32:13 UTC
Marking a large number of bugs with the "triage-2.0.4" keyword at once. Sorry
if you got a lot of email from this. This is to help me sort through some bugs
in regards to a 2.0.4 release. We may or may not fix this bug for 2.0.4,
though!
Comment 5 Ryan C. Gordon 2015-03-23 23:48:10 UTC
This is now available in https://hg.libsdl.org/SDL/rev/286c854c1d5b

--ryan.