I’m trying to create a core profile context in a windowed application that uses a GUI toolkit. The toolkit creates the window and I just get a handle to it I pass to the context creation functions. However, as I understand it requires me to first create a dummy context the old way in order to access the new wgl extensions namely wglCreateContextAttribsARB, then I will have to destroy the window since I cannot use it with different pixel format. This is the problem, I don’t own the window, it’s created by the toolkit and passed to me. Is there a workaround to this problem?
In general, any GUI toolkit worth using with OpenGL (outside of Win32 itself) will have an “OpenGL Widget” that takes care of all of this for you. What toolkit are you using that doesn’t have one?
I’m using Qt, but I don’t want to use their OpenGL widget since I implemented a different way to create 3D graphics-capable windows. I wanted the application to be decoupled from the rendering engine. This way I can have different rendering paths provided by different modules (dynamically loaded), one for a different version of OpenGL or even Direct3D. All I have to do is just passing the native window handle to the graphics engine, which then creates the rendering context and associate the window with it.
So if I’m not changing the pixel format, do I still need to destroy the window?
After further researching I call for a unified context management API. The way wglCRAP works is nonsense. It’s ancient and cannot serve the job anymore. ARB go ahead with a new API, we need this very soon. Just do it.
Direct your complaints towards MS-Windows. The ass-backwardness of wgl* is because Windows is stuck with OGL 1.4 (or less for some OS versions).