Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/bwasty/learn-opengl-rs
Rust port of JoeyDeVries/LearnOpenGL
https://github.com/bwasty/learn-opengl-rs
opengl rust
Last synced: about 12 hours ago
JSON representation
Rust port of JoeyDeVries/LearnOpenGL
- Host: GitHub
- URL: https://github.com/bwasty/learn-opengl-rs
- Owner: bwasty
- License: unlicense
- Created: 2017-06-04T19:41:11.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2021-12-22T00:33:37.000Z (about 3 years ago)
- Last Synced: 2025-01-01T05:06:10.443Z (8 days ago)
- Topics: opengl, rust
- Language: Rust
- Homepage:
- Size: 51 MB
- Stars: 984
- Watchers: 34
- Forks: 69
- Open Issues: 5
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# learn-opengl-rs [![Build Status](https://travis-ci.org/bwasty/learn-opengl-rs.svg?branch=master)](https://travis-ci.org/bwasty/learn-opengl-rs)
Rust port of https://github.com/JoeyDeVries/LearnOpenGLYou should be able to follow the tutorials at https://learnopengl.com/ with this - the code structure has been kept similar to the original C++ wherever possible.
> This also means it's not necessarily the most idiomatic Rust code. For example, some standard naming convention lints are disabled and all OpenGL calls are "raw" and wrapped in `unsafe` blocks.Run individual tutorials like this:
`cargo run 1_3_2` (for `/src/_1_getting_started/_3_2_shaders_interpolation.rs`).For reduced compilation times, you may only compile the code for a certain chapter by adding `--no-default-features --features chapter-1` for example.
## Chapters
### [1. Getting started](src/_1_getting_started)
**Notes**
- You can mostly ignore the setup instructions at [Getting-started/Creating-a-window](https://learnopengl.com/#!Getting-started/Creating-a-window). Just create a new project with `cargo` and copy the dependency section from [Cargo.toml](Cargo.toml). Only `glfw-rs` might need some more setup, see [here](https://github.com/PistonDevelopers/glfw-rs#using-glfw-rs) for details. You can also use [glutin](https://github.com/tomaka/glutin) (a pure Rust alternative to GLFW), but the API is a bit different, so following the tutorials might not be as straight-forward.
- You might be tempted to use [glium](https://github.com/glium/glium) instead of raw OpenGL. I'd recommend against that, at least in the beginning, to get a good understanding of how OpenGL really works. Also, glium is not actively maintained at the moment.
- If you experience black screens or weird rendering artifacts, check out the [`glCheckError!`](https://github.com/bwasty/learn-opengl-rs/blob/89aed9919a2347e49965820830a6aecfdda18cf3/src/_7_in_practice/_1_debugging.rs#L28-L53) macro from chapter 7.
- exercises have been mostly omitted. You can look up the solutions in the original C++ source.### [2. Lighting](src/_2_lighting)
### [3. Model loading](src/_3_model_loading)
**Notes**
- For simplicity [`tobj`](https://github.com/Twinklebear/tobj) is used instead of `assimp` (simpler interface, pure Rust and later tutorials only load OBJ files anyway). For alternatives see [here](http://arewegameyet.com/categories/3dformatloader.html) and [here](https://crates.io/search?q=assimp).
- The `image` crate is quite slow in debug mode - loading the nanosuit textures takes so much time that it can be faster to use release mode (including compile time).
### [4. Advanced OpenGL](src/_4_advanced_opengl)
**Status:** complete
### [5. Advanced Lighting](src/_5_advanced_lighting)
**Status:** partially done (4/9).
### [6. PBR](src/_6_pbr)
**Status:** partially done (1/2).
### [7. In Practice](src/_7_in_practice)
**Status:** `Debugging` complete (the other two are not in the repo)----
### A note about the code organization
Originally each tutorial was a separate executable (using `src/bin` and `cargo run --bin `. This didn't play very well with the `RLS` and `clippy` (-> [rust-lang-nursery/rls#132](https://github.com/rust-lang-nursery/rls/issues/132)). Now all are integrated into the main binary, which leads to long compile times. As a workaround there are now feature flags for each chapter.