https://github.com/prideout/parg
tiny C library of various graphics utilities and GL demos
https://github.com/prideout/parg
Last synced: 5 months ago
JSON representation
tiny C library of various graphics utilities and GL demos
- Host: GitHub
- URL: https://github.com/prideout/parg
- Owner: prideout
- License: mit
- Created: 2015-09-25T02:06:35.000Z (over 10 years ago)
- Default Branch: master
- Last Pushed: 2019-06-22T02:39:21.000Z (almost 7 years ago)
- Last Synced: 2024-10-29T19:17:18.626Z (over 1 year ago)
- Language: C++
- Homepage:
- Size: 1.01 MB
- Stars: 56
- Watchers: 4
- Forks: 3
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# parg
[](https://travis-ci.org/prideout/parg)
This is a C99 library with some basic stuff for bootstrapping a graphics engine. Currently it is tested against OpenGL 2.1 on OS X, and WebGL 1.0 via Emscripten.
The [par](https://github.com/prideout/par) library is a required submodule, so be sure to do this after cloning the repo:
```bash
$ git submodule update --init
```
The [API](https://github.com/prideout/parg/blob/master/include/parg.h) is divided into modules, each of which has a single C file:
- **token** string-to-uint32 hashing, and a lookup table for uint32-to-string.
- **asset** unified way of loading buffers, shaders, and textures.
- **buffer** an untyped blob of memory that can live on the CPU or GPU.
- **mesh** triangle meshes and utilities for procedural geometry.
- **texture** thin wrapper around OpenGL texture objects.
- **uniform** thin wrapper around OpenGL shader uniforms.
- **state** thin wrapper around miscellaneous portions of the OpenGL state machine.
- **varray** an association of buffers with vertex attributes.
- **draw** thin wrapper around OpenGL draw calls.
- **zcam** simple map-style camera with basic zoom & pan controls.
## How to Build for macOS
```bash
brew update
brew install cmake uncrustify glfw clang-format pkg-config
mkdir build ; cd build ; cmake .. ; make -j
```
You can then run a demo like this:
```bash
./trefoil
```
## How to Build for WebGL on macOS
```bash
brew update
brew install cmake uncrustify glfw clang-format pkg-config emscripten
python emsetup.py
source aliases.sh
initjs && build
```
You can then run a demo like this:
```bash
build/trefoil
[Push Esc to quit]
cd web
python -m SimpleHTTPServer
[Open localhost:8000 in a web browser]
```
I'm currently using:
- glfw 3.3
- emscripten 1.36.5