You haven't stated what Programming language you want the answer in.
Do we have to guess ?
Programming language doesn't matter here. Code example in C is proffered for simplicity, but I don't care about it - you can write code examples in any language, I can read it with no problem in C, C#, Java, Python, Rust or any other. The question is about OpenGL context initialization which is the same for any language.
I'm not sure, may be this question is too complicated for this forum, but I don't have idea where to ask for help with this, so I wrote it here. Who knows, may be someone have good knowledge about OpenGL initialization and can help.
By the way I asked ChatGPT about this issue, it failed to solve it