Skip to content

OpenGL-Graphics/imgui-paint

Repository files navigation

Screenshot

Screenshot

Building

Clone repo and its submodules:

# clone repo with its submodules
$ git clone --recursive https://github.com/OpenGL-Graphics/imgui-paint

# build & run
$ cd imgui-paint
$ mkdir build && cd build
$ cmake .. && make -j && ./main

# to get new commits from submodules
$ git submodule update --init --recursive --remote

Dependencies

  • ImGui: used to render UI.
  • NanoVG: To draw on texture.

TODOs

  • This blog post about implementing a brush tool on html5 canvas needs to be checked, because the brush tools still gives discontinuous lines/circles (maybe interpolate the path drawn by user).
  • Bug: Painting at bottom (after scrolling) of image doesn't draw at the right location (y-coord is wrong at bottom, check with tooltip)

Not used anymore

Currently, shapes (lines & circles) are painted directly on the opengl texture (i.e. on the gpu) with NanoVG, so Cairo & GDK aren't needed anymore.

  • Cairo: used to be used draw shapes on the image, and needs to be installed beforehand (see this example).
  • GDK: used to be used to convert edited Cairo image surface to pixel data before rendering (avoids costly writing to disk eachtime a shape is drawn).

Both dependencies were installed on Ubuntu:

$ apt install libglfw3-dev libcairo2-dev libgtk-3-dev

Test

This app was tested on the following drivers:

  • Opengl-3.0 & GLSL-1.30
  • Opengl-4.6 & GLSL-4.60

Bundled dependencies

Imgui

  • Source and header files for imgui were copied directly from imgui-repo into this project.
  • Follow imgui-example to include imgui in an opengl/glsw project.

Documentation

ImGuiFileDialog

Downloaded from repo and installed following the tutorial found on the same page.

IconFontCppHeaders

Downloaded from repo