mirror of
https://github.com/italicsjenga/winit-sonoma-fix.git
synced 2024-12-25 14:51:30 +11:00
Merge pull request #293 from tomaka/tomaka-patch-2
Fix the README example
This commit is contained in:
commit
9c8b49fec2
11
README.md
11
README.md
|
@ -30,6 +30,13 @@ cargo run --example window
|
||||||
|
|
||||||
## Usage
|
## Usage
|
||||||
|
|
||||||
|
Glutin is an OpenGL context creation library and doesn't directly provide OpenGL bindings for you.
|
||||||
|
|
||||||
|
```toml
|
||||||
|
[dependencies]
|
||||||
|
gl = "*"
|
||||||
|
```
|
||||||
|
|
||||||
```rust
|
```rust
|
||||||
extern crate glutin;
|
extern crate glutin;
|
||||||
extern crate libc;
|
extern crate libc;
|
||||||
|
@ -40,14 +47,16 @@ fn main() {
|
||||||
|
|
||||||
unsafe { window.make_current() };
|
unsafe { window.make_current() };
|
||||||
|
|
||||||
|
unsafe {
|
||||||
gl::load_with(|symbol| window.get_proc_address(symbol));
|
gl::load_with(|symbol| window.get_proc_address(symbol));
|
||||||
|
|
||||||
gl::ClearColor(0.0, 1.0, 0.0, 1.0);
|
gl::ClearColor(0.0, 1.0, 0.0, 1.0);
|
||||||
|
}
|
||||||
|
|
||||||
while !window.is_closed() {
|
while !window.is_closed() {
|
||||||
window.wait_events();
|
window.wait_events();
|
||||||
|
|
||||||
gl::Clear(gl::COLOR_BUFFER_BIT);
|
unsafe { gl::Clear(gl::COLOR_BUFFER_BIT) };
|
||||||
|
|
||||||
window.swap_buffers();
|
window.swap_buffers();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue