Giter VIP home page Giter VIP logo

learn-opengl-rs's Introduction

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.

1_3_2 2_6 3_1

4_6_2 4_9_1 4_10_3

Chapters

Notes

  • You can mostly ignore the setup instructions at Getting-started/Creating-a-window. Just create a new project with cargo and copy the dependency section from Cargo.toml. Only glfw-rs might need some more setup, see here for details. You can also use 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 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! macro from chapter 7.
  • exercises have been mostly omitted. You can look up the solutions in the original C++ source.

Notes

  • For simplicity tobj is used instead of assimp (simpler interface, pure Rust and later tutorials only load OBJ files anyway). For alternatives see here and here.
  • 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).

Status: complete

Status: partially done (4/9).

Status: partially done (1/2).

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.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.