Giter Club home page Giter Club logo

gfx's Introduction

Documentation on docs.rs Travis Build Status AppVeyor Build Status crates.io Gitter Chat
Documentation | Blog

gfx-rs

gfx is a high-performance, bindless graphics API for the Rust programming language. It aims to be the default API for Rust graphics: for one-off applications, or higher level libraries or engines.

Motivation

  • Graphics APIs are mostly designed with C and C++ in mind, and hence are dangerous and error prone, with little static safety guarantees.
  • Providing type safe wrappers around platform-specific APIs is feasible, but only pushes the problem of platform independence to a higher level of abstraction, often to the game or rendering engine.
  • Modern graphics APIs, whilst providing a great degree of flexibility and a high level of performance, often have a much higher barrier to entry than traditional fixed-function APIs.
  • Graphics APIs like OpenGL still require the developer to 'bind' and 'unbind' objects in order to perform operations on them. This results in a large amount of boiler plate code, and brings with it the usual problems associated with global state.

Features

Graphics backends:

Hardware features:

  • off-screen render targets
  • multisampling
  • instancing
  • geometry shaders
  • tessellation (WIP)
  • persistent mapping (WIP)

Who's using it?

Biggest open-source projects are:

Shiny screens, including some older projects:

Snowmew Hematite Vange-rs Claymore ZoC Petri

Getting started

The gfx-rs git repository contains a number of examples. Those examples are automatically downloaded if you clone the gfx directory:

$ cd <my_dir>
$ git clone https://github.com/gfx-rs/gfx

where <my_dir> is a directory name of your choice. Once gfx is downloaded you can build any of the gfx examples. The examples are listed in the <my_dir>/gfx/Cargo.toml file. For example try:

$ cd gfx
$ cargo run --example cube

If you compile the example for the first time, it may take some while since all dependencies must be compiled too.

If you want to build your own stand-alone gfx program, add the following to your new Cargo.toml:

[dependencies]
gfx = "*"

For gfx to work, it needs access to the graphics system of the OS. This is typically provided through some window initialization API. gfx can use a couple of those to acquire graphical contexts. For example; glfw or glutin.

To see how the graphic context is acquired, see the cube example or the triangle example.

To use glutin, for example, your Cargo.toml must be extended with the following dependencies:

[dependencies]
...
glutin ="*"
gfx_window_glutin = "*"

You may want to inspect <my_dir>/gfx/Cargo.toml for other modules typically used in gfx programs.

Note

gfx is still in development. API may change with new backends/features to be implemented. If you are interested in helping out, please contact the developers on Gitter.

gfx's People

Contributors

anthiste avatar bastacyclop avatar brendanzab avatar bvssvni avatar csherratt avatar ebaklund avatar emberian avatar eugene2k avatar fkaa avatar hannobraun avatar homu avatar jamiltron avatar jeremija avatar kimundi avatar kokakiwi avatar kvark avatar lucidd avatar milibopp avatar mitchmindtree avatar msiglreith avatar mttr avatar nicholasbishop avatar olsonjeffery avatar photex avatar potpourri avatar red75prime avatar sectopod avatar serpis avatar tomaka avatar vickenty 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.