Minimal OpenGL ES 3.0 blur helper for Android. Two paths:
Hardware::GPU(fast, framebuffer ping-pong)Hardware::CPU(readback + CPU box blur)Blur::Type:DefaultGaussianBoxFrostedKawaseBokehMotionZoomPixelate
blur.hppblur.cppblur/math.hppblur/cpu/cpu.cppblur/gpu/gpu.cppblur/gpu/shaders/shaders.hppdemo/demo_blur.cppdemo/examples/imgui_examples.cppdemo/examples/opengl_examples.cpp
- If you use regular GLES headers/functions, do nothing.
- If your project uses dynamic GL function loading (for example via function pointers), build with:
-DBLUR_RENDERER_NO_GLES
- In this mode,
blur.hppincludes:#include "../good_luck/glegl/glegl.h"
- Replace that include with your own GL loader header path if needed.
- If you use ImGui overloads (
ImDrawList,ImRect,ImVec2variants), make sureimgui.his available in include paths.
- Add sources to build:
imgui-android-blur/blur.cppimgui-android-blur/blur/cpu/cpu.cppimgui-android-blur/blur/gpu/gpu.cpp
- Add include path(s):
imgui-android-blur- your ImGui headers path (if using ImGui overloads)
- If you use dynamic GL loading, add compiler define:
-DBLUR_RENDERER_NO_GLES
- Include and use in render loop:
#include "../imgui-android-blur/blur.hpp"
static Blur* blur = nullptr;
if (!blur) {
blur = new Blur(Hardware::GPU);
}
blur->process(x, y, w, h, 12.0f, 4);
// draw blur->tex in your renderer / ImGui draw listThis pointer-style init avoids destructor-time GL cleanup when the library is unloaded without a valid GL context.
- ImGui settings demo window:
demo/demo_blur.cpp - ImGui example:
demo/examples/imgui_examples.cpp - OpenGL ES example:
demo/examples/opengl_examples.cpp
- Coordinates for
process(draw, ...)are derived from the current ImGui window. - For ImGui, flip UVs
(0,1)to(1,0)to display correctly. Hardware::CPUdoesglReadPixelsand is slower.
