A browser-based 2D drawing tool that exports OpenGL-ready C++ header files with vertex data. Draw shapes visually and get plug & play code for your OpenGL projects.
Live Demo: DrawGL
- Primitives: Points, Lines, Line Strips, Line Loops, Triangles, Triangle Strips, Triangle Fans
- Shapes: Rectangles, Circles, Polygons, Custom Polylines
- Color Picker: Custom colors for each shape
- Grid System: Configurable grid with snap-to-grid support
- Vertex Snap: Snap to existing vertices for precision
- Select & Move: Click to select, drag to reposition shapes
- Vertex Editor: Edit individual vertices (Tool: E)
- Inspector Panel: Modify shape properties, primitive types, and colors
- Hierarchy: Organize and manage all shapes in your project
V- Select toolM- Move toolP- PointL- LineK- PolylineO- Line LoopT- TriangleR- RectangleU- Rounded RectangleC- Circle (Arc)G- PolygonF- Triangle FanE- Vertex EditCtrl+S- Save projectCtrl+E- Export C++Ctrl+D- Duplicate selectedDelete- Delete selectedEscape- Clear selection
- Browser Storage: Auto-save to local storage
- File Export/Import: Save projects as
.drawgl.jsonfiles to your device - Load Options: Load from browser storage or device files
- Export as modern OpenGL 3.3+ compatible C++ header files
- Interleaved vertex data (position + color)
- Ready-to-use VAO/VBO setup functions
- Namespace customization
- Optional comments and color data
- Open
index.htmlin a web browser (needs server to avoid CORS issues, useLive Serveror similar) - Or use the Live Demo
- Use the toolbar to draw shapes on the canvas
- Customize colors and properties in the Inspector panel
- Name your project (top center input)
- Click the "Export C++" button
- Configure:
- Namespace (e.g.,
Assets) - Filename (e.g.,
assets.h) - Toggle comments and colors
- Namespace (e.g.,
- Click "Download File"
Place the exported header in your project:
your_project/
├── assets.h ← Your exported header
├── main.cpp
└── ...
In your C++ code:
#include "assets.h"
// Initialize all shapes (call once)
Assets::initAllShapes();
// In your render loop
Assets::drawShape("shape_name");
// or draw all at once
Assets::drawAll();
// Cleanup when done
Assets::cleanup();Check the demo/ folder for a complete working example:
main.cpp- Shows how to initialize and draw assetsgl_template.h- Basic OpenGL setup (GLAD, GLFW Boilerplate)assets.h- Sample exported assets
Saved projects use .drawgl.json format containing:
- All shape vertex data
- Colors and primitive types
- Grid and snap settings
- Project metadata
- For C++ demo: OpenGL 3.3+, GLAD, GLFW
- Use snap-to-grid for aligned shapes
- Use snap-to-vertex for connecting shapes precisely
- Export with comments for better code readability
- Save frequently to browser storage and export backups to device
Author: Faysal


