Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion src/wgl/device.rs
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ use winapi::um::handleapi::INVALID_HANDLE_VALUE;
use winapi::um::libloaderapi;
use winapi::um::wingdi::{self, PIXELFORMATDESCRIPTOR};
use winapi::um::wingdi::{
wglDeleteContext, wglGetCurrentContext, wglGetProcAddress, wglMakeCurrent,
wglDeleteContext, wglGetCurrentContext, wglGetCurrentDC, wglGetProcAddress, wglMakeCurrent,
};
use winapi::um::winuser::{self, COLOR_BACKGROUND, CS_OWNDC, MSG, WM_CLOSE};
use winapi::um::winuser::{WNDCLASSA, WS_OVERLAPPEDWINDOW};
Expand Down Expand Up @@ -405,6 +405,10 @@ impl WglDevice {
let gl = {
let hidden_window_dc = hidden_window.get_dc();
let dc = hidden_window_dc.dc;
// `wglMakeCurrent` needs the DC to have the context's pixel format.
if wglGetCurrentContext() == native_context.0 {
set_dc_pixel_format(dc, wingdi::GetPixelFormat(wglGetCurrentDC()));
}
let _guard = CurrentContextGuard::new();
let ok = wglMakeCurrent(dc, native_context.0);
assert_ne!(ok, FALSE);
Expand Down
Loading