Skip to content

Commit

Permalink
Merge branch 'master' into wasm_stub
Browse files Browse the repository at this point in the history
  • Loading branch information
iceiix committed May 19, 2019
2 parents de52fba + c8bf494 commit 5f490a9
Show file tree
Hide file tree
Showing 83 changed files with 4,811 additions and 3,054 deletions.
2 changes: 1 addition & 1 deletion .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ jobs:
- checkout
- restore_cache:
key: android-test-cache-{{ checksum "Cargo.toml" }}
- run: cargo apk build --example window
- run: cd glutin_examples && cargo apk build --example window
- save_cache:
key: android-test-cache-{{ checksum "Cargo.toml" }}
paths:
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,4 @@ target/
.DS_Store
*~
#*#
headless.png
15 changes: 12 additions & 3 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ addons:
env:
global:
- secure: "kVjHgK+6ivT5tUleNH/m6+69tPf8gkPNSPLsnXrkMJaIeXSnnKKQegP1O0UCThYAUbbwrUGlrKJUngDxkD8jSANhzAULX9t1iXho41InzYBEErTanXBYF8WO1rK1keKjLwiYw4KuvbiBoSeKabzQRwv0kMttxY57+hKVROr5dSg="
- secure: g4ZP621rbq7nPU8Df9/92haJda2R+Sb84lUQIONh6JDTrgw7/mnfmbnZGzXo3gpjKZCuPfdu8D0knMjn7aLaI7U1yczzNs2wwD+G8txNN/rM7VEuzk8BN0Kl1iKbnY9ZtAGLVTMSR6NVAKWAaisNkMLpWDiftTNOkXxTQYerxvw=

install:
- rustup self update
Expand All @@ -65,6 +66,14 @@ script:

after_success:
- |
[ $TRAVIS_BRANCH = master ] &&
[ $TRAVIS_PULL_REQUEST = false ] &&
cargo publish --token ${CRATESIO_TOKEN}
[ $TRAVIS_BRANCH = master ] &&
[ $TRAVIS_PULL_REQUEST = false ] && {
cd glutin
for crate in ../glutin_*_sys; do
cd "$crate"
cargo publish --token ${CRATESIO_TOKEN_GENTZ}
done
cd ../glutin
cargo publish --token ${CRATESIO_TOKEN}
}
52 changes: 48 additions & 4 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,15 +1,58 @@
# Unreleased

- We no longer load `libegl.so` and `libgl.so` multiple times.
# Version 0.21.0-rc2 (2019-04-08)

- **Breaking**: Removed `DisplayLost` variant to `ContextError`.
- **Breaking**: Renamed `NotCurrentContext` to `NotCurrent`.
- **Breaking**: Renamed `PossiblyCurrentContext` to `PossiblyCurrent`.
- Added `treat_as_current` function.

# Version 0.21.0-rc1 (2019-04-07)

- **Breaking:** Replaced `CreationErrorPair` enum variant with `CreationErrors`.
- Added `Clone` to `ContextBuilder`.
- Added headless example.
- Removed internal code relating to libcaca.
- Implemented `Debug` on all public facing types.
- Dropping contexts on platforms using egl and/or glx no longer resets the
current context, if the context dropped wasn't the current context.
- Added context sharing support to MacOS.
- **Breaking**: Removed `ContextTrait`.
- **Breaking**: Renamed `OsMesaContextExt` to `HeadlessContextExt`. Added functions
for using egl-surfaceless.
- **Breaking**: Changed `WindowedContext` and `RawContext` into typedefs of
`ContextWrapper`.
- **Breaking**: Removed `new_windowed` and `new_headless` from `WindowedContext`
and `Context`, respectively.
- **Breaking**: Added two new types, `NotCurrentContext` and `PossiblyCurrentContext`,
which `RawContext`, `WindowedContext`, `ContextBuilder` and `Context` are now
generic over.
- Added `{make,treat_as}_not_current` function to `{Raw,Windowed,}Context`.
- We now load `libGL.so` instead of `libGLX.so`.
- **Breaking**: Added `DisplayLost` variant to `ContextError`.
- Fixed bug where we drop the hidden window belonging to a headless context on
on X11 and/or Wayland before the actual context.
- "Fixed" bug where we will close `EGLDisplay`s while they are still in use by
others. Angry and/or salty rant can be found in `glutin/src/api/egl/mod.rs`,
you can't miss it.
- **Breaking**: `WindowedContext`s now deref to `Context`, not `Window`.
Please use `.window()` to access the window.

