C++11 cross-platform GPU-accelerated pixel-space 2D drawing library.
API documentation | Contributing | FAQ
Features
- cross-platform: Linux, MaxOS, Windows, MinGW
- very fast (using OpenGL instancing under the hood)
- integer pixel space (resize agnostic)
- indexed primitives, images, atlases, transparency, z-order
- text rendering (real-time font atlas generation from FreeType file)
How to use
The project is using CMake as build solution.
You can build the library using one of the modern compiler: Clang, GCC, MSVC.
Some dependencies (GLEW, AGG, FreeType) are required. You can find it in deps
folder and build by yourself.
See draw-wxWidgets repo as example of using the library with wxWidgets.
Licensing
The library is licensed under the Simplified BSD License.
Example
class MyContext final :
public Context {
public:
virtual void setCurrent() final { mySetCurrent(); }
};
auto renderer =
makeRenderer(std::move(make_unique<MyContext>()));
image->upload({dataPtr, dataSize});
auto rect = renderer->makeRect();
rect->position({10, 20});
rect->size({30, 30});
rect->color({1.0f, 0.5f, 0.5f});
rect->image(image);
rect->visibility(true);
auto text = renderer->makeText();
text->position({10, 60});
text->font(renderer->makeFont("cour.ttf", 10));
text->text(L"ABCDEFG");
text->visibility(true);
renderer->resize(myScreenSize);
renderer->draw({0.8f, 0.8f, 0.8f});
mySwapBuffers();