PDA

View Full Version : Creating Context the "Modern" Way?



Janika
06-06-2012, 07:11 AM
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?

Thanks.

Alfonse Reinheart
06-06-2012, 09:34 AM
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?

Janika
06-06-2012, 09:44 AM
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.

Janika
06-06-2012, 03:29 PM
So if I'm not changing the pixel format, do I still need to destroy the window?

Janika
06-08-2012, 07:16 AM
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. :D

tanzanite
06-08-2012, 05:44 PM
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).