Giter Club home page Giter Club logo

rust-and-opengl-lessons's Introduction

rust-and-opengl-lessons

Project requires Rust 1.31

Collection of example code for learning OpenGL in Rust

The code directories with -x at the end contain experimental hacks where I explore future solutions.

Running

cargo run --release --bin <project>

Example:

cargo run --release --bin lesson-23-x

License

This library is distributed under the terms of either of:

at your option.

Contributing

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.

rust-and-opengl-lessons's People

Contributors

2m avatar nercury avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

rust-and-opengl-lessons's Issues

No available video device

OS: Ubuntu 18.04

just cloned repo, installed cmake and, according to instruction from readme
installed:
libsdl2-dev

and finally command
cargo run in lesson-01 gives error:
thread 'main' panicked at 'called Result::unwrap()on anErr value: "No available video device"', src/libcore/result.rs:1009:5

Googling didn't help.

May you suggest what is wrong?

License for code

Which license is this code under? Asking because I may want to try to build something using what you've done here as a base.

[cargo build error] failed to run custom build command for `openssl v0.9.24`

How to upgrade it to support openssl 1.1.1?

Compiling openssl v0.9.24
error: failed to run custom build command for openssl v0.9.24

Caused by:
process didn't exit successfully: /home/eli/git/rust-and-opengl-lessons/target/debug/build/openssl-e87e3c00af340f2c/build-script-build (exit code: 101)
--- stderr
thread 'main' panicked at 'Unable to detect OpenSSL version', /home/eli/.cargo/registry/src/github.com-1ecc6299db9ec823/openssl-0.9.24/build.rs:16:14
note: run with RUST_BACKTRACE=1 environment variable to display a backtrace
warning: build failed, waiting for other jobs to finish...
error: build failed

Correct code on lesson 6?

Hey,

After many tries, I could not get lesson 6 to compile.

I get this error:

➜  thrones git:(master) ✗ cargo run
   Compiling gl v0.1.0 (file:///Users/fllr/Development/thrones/lib/gl)
error[E0432]: unresolved import `bindings::Gl`
  --> lib/gl/src/lib.rs:10:9
   |
10 | pub use bindings::Gl as InnerGl;
   |         ^^^^^^^^^^^^^^^^^^^^^^^ no `Gl` in `bindings`

warning: unused import: `std::rc::Rc`
 --> lib/gl/src/lib.rs:6:5
  |
6 | use std::rc::Rc;
  |     ^^^^^^^^^^^
  |
  = note: #[warn(unused_imports)] on by default

warning: unused import: `std::ops::Deref`
 --> lib/gl/src/lib.rs:7:5
  |
7 | use std::ops::Deref;
  |     ^^^^^^^^^^^^^^^

error: aborting due to previous error

For more information about this error, try `rustc --explain E0432`.
error: Could not compile `gl`.

To learn more, run the command again with --verbose.

When I have this written down:

mod bindings {
    include!(concat!(env!("OUT_DIR"), "/bindings.rs"));
}

use std::rc::Rc;
use std::ops::Deref;

pub use bindings::*;
pub use bindings::Gl as InnerGl;

Any ideas on what's wrong here?

Cargo Command in Lesson 06

The command you have in the tutorial: cargo new --vcs none gl should probably be cargo new --vcs none --lib gl

The directory tree you show implies that you mean to create a new lib, rather than a binary project.

Autocomplete in IntelliJ IDEA

Hey, I'm following your excellent tutorial series. Thank you for writing these!

Towards the end of lesson 6, there is a suggestion about how to get autocomplete to work, which involves copying the auto-generated bindings.rs from the output directory back into the project. That didn't actually work for me (maybe I wasn't copying it to the right place, not sure - I'm completely new to Rust).

But regardless, it seems there is now a better way, at least for IntelliJ. I thought it might be worth updating the lesson with these instructions, since AutoComplete is so immensely helpful for someone who is learning Rust and OpenGL (the target audience of this blog series).

There is an experimental feature of the intellij-rust plugin which allows for auto-completion to work when using:

include!(concat!(env!("OUT_DIR"), "/bindings.rs"));

To enable it, open the Maintenance Menu using Ctrl+Shift+Alt+/, select "Experimental Features", then enable the following feature:

org.rust.cargo.fetch.out.dir

intellij_rust_out_dir

Then restart the IDE.

Worked beautifully for me. There is some discussion here as to why the feature is designated as Experimental and disabled by default:

intellij-rust/intellij-rust#4573

And the original issue from intellij-rust is here:

intellij-rust/intellij-rust#1908

New lesson?

Hello, your work is really inspiring and I used it to start a project on my own. Are you going to continue it? I saw lesson-08-Next in the repo. If you are, do you need help? Could I be of some use?
Anyway, thank you for what you have already done.

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.