https://github.com/ghztomash/ofxheadlessfbo
openFrameworks addon for CPU based drawing 2D primitive shapes.
https://github.com/ghztomash/ofxheadlessfbo
drawing graphics ofxaddon openframeworks openframeworks-addon rasberry-pi
Last synced: 2 months ago
JSON representation
openFrameworks addon for CPU based drawing 2D primitive shapes.
- Host: GitHub
- URL: https://github.com/ghztomash/ofxheadlessfbo
- Owner: ghztomash
- License: other
- Created: 2022-02-16T22:50:31.000Z (about 4 years ago)
- Default Branch: main
- Last Pushed: 2022-02-16T22:52:35.000Z (about 4 years ago)
- Last Synced: 2025-01-19T13:15:18.639Z (about 1 year ago)
- Topics: drawing, graphics, ofxaddon, openframeworks, openframeworks-addon, rasberry-pi
- Language: C++
- Homepage:
- Size: 85 KB
- Stars: 2
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: readme.md
- License: license.txt
Awesome Lists containing this project
README
# ofxHeadlessFbo

## Introduction
This is a simple addon implimenting the basic 2D drawing functions that don't
utilize OpenGL. Inspired from the [Adafruit GFX Library](https://github.com/adafruit/Adafruit-GFX-Library).
The shapes are drawn directly to an buffer of `ofPixels` instead of `ofTextures`.
This addon is intended to be used in applications that run headless,
for example a Rasberry Pi controlling LED strips without a monitor connected
(thus unable to run OpenGL).
I hope you find this useful.
Please open an issue if you have suggestions or find bugs, and feel free to
contribute improvements.
## Installation
Download the addon into your `openframeworks/addons/` directory or
install using git:
`git clone https://github.com/ghztomash/ofxHeadlessFbo.git`
## Use
Before drawing into the buffer you need to first allocate it's size and
define the pixel color type.
```c++
ofxHeadlessFbo hfbo;
void ofApp::setup(){
// allocate virtual FBO buffer
hfbo.allocate(800, 300, OF_PIXELS_RGBA);
}
void ofApp::update(){
hfbo.clear(ofColor(0,0,0,0));
hfbo.setColor(ofColor(0,255,0));
hfbo.drawTriangle( 0, size, size/2.0, 0, size, size);
hfbo.setColor(ofColor(0,0,255,127));
hfbo.drawRectangle(size/4.0,size/4.0,size/2.0,size/2.0);
hfbo.setColor(ofColor(255,255,255,127));
hfbo.drawCircle(size/2.0,size/2.0, size/4.0);
}
```
The supported shapes are
You can draw the buffer directly onto the screen with
```c++
void ofApp::draw(){
// draw the virtual FBO
hfbo.draw(10, 10);
}
```
or get the pixel data and transmit over UDP to LED strips.
## Tested
MacOS, Linux and Windows
## License
BSD
## Credits
Created and maintained by [Tomash GHz](https://github.com/ghztomash)
Ported sections from [Adafruit GFX Library](https://github.com/adafruit/Adafruit-GFX-Library)