mirror of
https://github.com/italicsjenga/winit-sonoma-fix.git
synced 2024-12-23 22:01:31 +11:00
Remove call to glFlush() before swap_buffers
We may not want to call `swap_buffers` in the same thread as the current thread, so we're moving the call to `glFlush` out of the scope of glutin.
This commit is contained in:
parent
089f47821c
commit
bbcb4c8bea
|
@ -60,6 +60,7 @@ fn main() {
|
||||||
|
|
||||||
### Win32
|
### Win32
|
||||||
|
|
||||||
|
- You must call `glFlush` before `swap_buffers`, or else on Windows 8 nothing will be visible on the window
|
||||||
- Pixel formats are not implemented
|
- Pixel formats are not implemented
|
||||||
- If you don't have MinGW installed, you will need to provide `libgdi32.a` and `libopengl32.a` ; you can put them in `C:\Users\you\.rust`
|
- If you don't have MinGW installed, you will need to provide `libgdi32.a` and `libopengl32.a` ; you can put them in `C:\Users\you\.rust`
|
||||||
- If you don't have `make` in your PATH, you can pass `--no-default-features --features "window"` when compiling ([see also](http://crates.io/manifest.html#the-[features]-section))
|
- If you don't have `make` in your PATH, you can pass `--no-default-features --features "window"` when compiling ([see also](http://crates.io/manifest.html#the-[features]-section))
|
||||||
|
|
|
@ -57,6 +57,8 @@ impl Context {
|
||||||
self.gl.Color3f(0.0, 0.0, 1.0);
|
self.gl.Color3f(0.0, 0.0, 1.0);
|
||||||
self.gl.Vertex2f(0.5, -0.5);
|
self.gl.Vertex2f(0.5, -0.5);
|
||||||
self.gl.End();
|
self.gl.End();
|
||||||
|
|
||||||
|
self.gl.Flush();
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(target_os = "android")]
|
#[cfg(target_os = "android")]
|
||||||
|
@ -78,6 +80,8 @@ impl Context {
|
||||||
self.gl.DrawArrays(gl::TRIANGLES, 0, 3);
|
self.gl.DrawArrays(gl::TRIANGLES, 0, 3);
|
||||||
self.gl.DisableClientState(gl::VERTEX_ARRAY);
|
self.gl.DisableClientState(gl::VERTEX_ARRAY);
|
||||||
self.gl.DisableClientState(gl::COLOR_ARRAY);
|
self.gl.DisableClientState(gl::COLOR_ARRAY);
|
||||||
|
|
||||||
|
self.gl.Flush();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -720,9 +720,6 @@ extern "system" {
|
||||||
// http://msdn.microsoft.com/en-us/library/windows/desktop/ms633519(v=vs.85).aspx
|
// http://msdn.microsoft.com/en-us/library/windows/desktop/ms633519(v=vs.85).aspx
|
||||||
pub fn GetWindowRect(hWnd: HWND, lpRect: *mut RECT) -> BOOL;
|
pub fn GetWindowRect(hWnd: HWND, lpRect: *mut RECT) -> BOOL;
|
||||||
|
|
||||||
//
|
|
||||||
pub fn glFlush();
|
|
||||||
|
|
||||||
// http://msdn.microsoft.com/en-us/library/windows/desktop/ms684175(v=vs.85).aspx
|
// http://msdn.microsoft.com/en-us/library/windows/desktop/ms684175(v=vs.85).aspx
|
||||||
pub fn LoadLibraryW(lpFileName: LPCWSTR) -> HMODULE;
|
pub fn LoadLibraryW(lpFileName: LPCWSTR) -> HMODULE;
|
||||||
|
|
||||||
|
|
|
@ -228,9 +228,6 @@ impl Window {
|
||||||
/// See the docs in the crate root file.
|
/// See the docs in the crate root file.
|
||||||
pub fn swap_buffers(&self) {
|
pub fn swap_buffers(&self) {
|
||||||
unsafe {
|
unsafe {
|
||||||
// calling glFlush is necessary on Windows 8
|
|
||||||
ffi::glFlush();
|
|
||||||
|
|
||||||
ffi::SwapBuffers(self.hdc);
|
ffi::SwapBuffers(self.hdc);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue