• Stars
    star
    194
  • Rank 194,096 (Top 4 %)
  • Language
    Rust
  • License
    MIT License
  • Created about 5 years ago
  • Updated 11 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Modern mid-level 2D graphics library

rgx

A mid-level 2D graphics library for rust

Introduction

rgx is a 2D graphics library built on top of wgpu and Vulkan/Metal. This library aims to be "mid-level" in that it provides an API that is higher level than Vulkan/Metal, but lower level than most 2D graphics libraries in the wild, by exposing the user to concepts such as pipelines, buffers and swap chains. The goal of rgx is to provide as simple an API as possible without sacrificing performance or control over the rendering pipeline. See the examples directory to get a feel.

At this stage, the focus is on 2D bitmap graphics and sprite rendering. Basic shape rendering is also supported, but not the core strength of this library. In the future, text rendering and more complex vector rasterization may be supported - however, these are incredibly difficult to do correctly, and I would recommend looking at Mozilla's pathfinder project for these needs. rgx aims to do one thing really well, and that is bitmap rendering.

Overview

The library is split into two modules, kit, and core. The latter provides rgx's core API with no assumption on what kind of 2D graphics will be rendered, while the former exposes some useful building blocks for various use-cases, such as a shape-oriented pipeline and a sprite oriented pipeline. Users can construct their own pipelines and use them with rgx.

rgx can be used with, or without a rendering backend. To use it with, turn on the renderer feature. When used without a backend, the kit module's backend-agnostic utilities can be used.

Pipelines included in the kit

  • shape2d: for batched 2D shape rendering
  • sprite2d: for batched 2D sprite rendering

Features

  • Batched texture rendering
  • Batched shape rendering
  • Basic primitives for sprite animation
  • Off-screen rendering support
  • Custom shader support
  • Custom pipeline support
  • Built-in depth testing

Usage

See examples/helloworld.rs for a simple usage example.

Rebuilding the shaders

To rebuild the shaders run the following:

glslc -c -Werror --target-env=vulkan ./examples/data/framebuffer.vert -o ./examples/data/framebuffer.vert.spv
glslc -c -Werror --target-env=vulkan ./examples/data/framebuffer.frag -o ./examples/data/framebuffer.frag.spv
glslc -c -Werror --target-env=vulkan ./src/kit/data/shape.frag        -o ./src/kit/data/shape.frag.spv
glslc -c -Werror --target-env=vulkan ./src/kit/data/sprite.frag       -o ./src/kit/data/sprite.frag.spv
glslc -c -Werror --target-env=vulkan ./src/kit/data/shape.vert        -o ./src/kit/data/shape.vert.spv
glslc -c -Werror --target-env=vulkan ./src/kit/data/sprite.vert       -o ./src/kit/data/sprite.vert.spv

Support

If you find this project useful, consider supporting it by sending β‚Ώ (Bitcoin) to 1HMfp9QFXmVUarNPmHxa1rhecZXyAPiPZd. <3

Copyright

(c) 2019 Alexis Sellier
Licensed under the MIT license.

More Repositories

1

rx

πŸ‘Ύ Modern and minimalist pixel editor
Rust
2,920
star
2

node-static

rfc 2616 compliant HTTP static-file server module, with built-in caching.
JavaScript
2,177
star
3

toto

the 10 second blog-engine for hackers
Ruby
1,473
star
4

http-console

simple, intuitive HTTP REPL β€” Speak HTTP like a local.
JavaScript
1,358
star
5

eyes.js

a customizable value inspector for node.js
JavaScript
342
star
6

journey

liberal JSON-only HTTP request routing for node.
JavaScript
321
star
7

nakamoto

Privacy-preserving Bitcoin light-client implementation in Rust
Rust
303
star
8

thingler

The amazingly simple-to-use, real-time, collaborative todo list!
JavaScript
296
star
9

dorothy

a basic template for toto, the blogging engine
Ruby
244
star
10

hijs

