Convert Figma logo to code with AI

openframeworks logoopenFrameworks

openFrameworks is a community-developed cross platform toolkit for creative coding in C++.

9,941
2,553
9,941
1,094

Top Related Projects

Source code for the Processing Core and Development Environment (PDE)

5,320

Cinder is a community-developed, free and open source library for professional-quality creative coding in C++.

6,487

JUCE is an open-source cross-platform C++ application framework for desktop and mobile applications, including VST, VST3, AU, AUv3, LV2 and AAX audio plug-ins.

18,196

Cocos2d-x is a suite of open-source, cross-platform, game-development tools utilized by millions of developers across the globe. Its core has evolved to serve as the foundation for Cocos Creator 1.x & 2.x.

23,262

Desktop/Android/HTML5/iOS Java game development framework

22,183

A simple and easy-to-use library to enjoy videogames programming

Quick Overview

openFrameworks is an open-source C++ toolkit designed for creative coding. It simplifies the process of creating interactive applications and generative art by providing a comprehensive set of tools and libraries for graphics, audio, video, and more. The framework is cross-platform and supports Windows, macOS, Linux, iOS, and Android.

Pros

  • Extensive library of tools for creative coding and multimedia projects
  • Cross-platform compatibility, allowing for easy deployment on multiple operating systems
  • Active community and regular updates
  • Well-documented with numerous examples and tutorials

Cons

  • Steep learning curve for beginners, especially those new to C++
  • Large file size and dependencies can make initial setup time-consuming
  • Performance may be slower compared to lower-level frameworks
  • Limited mobile support compared to desktop platforms

Code Examples

  1. Drawing a circle:
void ofApp::draw(){
    ofSetColor(255, 0, 0);
    ofDrawCircle(ofGetWidth()/2, ofGetHeight()/2, 100);
}
  1. Playing a sound:
ofSoundPlayer sound;

void ofApp::setup(){
    sound.load("mySound.mp3");
    sound.play();
}
  1. Capturing video from a webcam:
ofVideoGrabber vidGrabber;

void ofApp::setup(){
    vidGrabber.setup(640, 480);
}

void ofApp::update(){
    vidGrabber.update();
}

void ofApp::draw(){
    vidGrabber.draw(0, 0);
}

Getting Started

  1. Download openFrameworks from the official website: https://openframeworks.cc/download/
  2. Extract the downloaded file to your preferred location
  3. Use the project generator to create a new project:
    • Open projectGenerator in the openFrameworks folder
    • Set a project name and location
    • Add any required addons
    • Click "Generate" to create the project
  4. Open the generated project in your IDE (e.g., Xcode, Visual Studio)
  5. Build and run the project

To start coding, modify the ofApp.cpp file in your project. Here's a basic example:

#include "ofApp.h"

void ofApp::setup(){
    ofBackground(0);
}

void ofApp::draw(){
    ofSetColor(255);
    ofDrawBitmapString("Hello, openFrameworks!", 20, 20);
}

This will display "Hello, openFrameworks!" on a black background.

Competitor Comparisons

Source code for the Processing Core and Development Environment (PDE)

Pros of Processing

  • Simpler syntax and easier learning curve for beginners
  • Extensive documentation and large community support
  • Cross-platform compatibility with Java-based architecture

Cons of Processing

  • Limited performance compared to C++-based OpenFrameworks
  • Less flexibility for advanced users and complex projects
  • Fewer options for low-level hardware access

Code Comparison

Processing:

void setup() {
  size(400, 400);
}

void draw() {
  ellipse(mouseX, mouseY, 50, 50);
}

OpenFrameworks:

void ofApp::setup(){
    ofSetWindowShape(400, 400);
}

void ofApp::draw(){
    ofDrawEllipse(ofGetMouseX(), ofGetMouseY(), 50, 50);
}

Both examples create a 400x400 window and draw a circle following the mouse cursor. Processing's syntax is more concise and intuitive for beginners, while OpenFrameworks offers more granular control and C++ performance benefits. Processing uses a built-in drawing loop, whereas OpenFrameworks requires explicit setup and draw functions within a class structure.

5,320

Cinder is a community-developed, free and open source library for professional-quality creative coding in C++.

Pros of Cinder

  • More modern C++ design, leveraging C++11/14 features
  • Better support for 3D graphics and advanced rendering techniques
  • Tighter integration with native OS APIs for improved performance

Cons of Cinder

  • Steeper learning curve for beginners
  • Smaller community and fewer learning resources compared to OpenFrameworks
  • Less frequent updates and releases

Code Comparison

OpenFrameworks:

void ofApp::draw(){
    ofBackground(0);
    ofSetColor(255);
    ofDrawCircle(ofGetWidth()/2, ofGetHeight()/2, 100);
}

Cinder:

void MyApp::draw()
{
    gl::clear(Color::black());
    gl::color(Color::white());
    gl::drawSolidCircle(getWindowCenter(), 100);
}

