move glx context into platform window

This commit is contained in:
Matthew 2026-05-17 15:53:13 +10:00
parent 9f2b7d84dc
commit c7454e4695

View File

@ -614,6 +614,10 @@ struct PlatformWindow
TicketMut cb_mut; TicketMut cb_mut;
Selection[CBM.max] selections; Selection[CBM.max] selections;
version(linux) u32 cb_transfer_size; version(linux) u32 cb_transfer_size;
static if(__traits(compiles, { GLXContext context; }))
{
GLXContext glx_context;
}
}; };
struct Library struct Library
@ -833,15 +837,15 @@ CreateWindow(
None, None,
]; ];
GLXContext context = glXCreateContextAttribsARB(window.display, chosen_fb_config, null, True, context_attributes.ptr); window.glx_context = glXCreateContextAttribsARB(window.display, chosen_fb_config, null, True, context_attributes.ptr);
if(!context) if(!window.glx_context)
{ {
Errf("Failed to create OpenGL context"); Errf("Failed to create OpenGL context");
return false; return false;
} }
glXMakeCurrent(window.display, window.window, context); glXMakeCurrent(window.display, window.window, window.glx_context);
GLLoadFuncs(); GLLoadFuncs();
} }