For quite some time I am publishing so called Sciter.Lite version of Sciter Engine on the site and on GitHub.
Sciter.Lite allows to render UI defined as HTML/CSS and optionally script on surface GLFW windows. Sciter SDK has demo project of how to bind GLFW / OpenGL and Sciter.
Sciter supports layered output where pure OpenGL primitives rendering is sandwiched between background and foreground HTML/CSS layers. See this article and movie ( while it is about DirectX, with GLFW principles are the same).
In GLFW context Sciter can render its stuff as on OpenGL directly as on bitmap. Internally Sciter.Lite uses Skia as a graphics backend. And for the note “Big” Sciter can use DirectX/Direct2D, CoreGraphics (on Mac) and Cairo (on GTK).
For the note: Sciter API exposes sciter::graphics API, see: sciter-x-graphics.hpp ) for the cases when standard HTML/CSS rendering is not enough. So your native code can use this set of anti-aliased 2D rendering primitives directly.
Is it possible in GLFW to create two separate OpenGL context for the same window?
Windows specific code as an example:
HDC hdc;
HGLRC hglrc1, hglrc2;
// create a rendering context
hglrc1 = wglCreateContext (hdc);
hglrc2 = wglCreateContext (hdc); // not sure if Windows supports that by default.
wglShareLists(hglrc1,hglrc2);
So two independent drawing systems can be used in two different layers:
// make it the calling thread's current rendering context
wglMakeCurrent (hdc, hglrc1);
// call Sciter's paint here
wglMakeCurrent (hdc, hglrc2);
// call your paint here
// Done, swap buffers
SwapBuffers(hdc);
// or wglSwapLayerBuffers(hdc) if OpenGL layers are used.