simple & fast javascript syntax highlighting for the browser
JavaScript
240
star
11

popol

Minimal non-blocking I/O for Rust
Rust
157
star
12

neovim-fuzzy

Minimalistic fuzzy file finding for neovim
Vim Script
111
star
13

dotfiles

~cloudhead
Vim Script
100
star
14

mutter

the tiny command-line interface library with lots of style~
Ruby
80
star
15

resourcer

a resource-oriented object-relational mapper for document databases
JavaScript
58
star
16

pixelog

simple pixel tracking server
Go
56
star
17

node-syslog

a syslog-ng TCP client, with basic fault-tolerance.
JavaScript
32
star
18

koi

minimal task management for hackers
Ruby
31
star
19

nonempty

Correct by construction non-empty list
Rust
30
star
20

px

Superseded by `rx`
C
30
star
21

erlapp.template

minimal erlang/OTP rebar template
Erlang
29
star
22

styleguide

style-guide for various languages
27
star
23

shady.vim

Shady vim color-scheme for late night hacking
Vim Script
23
star
24

vargs

practical variable argument handling in node.js
JavaScript
22
star
25

neovim-ghcid

Provides instant haskell error feedback inside of neovim, via ghcid.
Vim Script
21
star
26

microserde

miniserde minus the dependencies
Rust
18
star
27

pilgrim

a JSON consuming JavaScript XHR client for the browser
JavaScript
15
star
28

nimbus

nimble, durable, document store
JavaScript
14
star
29

spell-correct

ruby implementation of Norvig's spell corrector
Ruby
12
star
30

node-crawler

http crawler β€” (project under development)
JavaScript
12
star
31

arbre

a dynamic functional programming language experiment
C
10
star
32

rig.js

temporally extend an object's capabilities.
JavaScript
9
star
33

mrchat

micro chat client for the console, in c, with some tasteful ncurses
C
9
star
34

talker-plugins

A bunch of plugins for Talker (http://talkerapp.com)
JavaScript
9
star
35

node-provider

Manage HTTP content providers. It's 'Accept'-based routing, folks!
JavaScript
9
star
36

proto.js

prototype & other core extensions
JavaScript
8
star
37

github-unwatcher

Unwatch github repos
JavaScript
8
star
38

memoir

Self-describing, reflective parser combinators
Rust
7
star
39

spinsv

a stateless service runner inspired by runit
Haskell
7
star
40

bloomy

Bloom filter implementation in Rust
Rust
6
star
41

avl-auth

An authenticated AVL+ tree implementation in Haskell
Haskell
6
star
42

gogol

a bitmap drawing & animation library for Go
Go
6
star
43

cloudhead.io

This is my website.
CSS
5
star
44

prose

lightweight text to html parser, combining the best of Markdown with a hint of Textile
Ruby
5
star
45

s3web

scripts for publishing static sites to S3
Ruby
4
star
46

github-recommend

recommendation engine for github's 2009 contest
C
4
star
47

monsv

a service runner inspired by runsv
Go
3
star
48

diffraction

even stocks can be diffracted!
Ruby
3
star
49

melon

hybrid javascript/ruby micro app engine
Ruby
3
star
50

node-intro

intro to node.js presentation for montreal.js
JavaScript
3
star
51

cryptocurrency

Cryptocurrency library for Haskell
Haskell
2
star
52

golem

pre-forking HTTP server for node (old)
JavaScript
2
star
53

ghoul

your (node) deployment minion - a work in progress.
PHP
2
star
54

extender

handy extensions to keep your code cleanβ„’
Ruby
2
star
55

rx.cloudhead.io

CSS
2
star
56

birth

graceful linux system birthing
Vim Script
2
star
57

iohk-challenge

IOHK Haskell test
Haskell
1
star
58

sokol-gfx-rs

C
1
star
59

a-file-uploader

JavaScript
1
star
60

rgx

2D Graphics Toolkit for Rust
Rust
1
star