Code Monkey home page Code Monkey logo

nanovg-rs's Introduction

NanoVG Rust wrapper

Now with Cargo!

This is a Rust-language wrapper for the NanoVG vector graphics library.

NanoVG is written in C, and it supports several back-ends: GL2, GL3, GLES...

NanoVG is not an extremely complete or extensive implementation of vector graphics. It is however small and hardware-accelerated, which is what I want.

Screenshot

yay! screenshot works in rust demo!

Prerequisites

This build process will produce a Rust library, which includes the Rust wrapper for nanovg functions, and which statically links in those functions. NanoVG only does the graphics drawing, though; you'll need to be getting a GL context from somewhere. The examples use GLFW.

Examples require GLFW3 to be installed.

Building

Build using Cargo:

git clone --recursive https://github.com/KevinKelley/nanovg-rs
cd nanovg-rs
cargo build

To build the demo, then:

cd examples/demo
cargo build
./target/debug/example

Note that font and image resources won't be found if you run from inside the target directory.

In the demo,

  • 'p' switches between pre- and un-premultiplied alpha;
  • 's' saves a screenshot;
  • and 'space' toggles scale/rotate of the pseudo-window stuff.

Usage

Add the following to Cargo.toml:

[dependencies.nanovg]
version = "*"
features = ["glX"]

where glX should be exactly one of gl2, gl3, gles2 or gles3, to specify the version of OpenGL for which NanoVG should be built.

Used By

License

The binding is licensed under the MIT license. NanoVG is released under the zlib license.

Links

nanovg-rs's People

Contributors

dleslie avatar enex avatar genbattle avatar gw3583 avatar kevinkelley avatar lordi avatar netvl avatar whitequark avatar

Watchers

 avatar  avatar

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.