gl_object

Crates.iogl_object
lib.rsgl_object
version0.0.5
sourcesrc
created_at2022-10-02 15:25:19.352026
updated_at2022-10-06 10:11:13.797133
descriptionA gl_object libray for quick use.
homepagehttps://github.com/aniketbiprojit/gl-objects-rs
repositoryhttps://github.com/aniketbiprojit/gl-objects-rs
max_upload_size
id678367
size88,742
Aniket Biprojit Chowdhury (aniketbiprojit)

documentation

https://github.com/aniketbiprojit/gl-objects-rs

README

gl-objects-rs

crates LICENSE

Usage as Library:

For Primitives


let rectangle = &mut Rectangle::new(200 //width, 
                                    200, // height
                                    "<path-to-glsl-shader>.shader");
'render: loop { 
    rectangle.attach(&gl);

    if window.resized == true {
        rectangle.window_resize(draw_size,size);
    }

    if key == "space" {
        rectangle.move_model(0,2.0,0.0);
    }
    rectangle.render(&gl);
}
rectangle.detach(&gl);

For Shaders

Note: Automatically adds GLSL version.

let shaders = ShaderData::new(source);

let shader_sources = [
    (VERTEX_SHADER_INT, shaders.vertex_shader.source),
    (VERTEX_SHADER_INT, shaders.fragment_shader.source),
];

Run with glfw

cargo run
cargo run --example glfw

Run with sdl2

cargo run --features sdl2
cargo run --example sdl2 --features sdl2

Setting up SDL2

macOS

Homebrew

On macOS, it's a good idea to install these via [homebrew][homebrew].

brew install sdl2

In recent versions of Homebrew, the installed libraries are usually linked into $(brew --prefix)/lib. If you are running an older version, the symlink for SDL might reside in /usr/local/lib.

To make linking libraries installed by Homebrew easier, do the following for your respective shell.

Add this line to your ~/.zshenv or ~/.bash_profile depending on whether you use ZSH or Bash.

export LIBRARY_PATH="$LIBRARY_PATH:$(brew --prefix)/lib"

Linux and Windows

Check out docs

Sponsor

Become a patron

Commit count: 52

cargo fmt