|
|
> El 15 sep. 2022, a las 10:27, Ian MacArthur <imacarthur@gmail.com> escribió:
>
> So... like creating an offscreen GL surface, and then getting the context for that, perhaps?
Yes. The issue is that the offscreen GL surface is not drawn inside the GL window’s draw() method, so there’s no GL context.
> I think you can (at least with fltk-1.4) create offscreen GL surfaces, so that sounds entirely feasible.
>
> That said, the example I thought I had of that, I can not now find; I was pretty sure it was on this laptop, but apparently not...
I found WIN32 code to do what I want, but I cannot find X11/Wayland or macOS code to do it. Here’s what I mean to be doing:
void Program::someFunction()
{
HDC hdc = wglGetCurrentDC();
HGLRC hglrc = wglGetCurrentContext(); // this we can get from another GL window with the context() member function
HGLRC hglrc_new = wglCreateContext(hdc);
wglShareLists(hglrc, hglrc_new);
loadThread = boost::thread(&Program::loadFunc, this, hdc, hglrc_new);
}
/**
* Imports all our assets. Supposed to run in its own thread with its own OpenGL context.
* @param hdc The current device context.
* @param hglrc A OpenGL context thats shares its display list with the main rendering context.
*/
void Program::loadFunc(HDC hdc, HGLRC hglrc)
{
wglMakeCurrent(hdc, hglrc);
//Do stuff...
wglMakeCurrent(NULL, NULL);
wglDeleteContext(hglrc);
}
—
Gonzalo Garramuno
ggarra13@gmail.com
--
You received this message because you are subscribed to the Google Groups "fltk.general" group.
To unsubscribe from this group and stop receiving emails from it, send an email to fltkgeneral+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/fltkgeneral/5809DAD1-0C07-4065-A5D4-3C1FFEED36C4%40gmail.com.
[ Direct Link to Message ] | |
|
| |