Both OpenFrameworks and Cinder are powerful C++ frameworks for creative coding and interactive applications. OpenFrameworks is known for its simplicity and extensive library of add-ons, making it more accessible for beginners. It has a larger community and more learning resources available.

Cinder, on the other hand, offers a more modern C++ approach and better performance for advanced graphics applications. It provides deeper integration with native APIs and is often preferred by experienced developers working on complex projects.

The choice between the two depends on the specific project requirements, developer experience, and desired learning curve.

6,487

JUCE is an open-source cross-platform C++ application framework for desktop and mobile applications, including VST, VST3, AU, AUv3, LV2 and AAX audio plug-ins.

Pros of JUCE

  • Cross-platform audio plugin development with a focus on professional-grade audio applications
  • Extensive audio processing capabilities and built-in DSP modules
  • Robust GUI framework with WYSIWYG editor for rapid interface design

Cons of JUCE

  • Steeper learning curve, especially for beginners in audio programming
  • More complex setup process compared to OpenFrameworks
  • Licensing costs for commercial use

Code Comparison

JUCE (Audio processing example):

void processBlock (AudioBuffer<float>& buffer, MidiBuffer& midiMessages)
{
    for (int channel = 0; channel < buffer.getNumChannels(); ++channel)
    {
        float* channelData = buffer.getWritePointer(channel);
        for (int sample = 0; sample < buffer.getNumSamples(); ++sample)
        {
            channelData[sample] *= gain;
        }
    }
}

OpenFrameworks (Graphics example):

void ofApp::draw(){
    ofBackground(0);
    ofSetColor(255);
    ofDrawCircle(ofGetWidth()/2, ofGetHeight()/2, 100);
}

JUCE excels in audio development with professional-grade tools, while OpenFrameworks offers a more accessible approach for creative coding and multimedia projects. The code examples highlight JUCE's focus on audio processing and OpenFrameworks' simplicity in graphics programming.

18,196

Cocos2d-x is a suite of open-source, cross-platform, game-development tools utilized by millions of developers across the globe. Its core has evolved to serve as the foundation for Cocos Creator 1.x & 2.x.

Pros of cocos2d-x

  • More comprehensive game development framework with built-in physics, audio, and UI systems
  • Better cross-platform support, including mobile platforms
  • Larger community and more extensive documentation

Cons of cocos2d-x

  • Steeper learning curve due to its complexity
  • Heavier framework, which may impact performance for simpler projects
  • Less flexibility for non-game applications

Code Comparison

openFrameworks:

void ofApp::draw(){
    ofBackground(0);
    ofSetColor(255);
    ofDrawCircle(ofGetWidth()/2, ofGetHeight()/2, 100);
}

cocos2d-x:

void HelloWorld::draw(Renderer *renderer, const Mat4 &transform, uint32_t flags) {
    DrawPrimitives::drawCircle(Vec2(visibleSize.width/2, visibleSize.height/2), 100, 0, 360, true, 50, 1.0f, 1.0f);
}

Both frameworks use C++ for drawing, but cocos2d-x requires more setup and uses its own coordinate system and drawing primitives, while openFrameworks uses a simpler approach with OpenGL-like functions.

23,262

Desktop/Android/HTML5/iOS Java game development framework

Pros of libGDX

  • Cross-platform development for desktop, mobile, and web
  • Robust game development framework with extensive features
  • Active community and well-maintained documentation

Cons of libGDX

  • Steeper learning curve for beginners
  • Less suitable for non-game applications
  • Java-centric, which may not be ideal for all developers

Code Comparison

libGDX example:

public class MyGame extends ApplicationAdapter {
    SpriteBatch batch;
    Texture img;

    @Override
    public void create() {
        batch = new SpriteBatch();
        img = new Texture("badlogic.jpg");
    }
}

openFrameworks example:

void ofApp::setup(){
    ofBackground(255,255,255);
    ofSetCircleResolution(100);
}

void ofApp::draw(){
    ofSetColor(255,0,0);
    ofDrawCircle(ofGetWidth()/2, ofGetHeight()/2, 50);
}

Key Differences

  • libGDX is primarily for game development, while openFrameworks is more general-purpose
  • libGDX uses Java, openFrameworks uses C++
  • libGDX has better mobile support, openFrameworks excels in desktop and artistic applications
  • openFrameworks has a simpler setup process for beginners
  • libGDX offers more built-in game-specific features and utilities

Both frameworks are powerful tools for creative coding and application development, with their strengths lying in different areas. The choice between them depends on the specific project requirements and developer preferences.

22,183

A simple and easy-to-use library to enjoy videogames programming

Pros of raylib

  • Lightweight and easy to learn, with a simple API
  • No external dependencies, making it easier to set up and deploy
  • Better performance for simple 2D and 3D applications

Cons of raylib

  • Less extensive feature set compared to OpenFrameworks
  • Smaller community and ecosystem
  • Limited support for advanced graphics techniques and shaders

Code Comparison

raylib:

