Simple, fast 2D/3D math visual app (like GeoGebra) using C++ scripting and hot-reloadable DLLs.
Graphite is a lightweight 2D/3D math visualization app similar to GeoGebra or matplotlib, but built with C++ scripting and hot-reloadable DLLs for fast interactive development. It uses the author's rendering library CWindow.
Why it exists:
- I dislike Python 🐍
- GeoGebra can be slow 🐢
- I enjoy building my own tools 💻
- Learning & experimentation 🎓
Who it's for:
- People who want a faster graphical math app ⚡
- People who hate Python ❤️
![]() |
![]() |
- About
- Screenshots
- Installation
- Usage
- Important Note
⚠️ - Prerequisites
- Versions and features
- Other Docs
- Cat 🐱
git clone --recursive https://github.com/daynlight/Graphite.git
cd Graphite
mkdir -p build
cd build
cmake ..
cmake --build . --config Release
cd ..
cd bin/
sudo ./GraphiteInstaller
cd ../..- Start Graphite:
Graphite <flags> <path>- Example script (Graphite.cpp)
// Graphite
// Copyright 2025 Daynlight
// Licensed under the Apache License, Version 2.0.
// See LICENSE file for details.
#define BUILDING_SCRIPT_DLL
#include <Graphite/ScriptInterface.h>
#include <Graphite/Math.h>
#include <math.h>
#define SAMPLES 1000
class Script : ScriptInterface {
Graphite::Math::Point points[SAMPLES];
float f(float x) { return (1/2.0f) * sin(x * M_PI * 2); }
void Init() {
for (int i = 0; i < SAMPLES; i++) {
float x = (i / (SAMPLES - 1.0f) * 2) - 1;
float y = f(x);
points[i].setPos({x, y});
}
}
void Update() { }
void Draw() {
for (int i = 0; i < SAMPLES; i++)
points[i].drawPoint();
}
void Destroy() { }
};
extern "C" ScriptInterface* SCRIPT_API GetScript() {
Script* script = new Script();
return (ScriptInterface*)script;
};
extern "C" void SCRIPT_API DeleteScript(ScriptInterface* script) {
Script* temp_script = (Script*)script;
delete temp_script;
};- -h, --help — show program help
- -i, --init — initialize default files
- -s, --sandbox — enable sandbox mode (recommended for editing)
- -v, -d, --verbose, --debug — verbose / debug output
The final path is the last argument. If a filename is specified it will create a directory instead.
- Use sandbox mode for development and live-editing to avoid crashes:
Graphite -s <path>orGraphite -s -v <path>. - Sandbox runs the script in a fork for safer testing; if the script crashes, it won't take down the host process.
- Always end all threads and free allocations in
Destroy()to avoid leaks and undefined behavior. - When your script is stable, run in normal mode for better performance.
- Sandbox performs an initial test run in the fork before the main execution to catch runtime issues early.
- CMake (for building)
- C++17 (compiler)
- Git (for cloning repo and submodules)
v2.0.0
- Installer
- Plots
- Math Interface for Plots
- Better Point Class
- Line Class
- Polynomial Class
- Ui
- Templates
v1.0.1
- ScriptController edge-case handling
- Sandbox mode now tests before execution
- Edge-case fixes for Graphite, Flags, AppRenderer, ScriptLoader
v1.0.0
- Sandbox mode
- Script sandbox last-write detection
- Separate CWindow renderer via AppRenderer
- Safer script destroy
Prototype
- Hot script loading
- Help flag
- Init flag
- Verbose flag
- Points rendering
- Multiple point prints
- Installation guide
- Docs
- Auto create path