# Version 0.20.0 (2019-03-09)

- We no longer load `libEGL.so` and `libGL.so` multiple times.
- Fixes `Context::is_current` incorrectly returning `false`.
- Made `ContextBuilder`'s `pf_reqs` public.
- **Breaking:** Renamed `GlContext{,Ext}` to `ContextTrait{,Ext}`.
- **Breaking:** Renamed `GlWindow` to `WindowedContext`.
- Implemented context sharing support for Windows and Linux.
- Added support for separated contexts.
- Added support for contexts made from raw parts for Windows and Linux.
- **Breaking:** Removed `shareable_with_windowed_contexts`. Now you must build
OsMesa contexts via a separate extension.
- Added `ContextBuilder::build` method.
- On X11 and Wayland, you can now use shared contexts, however, one limitation
- Added `ContextBuilder::build_{windowed,headless}` methods.
- **Breaking:** Renamed `Context::new` to `Context::new_headless`. `new_headless` now accepts dimensions for the off-screen surface backing it.
- **Breaking:** Renamed `GlWindow::new` to `WindowedContext::new_windowed`.
- On X11 and Wayland, you can now use shared contexts, however, one limitation
of the Wayland backend is that all shared contexts must use the same events
pool as each other.
- Added context sharing support to windows.
Expand All @@ -21,6 +64,7 @@ pool as each other.
- Added `get_egl_display` method to `GlContextExt` trait and its implementation for platforms.
- Removed minimum supported Rust version guarantee.
- `NoBackendAvailable` is now `Sync`, as a result `CreationError` is also `Sync`.
- Update winit dependency to 0.19.0. See [winit's CHANGELOG](https://github.com/tomaka/winit/blob/master/CHANGELOG.md#version-0190-2019-03-06) for more info.

# Version 0.19.0 (2018-11-09)

Expand Down
68 changes: 11 additions & 57 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,59 +1,13 @@
[package]
name = "glutin"
version = "0.19.0"
authors = ["The glutin contributors", "Pierre Krieger <pierre.krieger1708@gmail.com>"]
description = "Cross-platform OpenGL context provider."
keywords = ["windowing", "opengl"]
license = "Apache-2.0"
readme = "README.md"
repository = "https://github.com/tomaka/glutin"
documentation = "https://docs.rs/glutin"
build = "build.rs"
edition = "2018"

[package.metadata.docs.rs]
features = ["icon_loading", "serde"]

[features]
icon_loading = ["winit/icon_loading"]
serde = ["winit/serde"]

[dependencies]
lazy_static = "1.1"
libc = "0.2"
winit = { git = "http://github.com/iceiix/winit", branch = "wasm_stub" }

[build-dependencies]
gl_generator = "0.10"

[target.'cfg(target_os = "android")'.dependencies.android_glue]
version = "0.2.3"

[target.'cfg(target_os = "ios")'.dependencies]
objc = "0.2"

[target.'cfg(target_os = "macos")'.dependencies]
objc = "0.2"
cgl = "0.2"
cocoa = "0.18.4"
core-foundation = "0.6"
core-graphics = "0.17.3"

[target.'cfg(target_os = "windows")'.dependencies.winapi]
version = "0.3.6"
features = [
"winnt",
"winuser",
"wingdi",
"libloaderapi",
[workspace]
members = [
"glutin",
"glutin_examples",
"glutin_egl_sys",
"glutin_glx_sys",
"glutin_wgl_sys",
"glutin_gles2_sys",
"glutin_emscripten_sys",
]

[target.'cfg(target_os = "windows")'.dependencies]
libloading = "0.5"

[target.'cfg(any(target_os = "linux", target_os = "freebsd", target_os="dragonfly", target_os="netbsd", target_os="openbsd"))'.dependencies]
osmesa-sys = "0.1.0"
wayland-client = { version = "0.21", features = ["egl", "dlopen"] }
x11-dl = "2.18.3"
libloading = "0.5"
shared_library = "0.1"
[replace]
#"winit:0.19.0" = { path = "../winit" }
73 changes: 14 additions & 59 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,8 @@
# glutin - OpenGL, UTilities and INput
[![Gitter](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/tomaka/glutin?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
Alternative to GLFW in pure Rust.

[![](https://meritbadge.herokuapp.com/glutin)](https://crates.io/crates/glutin)

[![Docs.rs](https://docs.rs/glutin/badge.svg)](https://docs.rs/glutin)

Alternative to GLFW in pure Rust.

[![Build Status](https://travis-ci.org/tomaka/glutin.png?branch=master)](https://travis-ci.org/tomaka/glutin)
[![Build status](https://ci.appveyor.com/api/projects/status/cv5xewg3uchb3854/branch/master?svg=true)](https://ci.appveyor.com/project/tomaka/glutin/branch/master)

Expand All @@ -16,10 +12,19 @@ glutin = "*"
```

## [Documentation](https://docs.rs/glutin)
## [0.21.0 Migration guide](https://gentz.rocks/posts/glutin-v0-21-0-migration-guide/)

## Contact Us

Join us in any of these:

[![Freenode](https://img.shields.io/badge/freenode.net-%23glutin-red.svg)](http://webchat.freenode.net?channels=%23glutin&uio=MTY9dHJ1ZSYyPXRydWUmND10cnVlJjExPTE4NSYxMj10cnVlJjE1PXRydWU7a)
[![Matrix](https://img.shields.io/badge/Matrix-%23Glutin%3Amatrix.org-blueviolet.svg)](https://matrix.to/#/#Glutin:matrix.org)
[![Gitter](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/tomaka/glutin?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)

## Usage Examples

Warning: these are examples for master. For the latest released version, 0.19, view [here](https://github.com/tomaka/glutin/tree/72e8c959c4ff538857d028167b9946b8938bdeaa).
Warning: these are examples for master. For the latest released version, 0.21, view [here.](https://github.com/rust-windowing/glutin/tree/2e816ae2654ba80eb3e201d0ce51d238cc105226)

### Try it!

Expand All @@ -32,58 +37,8 @@ cargo run --example window
### Usage

Glutin is an OpenGL context creation library and doesn't directly provide OpenGL bindings for you.
```toml
[dependencies]
gl = "*"
```

```rust
use glutin::dpi::*;
use glutin::ContextTrait;

fn main() {
let mut el = glutin::EventsLoop::new();
let wb = glutin::WindowBuilder::new()
.with_title("Hello, world!")
.with_dimensions(LogicalSize::new(1024.0, 768.0));
let combined_context = glutin::ContextBuilder::new()
.with_vsync(true)
.build_combined(wb, &el)
.unwrap();

unsafe {
combined_context.make_current().unwrap();
}

unsafe {
gl::load_with(|symbol| combined_context.get_proc_address(symbol) as *const _);
gl::ClearColor(0.0, 1.0, 0.0, 1.0);
}

let mut running = true;
while running {
el.poll_events(|event| {
match event {
glutin::Event::WindowEvent{ event, .. } => match event {
glutin::WindowEvent::CloseRequested => running = false,
glutin::WindowEvent::Resized(logical_size) => {
let dpi_factor = combined_context.get_hidpi_factor();
combined_context.resize(logical_size.to_physical(dpi_factor));
},
_ => ()
},
_ => ()
}
});

unsafe {
gl::Clear(gl::COLOR_BUFFER_BIT);
}

combined_context.swap_buffers().unwrap();
}
}
```
For examples, please look [here.](https://github.com/tomaka/glutin/tree/master/glutin_examples)

Note that glutin aims at being a low-level brick in your rendering infrastructure. You are encouraged to write another layer of abstraction between glutin and your application.

Expand Down Expand Up @@ -120,8 +75,8 @@ See also [this documentation](https://kripken.github.io/emscripten-site/docs/api

### X11

The plan is that glutin tries to dynamically link-to and use wayland if possible. If it doesn't work, it will try xlib instead. If it doesn't work, it will try libcaca. This is work-in-progress.
The plan is that glutin tries to dynamically link-to and use wayland if possible. If it doesn't work, it will try xlib instead. This is work-in-progress.

### Wayland

Due to an issue with how mesa and Wayland play together, all shared contexts must use the same events pool as each other.
Expand Down
Loading

0 comments on commit 5f490a9

Please sign in to comment.