Home

Awesome

learn-opengl-rs Build Status

Rust port of https://github.com/JoeyDeVries/LearnOpenGL

You 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.

<p align="center"> <a href="src/_1_getting_started/_2_1_hello_triangle.rs"><img width="250" alt="1_3_2" title="1_3_2 Hello Triangle" src="https://user-images.githubusercontent.com/1647415/27755053-d5cd0f5a-5ded-11e7-99b4-abd4e3bb8638.png"></a> <a href="src/_2_lighting/_6_multiple_lights.rs"><img width="250" alt="2_6" title="2_6 Multiple Lights" src="https://user-images.githubusercontent.com/1647415/27755102-fd217078-5ded-11e7-96f6-efdeb9ffdcac.png"></a> <a href="src/_3_model_loading/_1_model_loading.rs"><img width="250" alt="3_1" title="3_1 Model Loading"src="https://user-images.githubusercontent.com/1647415/27755660-52df4104-5df1-11e7-800c-45a514bf3130.png"></a> </p> <p align="center"> <a href="src/_4_advanced_opengl/_6_2_cubemaps_environment_mapping.rs"><img width="250" alt="4_6_2" title="4_6_2 Framebuffers"src="https://user-images.githubusercontent.com/1647415/27843160-306a96aa-6111-11e7-8b89-15820f39cff0.png"></a> <a href="src/_4_advanced_opengl/_9_1_geometry_shader_houses.rs"><img width="250" alt="4_9_1" title="4_9_1 Geometry Shader"src="https://user-images.githubusercontent.com/1647415/28338597-c1fa9ed2-6c09-11e7-9e25-3e70e6fbacd9.png"></a> <a href="src/_4_advanced_opengl/_10_3_asteroids_instanced.rs"><img width="250" alt="4_10_3" title="4_10_3 Instancing"src="https://user-images.githubusercontent.com/1647415/28338123-3748ea6a-6c08-11e7-9c50-93f333a15083.png"></a> </p>

Chapters

1. Getting started

Notes

2. Lighting

3. Model loading

Notes

4. Advanced OpenGL

Status: complete

5. Advanced Lighting

Status: partially done (4/9).

6. PBR

Status: partially done (1/2).

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 <name>. This didn't play very well with the RLS and clippy (-> rust-lang-nursery/rls#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.