#include "raylib.h"

int main() {
    InitWindow(800, 450, "raylib example");
    while (!WindowShouldClose()) {
        BeginDrawing();
            ClearBackground(RAYWHITE);
            DrawText("Hello, raylib!", 190, 200, 20, LIGHTGRAY);
        EndDrawing();
    }
    CloseWindow();
    return 0;
}

OpenFrameworks:

#include "ofMain.h"

class ofApp : public ofBaseApp {
public:
    void setup() {}
    void draw() {
        ofBackground(255);
        ofSetColor(200);
        ofDrawBitmapString("Hello, OpenFrameworks!", 190, 200);
    }
};

int main() {
    ofSetupOpenGL(800, 450, OF_WINDOW);
    ofRunApp(new ofApp());
}

Both libraries offer simple ways to create windows and draw basic shapes, but OpenFrameworks provides a more object-oriented approach with its ofApp class structure.

Convert Figma logo designs to code with AI

Visual Copilot

Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.

Try Visual Copilot

README

openFrameworks

openFrameworks is a C++ toolkit for creative coding. If you are new to OF, welcome!

Build status

  • The master branch contains the newest, most recently updated code. This code is packaged and available for download in the "Nightly Builds" section of openframeworks.cc/download.
  • The stable branch contains the code corresponding to the last stable openFrameworks release. This stable code is packaged and available for download at openframeworks.cc/download.
PlatformMaster branchStable branch
Windows MSYS2Build statusBuild status
Windows Visual StudioBuild statusBuild status
Linux 64 & ArmLinux Build StatusLinux Build Status
EmscriptenEmscripten Build StatusEmscripten Build Status
macosmacos Build Statusmacos Build Status
iOS & tvOSiOS tvOS Build StatusiOS tvOS Build Status

folder structure

This release of OF comes with several folders:

  • addons
  • apps
  • docs
  • examples
  • export (on some systems)
  • libs
  • other
  • scripts
  • projectGenerator

docs has some documentation around OF usage, per platform things to consider, etc. You should definitely take a look in there; for example, if you are on OSX, read the osx.md. apps and examples are where projects go -- examples contains a variety of projects that show you how to use OF, and apps is where your own projects will go. libs contains the libraries that OF uses, including the openframeworks core itself. addons are for additional functionality that's not part of the core. export is for DLLs and dylibs that need to be put in each compiled project. The scripts folder has the templates and small scripts for automating OF per platform. project generator is a GUI based tool for making new projects - this folder is only there in packaged releases.

One idea that's important is that OF releases are designed to be self-contained. You can put them anywhere on your hard drive, but it's not possible to mix different releases of OF together, so please keep each release (0.8.0, 0.8.1) separate. Projects may generally work from release to release, but this is not guaranteed. Because OF is self-contained, there's extensive use of local file paths (ie, ../../../) throughout OF. It's important to be aware of how directories are structured. A common error is to take a project and move it so that it's a level below or above where it used to be compared to the root of OF. This means that links such as ../../../libs will break.

Get involved

The openframeworks forum:

http://forum.openframeworks.cc/

is a warm and friendly place. Please ask or answer a question. The most important part of this project is that it's a community, more than just a tool, so please join us! Also, this is free software, and we learn so much about what is hard, what doesn't make sense, what is useful, etc. The most basic questions are acceptable here! Don't worry, just join the conversation. Learning in OF is social, it's hard to do it alone, but together we can get far!

Our GitHub site is active:

https://github.com/openframeworks/openFrameworks

if you have bugs or feature requests, consider opening an issue. If you are a developer and want to help, pull requests are warmly welcome. Please read the contributing guide for guidelines:

https://github.com/openframeworks/openFrameworks/blob/master/CONTRIBUTING.md

We also have a developer's mailing list, which is useful for discussing issues around the development and future of OF.

Developers

To grab a copy of openFrameworks for your platform, check the download page on the main site.

If you are working with the Git repository, the stable branch of the OF repository corresponds to the most recent release, with a few important differences:

  1. The release includes a simple openFrameworks project generator.
  2. This GitHub repository contains code and libs for all the platforms, but the releases are done on a per-platform basis.
  3. This GitHub repository has no project files for the different examples. They are generated automatically for each release using a tool in apps/projectGenerator/.
  4. There are no external dependencies in this repository, you can download them using the download_libs.sh script for each platform in the particular platform folder inside scripts.

If you want to work with the openFrameworks GitHub repository, you need to download the external dependencies and you should use the project generator to create project files for all the code in examples/. To generate the project files with the project generator enable the 'Advanced Options' in the settings tab, then use 'Update Multiple' to update the projects for the examples/ folder path in the repo.

To set up the project generator submodule within the OF repo, use the command git submodule init then git submodule update whilst inside the openFrameworks repo.

For more info on working with the Project Generator, for per-platform readmes, and more information, see the documentation.

Versioning

openFrameworks uses Semantic Versioning, although strict adherence will only come into effect at version 1.0.0.