Documentation / Overview

How VectorGL fits together

A practical tour of the renderer, the two drawing models, and the shortest path to your first frame.

Introduction

A focused 2D layer over OpenGL

VectorGL turns common vector operations—paths, shapes, text, images, clipping, and effects—into GPU-backed draw calls. Its public API stays small enough to learn quickly while still supporting structured scenes and animation.

Choose the API per surface.Canvas and Scene share the same renderer, so an application can use both without maintaining separate graphics stacks.
Architecture

Three layers with clear responsibilities

Your applicationCanvas or SceneDrawing intent and interaction
VectorGLRendererBatches, paths, text, effects
GPUOpenGL 3.3Portable hardware rendering

Read the complete class and code-flow architecture guide →

Rendering models

Immediate when you want control, retained when you want structure

Canvas API

Draw every frame

Best for charts, editors, custom widgets, and highly dynamic visuals. Your code owns ordering and redraw logic.

Canvas guide →
Scene API

Compose persistent nodes

Best for interface trees and animated objects. VectorGL manages traversal, transforms, hit testing, and transitions.

Scene guide →
Frame lifecycle

A predictable render loop

  1. Process inputUpdate interaction state and scene properties.
  2. Advance animationTick the animator using frame delta time.
  3. Submit drawingIssue Canvas operations or render the Scene tree.
  4. PresentSwap the host window's OpenGL buffers.
Getting started

Build and run your first frame

VectorGL uses CMake and requires a C++20 compiler. Clone the repository to build the included examples, or consume it with FetchContent.

Terminal
git clone https://github.com/mahtab04/vectorgl.git
cd vectorgl
cmake -S . -B build -DVECTORGL_BUILD_EXAMPLES=ON
cmake --build build --config Release